1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

rename for 0.9.0:

rename default templates package from ui/* templates to templates/*
rename default subdirs: warcs -> archive, cdx -> indexes
This commit is contained in:
Ilya Kreymer 2015-03-16 18:48:09 -07:00
parent 19b8650891
commit 2f6780a576
17 changed files with 47 additions and 49 deletions

View File

@ -6,8 +6,8 @@
collections_root: collections
paths:
archive_paths: warcs
index_paths: cdx
archive_paths: archive
index_paths: indexes
static_path: static
templates_dir: templates
@ -28,20 +28,20 @@ paths:
proxy_cert_download_html: proxy_cert_download.html
proxy_select_html: proxy_select.html
head_insert_html: ui/head_insert.html
frame_insert_html: ui/frame_insert.html
head_insert_html: templates/head_insert.html
frame_insert_html: templates/frame_insert.html
banner_html: banner.html
home_html: ui/index.html
home_html: templates/index.html
query_html: ui/query.html
search_html: ui/search.html
query_html: templates/query.html
search_html: templates/search.html
error_html: ui/error.html
not_found_html: ui/not_found.html
error_html: templates/error.html
not_found_html: templates/not_found.html
proxy_cert_download_html: ui/proxy_cert_download.html
proxy_select_html: ui/proxy_select.html
proxy_cert_download_html: templates/proxy_cert_download.html
proxy_select_html: templates/proxy_select.html
template_globals:
static_path: static/default

View File

@ -35,7 +35,7 @@ class SearchPageWbUrlHandler(WbUrlHandler):
self.response_class = WbResponse
if self.is_frame_mode:
html = config.get('frame_insert_html', 'ui/frame_insert.html')
html = config.get('frame_insert_html', 'templates/frame_insert.html')
self.frame_insert_view = (J2TemplateView.
create_template(html, 'Frame Insert'))

View File

@ -157,7 +157,7 @@ class HeadInsertView(J2TemplateView):
def init_from_config(config):
view = config.get('head_insert_view')
if not view:
html = config.get('head_insert_html', 'ui/head_insert.html')
html = config.get('head_insert_html', 'templates/head_insert.html')
if html:
banner_html = config.get('banner_html', 'banner.html')

View File

@ -34,7 +34,7 @@ class PyTest(TestCommand):
setup(
name='pywb',
version='0.9.0-beta',
version='0.9.0b',
url='https://github.com/ikreymer/pywb',
author='Ilya Kreymer',
author_email='ikreymer@gmail.com',
@ -56,7 +56,7 @@ setup(
'pywb.apps'
],
package_data={
'pywb': ['static/flowplayer/*', 'static/*.*', 'ui/*', '*.yaml'],
'pywb': ['static/flowplayer/*', 'static/*.*', 'templates/*', '*.yaml'],
},
data_files=[
('sample_archive/cdx', glob.glob('sample_archive/cdx/*')),
@ -90,7 +90,7 @@ setup(
cdx-indexer = pywb.warc.cdxindexer:main
live-rewrite-server = pywb.apps.live_rewrite_server:main
proxy-cert-auth = pywb.framework.certauth:main
wb-manager = pywb.manager.manager:main_wrap_exc
wayback-manager = pywb.manager.manager:main_wrap_exc
""",
classifiers=[
'Development Status :: 4 - Beta',

View File

@ -17,6 +17,10 @@ from pytest import raises
from mock import patch
#=============================================================================
ARCHIVE_DIR = 'archive'
INDEX_DIR = 'indexes'
#=============================================================================
root_dir = None
orig_cwd = None
@ -40,14 +44,6 @@ def teardown_module():
os.chdir(orig_cwd)
#=============================================================================
mock_input_value = ''
def mock_raw_input(*args):
global mock_input_value
return mock_input_value
#=============================================================================
class TestManagedColls(object):
def setup(self):
@ -62,6 +58,9 @@ class TestManagedColls(object):
for dir_ in dirlist:
assert os.path.isdir(os.path.join(base, dir_))
def _get_sample_warc(self, name):
return os.path.join(get_test_dir(), 'warcs', name)
def test_create_first_coll(self):
""" Test first collection creation, with all required dirs
"""
@ -73,12 +72,12 @@ class TestManagedColls(object):
test = os.path.join(colls, 'test')
assert os.path.isdir(test)
self._check_dirs(test, ['cdx', 'warcs', 'static', 'templates'])
self._check_dirs(test, [INDEX_DIR, ARCHIVE_DIR, 'static', 'templates'])
def test_add_warcs(self):
""" Test adding warc to new coll, check replay
"""
warc1 = os.path.join(get_test_dir(), 'warcs', 'example.warc.gz')
warc1 = self._get_sample_warc('example.warc.gz')
main(['add', 'test', warc1])
@ -89,7 +88,7 @@ class TestManagedColls(object):
def test_another_coll(self):
""" Test adding warc to a new coll, check replay
"""
warc1 = os.path.join(get_test_dir(), 'warcs', 'example.warc.gz')
warc1 = self._get_sample_warc('example.warc.gz')
main(['init', 'foo'])
@ -102,8 +101,8 @@ class TestManagedColls(object):
def test_add_more_warcs(self):
""" Test adding additional warcs, check replay of added content
"""
warc1 = os.path.join(get_test_dir(), 'warcs', 'iana.warc.gz')
warc2 = os.path.join(get_test_dir(), 'warcs', 'example-extra.warc')
warc1 = self._get_sample_warc('iana.warc.gz')
warc2 = self._get_sample_warc('example-extra.warc')
main(['add', 'test', warc1, warc2])
@ -127,15 +126,15 @@ class TestManagedColls(object):
main(['init', 'nested'])
nested_root = os.path.join(self.root_dir, 'collections', 'nested', 'warcs')
nested_root = os.path.join(self.root_dir, 'collections', 'nested', ARCHIVE_DIR)
nested_a = os.path.join(nested_root, 'A')
nested_b = os.path.join(nested_root, 'B', 'sub')
os.makedirs(nested_a)
os.makedirs(nested_b)
warc1 = os.path.join(get_test_dir(), 'warcs', 'iana.warc.gz')
warc2 = os.path.join(get_test_dir(), 'warcs', 'example.warc.gz')
warc1 = self._get_sample_warc('iana.warc.gz')
warc2 = self._get_sample_warc('example.warc.gz')
shutil.copy2(warc1, nested_a)
shutil.copy2(warc2, nested_b)
@ -146,7 +145,7 @@ class TestManagedColls(object):
os.path.join(nested_b, 'example.warc.gz')
])
nested_cdx = os.path.join(self.root_dir, 'collections', 'nested', 'cdx', 'index.cdx')
nested_cdx = os.path.join(self.root_dir, 'collections', 'nested', INDEX_DIR, 'index.cdx')
with open(nested_cdx) as fh:
nested_cdx_index = fh.read()
@ -165,7 +164,7 @@ class TestManagedColls(object):
to ensure equality of indexes
"""
# ensure merged index is same as full reindex
coll_dir = os.path.join(self.root_dir, 'collections', 'test', 'cdx')
coll_dir = os.path.join(self.root_dir, 'collections', 'test', INDEX_DIR)
orig = os.path.join(coll_dir, 'index.cdx')
bak = os.path.join(coll_dir, 'index.bak')
@ -263,7 +262,7 @@ class TestManagedColls(object):
fh.write('config.yaml overriden search page: ')
fh.write('{{ wbrequest.user_metadata | tojson }}\n')
os.rename(os.path.join(self.root_dir, 'collections', 'test', 'cdx'),
os.rename(os.path.join(self.root_dir, 'collections', 'test', INDEX_DIR),
os.path.join(self.root_dir, 'collections', 'test', 'cdx2'))
self._create_app()
@ -297,7 +296,6 @@ class TestManagedColls(object):
def test_add_template_input_yes(self):
""" Test answer 'yes' to overwrite
"""
mock_raw_input_value = 'y'
main(['template', 'foo', '--add', 'query_html'])
@ -379,14 +377,14 @@ class TestManagedColls(object):
def test_err_no_such_coll(self):
""" Test error adding warc to non-existant collection
"""
warc1 = os.path.join(get_test_dir(), 'warcs', 'example.warc.gz')
warc1 = self._get_sample_warc('example.warc.gz')
with raises(IOError):
main(['add', 'bar', warc1])
def test_err_wrong_warcs(self):
warc1 = os.path.join(get_test_dir(), 'warcs', 'example.warc.gz')
invalid_warc = os.path.join(self.root_dir, 'collections', 'test', 'warcs', 'invalid.warc.gz')
warc1 = self._get_sample_warc('example.warc.gz')
invalid_warc = os.path.join(self.root_dir, 'collections', 'test', ARCHIVE_DIR, 'invalid.warc.gz')
# Empty warc list, argparse calls exit
with raises(SystemExit):
@ -411,14 +409,14 @@ class TestManagedColls(object):
self._create_app()
# No WARCS
warcs_path = os.path.join(colls, 'foo', 'warcs')
warcs_path = os.path.join(colls, 'foo', ARCHIVE_DIR)
shutil.rmtree(warcs_path)
with raises(IOError):
main(['add', 'foo', 'somewarc'])
# No CDX
cdx_path = os.path.join(colls, 'foo', 'cdx')
cdx_path = os.path.join(colls, 'foo', INDEX_DIR)
shutil.rmtree(cdx_path)
with raises(Exception):

View File

@ -70,31 +70,31 @@ archive_paths: ['./invalid/path/to/ignore/', './sample_archive/warcs/']
# ==== Optional UI: HTML/Jinja2 Templates ====
# template for <head> insert into replayed html content
head_insert_html: ui/head_insert.html
head_insert_html: templates/head_insert.html
# template to for 'calendar' query,
# eg, a listing of captures in response to a ../*/<url>
#
# may be a simple listing or a more complex 'calendar' UI
# if omitted, will list raw cdx in plain text
query_html: ui/query.html
query_html: templates/query.html
# template for search page, which is displayed when no search url is entered
# in a collection
search_html: ui/search.html
search_html: templates/search.html
# template for home page.
# if no other route is set, this will be rendered at /, /index.htm and /index.html
home_html: ui/index.html
home_html: templates/index.html
# error page temlpate for may formatting error message and details
# if omitted, a text response is returned
error_html: ui/error.html
error_html: templates/error.html
# template for 404 not found error, may be customized per collection
not_found_html: ui/not_found.html
not_found_html: templates/not_found.html
# ==== Other Paths ====

View File

@ -1,14 +1,14 @@
collections:
all:
- ./sample_archive/cdx/iana.cdx
- ./sample_archive/cdx/dupes.cdx
- ./sample_archive/cdx/dupes.cdx
- ./sample_archive/cdx/post-test.cdx
older:
- ./sample_archive/cdx/iana.cdx
newer:
- ./sample_archive/cdx/dupes.cdx
- ./sample_archive/cdx/dupes.cdx
archive_paths: ./sample_archive/warcs/