- Upgrade and fix versions for dependencies - Use the typogrify package on pypi - Fix tests that break because of the upgrades - Bump versionmain
| @@ -1,4 +1,10 @@ | |||||
| Version 0.8.5a14 | |||||
| Version 0.8.5a16 | |||||
| ============================================================ | |||||
| * Upgrade dependencies and setup for 0.8.5 | |||||
| * Bug fix: Use the released version of typogrify. (Issue #193) | |||||
| Version 0.8.5a15 | |||||
| ============================================================ | ============================================================ | ||||
| * Bug Fix: Fixed stylus `indent` issues with empty files. (Issue #161) | * Bug Fix: Fixed stylus `indent` issues with empty files. (Issue #161) | ||||
| @@ -1,4 +1,4 @@ | |||||
| Version 0.8.5a14 | |||||
| Version 0.8.5a16 | |||||
| A brand new **hyde** | A brand new **hyde** | ||||
| ==================== | ==================== | ||||
| @@ -1,16 +1,6 @@ | |||||
| commando==0.1.1a | |||||
| PyYAML==3.09 | |||||
| Markdown==2.0.3 | |||||
| MarkupSafe==0.11 | |||||
| pygments | |||||
| smartypants==1.6.0.3 | |||||
| -e git://github.com/hyde/typogrify.git#egg=typogrify | |||||
| Jinja2==2.5.5 | |||||
| pyquery==0.6.1 | |||||
| unittest2==0.5.1 | |||||
| mock==0.7.0b4 | |||||
| nose==1.0.0 | |||||
| pep8==0.6.1 | |||||
| pylint==0.22.0 | |||||
| pysmell==0.7.3 | |||||
| -r requirements.txt | |||||
| pyquery | |||||
| docutils | |||||
| mock | |||||
| nose | |||||
| PIL | PIL | ||||
| @@ -2,50 +2,26 @@ | |||||
| """ | """ | ||||
| Implements the hyde entry point commands | Implements the hyde entry point commands | ||||
| """ | """ | ||||
| from commando import * | |||||
| from commando import ( | |||||
| Application, | |||||
| command, | |||||
| store, | |||||
| subcommand, | |||||
| true, | |||||
| version | |||||
| ) | |||||
| from hyde.exceptions import HydeException | from hyde.exceptions import HydeException | ||||
| from hyde.fs import FS, File, Folder | |||||
| from hyde.fs import FS, Folder | |||||
| from hyde.layout import Layout, HYDE_DATA | from hyde.layout import Layout, HYDE_DATA | ||||
| from hyde.model import Config | from hyde.model import Config | ||||
| from hyde.site import Site | from hyde.site import Site | ||||
| from hyde.version import __version__ | from hyde.version import __version__ | ||||
| from hyde.util import getLoggerWithConsoleHandler | from hyde.util import getLoggerWithConsoleHandler | ||||
| import codecs | |||||
| import os | |||||
| import sys | |||||
| import yaml | |||||
| HYDE_LAYOUTS = "HYDE_LAYOUTS" | HYDE_LAYOUTS = "HYDE_LAYOUTS" | ||||
| logger = getLoggerWithConsoleHandler('hyde') | |||||
| class Engine(Application): | class Engine(Application): | ||||
| """ | |||||
| The Hyde Application | |||||
| """ | |||||
| def __init__(self, raise_exceptions=False): | |||||
| self.raise_exceptions = raise_exceptions | |||||
| super(Engine, self).__init__() | |||||
| def run(self, args=None): | |||||
| """ | |||||
| The engine entry point. | |||||
| """ | |||||
| # Catch any errors thrown and log the message. | |||||
| try: | |||||
| super(Engine, self).run(args) | |||||
| except HydeException, he: | |||||
| if self.raise_exceptions: | |||||
| raise | |||||
| elif self.__parser__: | |||||
| self.__parser__.error(he.message) | |||||
| else: | |||||
| logger.error(he.message) | |||||
| return -1 | |||||
| @command(description='hyde - a python static website generator', | @command(description='hyde - a python static website generator', | ||||
| epilog='Use %(prog)s {command} -h to get help on individual commands') | epilog='Use %(prog)s {command} -h to get help on individual commands') | ||||
| @@ -60,7 +36,7 @@ class Engine(Application): | |||||
| """ | """ | ||||
| if args.verbose: | if args.verbose: | ||||
| import logging | import logging | ||||
| logger.setLevel(logging.DEBUG) | |||||
| self.logger.setLevel(logging.DEBUG) | |||||
| sitepath = Folder(args.sitepath).fully_expanded_path | sitepath = Folder(args.sitepath).fully_expanded_path | ||||
| return Folder(sitepath) | return Folder(sitepath) | ||||
| @@ -83,7 +59,7 @@ class Engine(Application): | |||||
| "The given site path [%s] already contains a hyde site." | "The given site path [%s] already contains a hyde site." | ||||
| " Use -f to overwrite." % sitepath) | " Use -f to overwrite." % sitepath) | ||||
| layout = Layout.find_layout(args.layout) | layout = Layout.find_layout(args.layout) | ||||
| logger.info( | |||||
| self.logger.info( | |||||
| "Creating site at [%s] with layout [%s]" % (sitepath, layout)) | "Creating site at [%s] with layout [%s]" % (sitepath, layout)) | ||||
| if not layout or not layout.exists: | if not layout or not layout.exists: | ||||
| raise HydeException( | raise HydeException( | ||||
| @@ -92,7 +68,7 @@ class Engine(Application): | |||||
| " has been setup properly if you are using custom path for" | " has been setup properly if you are using custom path for" | ||||
| " layouts" % HYDE_DATA) | " layouts" % HYDE_DATA) | ||||
| layout.copy_contents_to(args.sitepath) | layout.copy_contents_to(args.sitepath) | ||||
| logger.info("Site creation complete") | |||||
| self.logger.info("Site creation complete") | |||||
| @subcommand('gen', help='Generate the site') | @subcommand('gen', help='Generate the site') | ||||
| @store('-c', '--config-path', default='site.yaml', dest='config', | @store('-c', '--config-path', default='site.yaml', dest='config', | ||||
| @@ -112,11 +88,11 @@ class Engine(Application): | |||||
| gen = Generator(site) | gen = Generator(site) | ||||
| incremental = True | incremental = True | ||||
| if args.regen: | if args.regen: | ||||
| logger.info("Regenerating the site...") | |||||
| self.logger.info("Regenerating the site...") | |||||
| incremental = False | incremental = False | ||||
| gen.generate_all(incremental=incremental) | gen.generate_all(incremental=incremental) | ||||
| logger.info("Generation complete.") | |||||
| self.logger.info("Generation complete.") | |||||
| @subcommand('serve', help='Serve the website') | @subcommand('serve', help='Serve the website') | ||||
| @store('-a', '--address', default='localhost', dest='address', | @store('-a', '--address', default='localhost', dest='address', | ||||
| @@ -134,17 +110,16 @@ class Engine(Application): | |||||
| the entire site or specific files based on ths request. | the entire site or specific files based on ths request. | ||||
| """ | """ | ||||
| sitepath = self.main(args) | sitepath = self.main(args) | ||||
| config_file = sitepath.child(args.config) | |||||
| site = self.make_site(sitepath, args.config, args.deploy) | site = self.make_site(sitepath, args.config, args.deploy) | ||||
| from hyde.server import HydeWebServer | from hyde.server import HydeWebServer | ||||
| server = HydeWebServer(site, args.address, args.port) | server = HydeWebServer(site, args.address, args.port) | ||||
| logger.info("Starting webserver at [%s]:[%d]", args.address, args.port) | |||||
| self.logger.info("Starting webserver at [%s]:[%d]", args.address, args.port) | |||||
| try: | try: | ||||
| server.serve_forever() | server.serve_forever() | ||||
| except KeyboardInterrupt, SystemExit: | |||||
| logger.info("Received shutdown request. Shutting down...") | |||||
| except (KeyboardInterrupt, SystemExit): | |||||
| self.logger.info("Received shutdown request. Shutting down...") | |||||
| server.shutdown() | server.shutdown() | ||||
| logger.info("Server successfully stopped") | |||||
| self.logger.info("Server successfully stopped") | |||||
| exit() | exit() | ||||
| @subcommand('publish', help='Publish the website') | @subcommand('publish', help='Publish the website') | ||||
| @@ -9,7 +9,6 @@ import re | |||||
| import itertools | import itertools | ||||
| from urllib import quote, unquote | from urllib import quote, unquote | ||||
| from hyde.fs import File, Folder | |||||
| from hyde.model import Expando | from hyde.model import Expando | ||||
| from hyde.template import HtmlWrap, Template | from hyde.template import HtmlWrap, Template | ||||
| from hyde.util import getLoggerWithNullHandler | from hyde.util import getLoggerWithNullHandler | ||||
| @@ -693,12 +692,12 @@ class Jinja2Template(Template): | |||||
| self.env.extend(config=config) | self.env.extend(config=config) | ||||
| try: | try: | ||||
| from typogrify.templatetags import jinja2_filters | |||||
| from typogrify.templatetags import jinja_filters | |||||
| except ImportError: | except ImportError: | ||||
| jinja2_filters = False | |||||
| jinja_filters = False | |||||
| if jinja2_filters: | |||||
| jinja2_filters.register(self.env) | |||||
| if jinja_filters: | |||||
| jinja_filters.register(self.env) | |||||
| def clear_caches(self): | def clear_caches(self): | ||||
| """ | """ | ||||
| @@ -0,0 +1,45 @@ | |||||
| Requirements | |||||
| ============ | |||||
| All the python requirements are enumerated in dev-req.txt. You can install them | |||||
| with: | |||||
| :: | |||||
| pip install -r dev-req.txt | |||||
| Apart from these requirements the following are required by plugins if you | |||||
| choose to run the corresponding tests. Some of the comands use the Mac OS X | |||||
| package manager `homebrew` - please use the package manager corresponding to | |||||
| your operating system. | |||||
| :: | |||||
| # stylus | |||||
| npm install -g stylus | |||||
| #uglifyjs | |||||
| npm install -g uglify-js | |||||
| #asciidoc | |||||
| brew install asciidoc | |||||
| cd /usr/local/Cellar/asciidoc/8.6.8/bin | |||||
| curl -O https://asciidoc.googlecode.com/hg/asciidocapi.py | |||||
| #optipng | |||||
| brew install optipng | |||||
| Ensure that `asciidoc`_ python api is available in the python path. | |||||
| For example: | |||||
| :: | |||||
| export PYTHONPATH=/usr/local/Cellar/asciidoc/8.6.8/bin:$PYTHONPATH | |||||
| Run the tests | |||||
| ============= | |||||
| :: | |||||
| nosetests hyde/tests | |||||
| @@ -5,7 +5,6 @@ Use nose | |||||
| `$ nosetests` | `$ nosetests` | ||||
| """ | """ | ||||
| from hyde.fs import File, Folder | from hyde.fs import File, Folder | ||||
| from hyde.model import Expando | |||||
| from hyde.generator import Generator | from hyde.generator import Generator | ||||
| from hyde.site import Site | from hyde.site import Site | ||||
| @@ -4,7 +4,6 @@ Use nose | |||||
| `$ pip install nose` | `$ pip install nose` | ||||
| `$ nosetests` | `$ nosetests` | ||||
| """ | """ | ||||
| from hyde.ext.plugins.meta import MetaPlugin | |||||
| from hyde.fs import File, Folder | from hyde.fs import File, Folder | ||||
| from hyde.generator import Generator | from hyde.generator import Generator | ||||
| from hyde.site import Site | from hyde.site import Site | ||||
| @@ -72,8 +71,8 @@ Heading 2 | |||||
| text = target.read_all() | text = target.read_all() | ||||
| q = PyQuery(text) | q = PyQuery(text) | ||||
| assert q("h1").length == 2 | assert q("h1").length == 2 | ||||
| assert q("h1:eq(0)").text().strip() == "Heading 1" | |||||
| assert q("h1:eq(1)").text().strip() == "Heading 2" | |||||
| assert q("h1:nth-child(1)").text().strip() == "Heading 1" | |||||
| assert q("h1:nth-child(2)").text().strip() == "Heading 2" | |||||
| def test_can_load_front_matter(self): | def test_can_load_front_matter(self): | ||||
| d = {'title': 'A nice title', | d = {'title': 'A nice title', | ||||
| @@ -4,13 +4,11 @@ Use nose | |||||
| `$ pip install nose` | `$ pip install nose` | ||||
| `$ nosetests` | `$ nosetests` | ||||
| """ | """ | ||||
| from hyde.fs import File, Folder | |||||
| from hyde.fs import File | |||||
| from hyde.generator import Generator | from hyde.generator import Generator | ||||
| from hyde.model import Expando | |||||
| from hyde.site import Site | from hyde.site import Site | ||||
| from hyde.tests.util import assert_html_equals | |||||
| import yaml | |||||
| TEST_SITE = File(__file__).parent.parent.child_folder('_test') | TEST_SITE = File(__file__).parent.parent.child_folder('_test') | ||||
| @@ -86,8 +84,8 @@ class TestTagger(object): | |||||
| assert q | assert q | ||||
| assert q('li').length == 2 | assert q('li').length == 2 | ||||
| assert q('li a:first-child').attr('href') == '/blog/another-sad-post.html' | |||||
| assert q('li a:eq(1)').attr('href') == '/blog/sad-post.html' | |||||
| assert q('li:nth-child(1) a').attr('href') == '/blog/another-sad-post.html' | |||||
| assert q('li:nth-child(2) a').attr('href') == '/blog/sad-post.html' | |||||
| q = PyQuery(File(tags_folder.child('happy.html')).read_all()) | q = PyQuery(File(tags_folder.child('happy.html')).read_all()) | ||||
| assert q | assert q | ||||
| @@ -105,9 +103,9 @@ class TestTagger(object): | |||||
| assert q | assert q | ||||
| assert q('li').length == 3 | assert q('li').length == 3 | ||||
| assert q('li a:eq(0)').attr('href') == '/blog/happy-post.html' | |||||
| assert q('li a:eq(1)').attr('href') == '/blog/angry-post.html' | |||||
| assert q('li a:eq(2)').attr('href') == '/blog/sad-post.html' | |||||
| assert q('li:nth-child(1) a').attr('href') == '/blog/happy-post.html' | |||||
| assert q('li:nth-child(2) a').attr('href') == '/blog/angry-post.html' | |||||
| assert q('li:nth-child(3) a').attr('href') == '/blog/sad-post.html' | |||||
| q = PyQuery(File(tags_folder.child('events.html')).read_all()) | q = PyQuery(File(tags_folder.child('events.html')).read_all()) | ||||
| assert q | assert q | ||||
| @@ -8,7 +8,7 @@ Use nose | |||||
| from hyde.engine import Engine | from hyde.engine import Engine | ||||
| from hyde.exceptions import HydeException | from hyde.exceptions import HydeException | ||||
| from hyde.fs import FS, File, Folder | |||||
| from hyde.fs import File, Folder | |||||
| from hyde.layout import Layout | from hyde.layout import Layout | ||||
| from nose.tools import raises, with_setup, nottest | from nose.tools import raises, with_setup, nottest | ||||
| @@ -8,19 +8,17 @@ Some code borrowed from rwbench.py from the jinja2 examples | |||||
| """ | """ | ||||
| from datetime import datetime | from datetime import datetime | ||||
| from hyde.ext.templates.jinja import Jinja2Template | from hyde.ext.templates.jinja import Jinja2Template | ||||
| from hyde.fs import File, Folder | |||||
| from hyde.fs import File | |||||
| from hyde.site import Site | from hyde.site import Site | ||||
| from hyde.generator import Generator | from hyde.generator import Generator | ||||
| from hyde.model import Config | from hyde.model import Config | ||||
| import jinja2 | |||||
| from jinja2.utils import generate_lorem_ipsum | from jinja2.utils import generate_lorem_ipsum | ||||
| from random import choice, randrange | from random import choice, randrange | ||||
| from util import assert_html_equals | |||||
| import yaml | import yaml | ||||
| from pyquery import PyQuery | from pyquery import PyQuery | ||||
| from nose.tools import raises, nottest, with_setup | |||||
| from nose.tools import nottest | |||||
| ROOT = File(__file__).parent | ROOT = File(__file__).parent | ||||
| JINJA2 = ROOT.child_folder('templates/jinja2') | JINJA2 = ROOT.child_folder('templates/jinja2') | ||||
| @@ -138,35 +136,14 @@ def test_asciidoc(): | |||||
| t = Jinja2Template(JINJA2.path) | t = Jinja2Template(JINJA2.path) | ||||
| t.configure(None) | t.configure(None) | ||||
| html = t.render(source, {}).strip() | html = t.render(source, {}).strip() | ||||
| expected_output=""" | |||||
| <hr> | |||||
| <h2><a name="_heading_2"></a>Heading 2</h2> | |||||
| <ul> | |||||
| <li> | |||||
| <p> | |||||
| test1 | |||||
| </p> | |||||
| </li> | |||||
| <li> | |||||
| <p> | |||||
| test2 | |||||
| </p> | |||||
| </li> | |||||
| <li> | |||||
| <p> | |||||
| test3 | |||||
| </p> | |||||
| </li> | |||||
| </ul> | |||||
| """ | |||||
| assert html | assert html | ||||
| q = PyQuery(html) | q = PyQuery(html) | ||||
| assert q | assert q | ||||
| assert q("li").length == 3 | assert q("li").length == 3 | ||||
| assert q("li:eq(0)").text().strip() == "test1" | |||||
| assert q("li:eq(1)").text().strip() == "test2" | |||||
| assert q("li:eq(2)").text().strip() == "test3" | |||||
| assert q("li:nth-child(1)").text().strip() == "test1" | |||||
| assert q("li:nth-child(2)").text().strip() == "test2" | |||||
| assert q("li:nth-child(3)").text().strip() == "test3" | |||||
| def test_markdown(): | def test_markdown(): | ||||
| source = """ | source = """ | ||||
| @@ -242,7 +219,7 @@ def test_markdown_with_extensions(): | |||||
| t.configure(s) | t.configure(s) | ||||
| t.env.filters['dateformat'] = dateformat | t.env.filters['dateformat'] = dateformat | ||||
| html = t.render(source, {}).strip() | html = t.render(source, {}).strip() | ||||
| assert html == u'<h3 id="heading_3">Heading 3</h3>' | |||||
| assert html == u'<h3 id="heading-3">Heading 3</h3>' | |||||
| def test_markdown_with_sourcecode(): | def test_markdown_with_sourcecode(): | ||||
| source = """ | source = """ | ||||
| @@ -292,7 +269,7 @@ def test_line_statements(): | |||||
| t.configure(s) | t.configure(s) | ||||
| t.env.filters['dateformat'] = dateformat | t.env.filters['dateformat'] = dateformat | ||||
| html = t.render(source, {}).strip() | html = t.render(source, {}).strip() | ||||
| assert html == u'<h3 id="heading_3">Heading 3</h3>' | |||||
| assert html == u'<h3 id="heading-3">Heading 3</h3>' | |||||
| def test_line_statements_with_config(): | def test_line_statements_with_config(): | ||||
| source = """ | source = """ | ||||
| @@ -315,7 +292,7 @@ def test_line_statements_with_config(): | |||||
| t.configure(s) | t.configure(s) | ||||
| t.env.filters['dateformat'] = dateformat | t.env.filters['dateformat'] = dateformat | ||||
| html = t.render(source, {}).strip() | html = t.render(source, {}).strip() | ||||
| assert html == u'<h3 id="heading_3">Heading 3</h3>' | |||||
| assert html == u'<h3 id="heading-3">Heading 3</h3>' | |||||
| TEST_SITE = File(__file__).parent.child_folder('_test') | TEST_SITE = File(__file__).parent.child_folder('_test') | ||||
| @@ -378,7 +355,6 @@ class TestJinjaTemplate(object): | |||||
| def test_line_statements_with_blocks(self): | def test_line_statements_with_blocks(self): | ||||
| site = Site(TEST_SITE) | site = Site(TEST_SITE) | ||||
| JINJA2.copy_contents_to(site.content.source) | JINJA2.copy_contents_to(site.content.source) | ||||
| inc = File(TEST_SITE.child('content/inc.md')) | |||||
| text = """ | text = """ | ||||
| {% extends 'index.html' %} | {% extends 'index.html' %} | ||||
| $$$ block body | $$$ block body | ||||
| @@ -3,4 +3,4 @@ | |||||
| Handles hyde version | Handles hyde version | ||||
| TODO: Use fabric like versioning scheme | TODO: Use fabric like versioning scheme | ||||
| """ | """ | ||||
| __version__ = '0.8.5a15' | |||||
| __version__ = '0.8.5a16' | |||||
| @@ -1,8 +1,7 @@ | |||||
| argparse | |||||
| commando | |||||
| PyYAML | |||||
| Markdown | |||||
| MarkupSafe | |||||
| smartypants | |||||
| -e git://github.com/hyde/typogrify.git#egg=typogrify | |||||
| Jinja2 | |||||
| commando==0.3.2a | |||||
| PyYAML==3.10 | |||||
| Markdown==2.3.1 | |||||
| MarkupSafe==0.15 | |||||
| Pygments==1.6 | |||||
| typogrify==2.0.0 | |||||
| Jinja2==2.6 | |||||
| @@ -114,21 +114,18 @@ setup(name=PROJECT, | |||||
| author_email='lakshmi.vyas@gmail.com', | author_email='lakshmi.vyas@gmail.com', | ||||
| url='http://hyde.github.com', | url='http://hyde.github.com', | ||||
| packages=find_packages(), | packages=find_packages(), | ||||
| dependency_links=[ | |||||
| "https://github.com/hyde/typogrify/tarball/hyde-setup#egg=typogrify-hyde" | |||||
| ], | |||||
| requires=['python (>= 2.7)'], | |||||
| install_requires=( | install_requires=( | ||||
| 'argparse', | |||||
| 'commando', | |||||
| 'jinja2', | |||||
| 'pyYAML', | |||||
| 'markdown', | |||||
| 'smartypants', | |||||
| 'pygments', | |||||
| 'typogrify-hyde' | |||||
| 'commando==0.3.2a', | |||||
| 'PyYAML==3.10', | |||||
| 'Markdown==2.3.1', | |||||
| 'MarkupSafe==0.15', | |||||
| 'Pygments==1.6', | |||||
| 'typogrify==2.0.0', | |||||
| 'Jinja2==2.6' | |||||
| ), | ), | ||||
| tests_require=( | tests_require=( | ||||
| 'nose', | |||||
| 'nose', 'mock' | |||||
| ), | ), | ||||
| test_suite='nose.collector', | test_suite='nose.collector', | ||||
| include_package_data = True, | include_package_data = True, | ||||