Skip to content
Browse files

updated: variable, folder, and file names

var names:
__version__ -> VERSION
LAYOUT_DIR -> ASSET_DIR
CONTENT_DATETIME_FORMAT -> DATETIME_FORMAT

folder names:
data -> templates
- in project:
  layout -> assets
  content -> contents

file names:
gen.py -> generator.py
test_gen.py -> test_generator.py
  • Loading branch information...
1 parent 60a71b9 commit abb95dabf50e6c3e91bfc121b14dd768f6cf82b6 @bow committed
Showing with 61 additions and 61 deletions.
  1. +1 −1 .gitignore
  2. +2 −2 setup.py
  3. +1 −1 volt/__init__.py
  4. +1 −1 volt/config/__init__.py
  5. +5 −5 volt/config/default.py
  6. +1 −1 volt/engine/builtins/__init__.py
  7. +2 −2 volt/engine/builtins/blog.py
  8. +2 −2 volt/engine/builtins/plain.py
  9. +9 −9 volt/{gen.py → generator.py}
  10. +5 −5 volt/main.py
  11. +5 −5 volt/server.py
  12. 0 volt/{data → templates}/__init__.py
  13. 0 volt/{data/demo/layout → templates/demo/assets}/css/main.css
  14. 0 volt/{data/demo/layout → templates/demo/assets}/css/main.min.css
  15. 0 volt/{data/demo/layout → templates/demo/assets}/css/reset.css
  16. 0 volt/{data/demo/layout → templates/demo/assets}/js/custom.js
  17. 0 volt/{data/demo/layout → templates/demo/assets}/robots.txt
  18. +2 −2 volt/{data/demo/content → templates/demo/contents}/blog/01_hello-world.md
  19. 0 volt/{data/demo/content → templates/demo/contents}/blog/02_getting-your-hands-wet.md
  20. 0 volt/{data/demo/content → templates/demo/contents}/blog/03_top-cat.md
  21. 0 volt/{data/demo/content → templates/demo/contents}/blog/04_hong-kong.md
  22. 0 volt/{data/demo/content → templates/demo/contents}/plain/about-volt.md
  23. 0 volt/{data → templates}/demo/templates/base.html
  24. 0 volt/{data → templates}/demo/templates/blog_pagination.html
  25. 0 volt/{data → templates}/demo/templates/blog_unit.html
  26. 0 volt/{data → templates}/demo/templates/index.html
  27. 0 volt/{data → templates}/demo/templates/plain_unit.html
  28. 0 volt/{data → templates}/demo/voltconf.py
  29. 0 volt/{data → templates}/init/templates/base.html
  30. 0 volt/{data → templates}/init/templates/blog_pagination.html
  31. 0 volt/{data → templates}/init/templates/blog_post.html
  32. 0 volt/{data → templates}/init/templates/index.html
  33. 0 volt/{data → templates}/init/templates/page.html
  34. +1 −1 volt/{data → templates}/init/voltconf.py
  35. +1 −1 volt/test/__init__.py
  36. +1 −1 volt/test/fixtures/install_dir/default.py
  37. +2 −2 volt/test/test_config.py
  38. +1 −1 volt/test/test_engine_builtins.py
  39. +1 −1 volt/test/test_engine_core.py
  40. +18 −18 volt/test/{test_gen.py → test_generator.py}
View
2 .gitignore
@@ -3,5 +3,5 @@ fabfile.py
distribute-*
distribute_setup25.py
build/
-volt/data/sandbox/
+volt/templates/sandbox/
ROADMAP
View
4 setup.py
@@ -6,14 +6,14 @@
import sys
from setuptools import setup, find_packages
-from volt import __version__
+from volt import VERSION
install_requires = [
"Jinja2>=2.6",
"Markdown>=2.1.1",
]
-version = __version__
+version = VERSION
long_description = open("README.rst").read()
# handle python 3
View
2 volt/__init__.py
@@ -1 +1 @@
-__version__ = '0.0.2'
+VERSION = '0.0.2'
View
2 volt/config/__init__.py
@@ -176,7 +176,7 @@ class Config(dict):
PROTECTED = ()
REQUIRED = ()
FIELDS_AS_DATETIME = ()
- CONTENT_DATETIME_FORMAT = ''
+ DATETIME_FORMAT = ''
FIELDS_AS_LIST = ()
LIST_SEP = ()
GLOBAL_FIELDS = {}
View
10 volt/config/default.py
@@ -21,11 +21,11 @@
# Used to determine project root
USER_CONF = 'voltconf.py',
- # Directory paths for content files, templates, and generated site
- # relative to a project root
- CONTENT_DIR = 'content',
+ # Directory paths for content files, templates, assets,
+ # and generated site relative to a project root
+ CONTENT_DIR = 'contents',
TEMPLATE_DIR = 'templates',
- LAYOUT_DIR = 'layout',
+ ASSET_DIR = 'assets',
SITE_DIR = 'site',
)
@@ -74,7 +74,7 @@
LOG_LEVEL = 30,
# Ignore patterns
- # Filenames that match this pattern will not be copied from layout directory
+ # Filenames that match this pattern will not be copied from asset directory
# to site directory
IGNORE_PATTERN = '',
)
View
2 volt/engine/builtins/__init__.py
@@ -94,7 +94,7 @@ def parse_header(self, header_string):
elif field in self.config.FIELDS_AS_DATETIME:
value = self.as_datetime(value, \
- self.config.CONTENT_DATETIME_FORMAT)
+ self.config.DATETIME_FORMAT)
setattr(self, field.lower(), value)
View
4 volt/engine/builtins/blog.py
@@ -47,7 +47,7 @@ class BlogEngine(TextEngine):
# Date and time format used in blog content headers
# Used for parsing the headers
# Default is e.g. '2004-03-13 22:10'
- CONTENT_DATETIME_FORMAT = '%Y/%m/%d %H:%M',
+ DATETIME_FORMAT = '%Y/%m/%d %H:%M',
# Dictionary containing values to be globally set for all posts
GLOBAL_FIELDS = {},
@@ -91,7 +91,7 @@ class BlogEngine(TextEngine):
REQUIRED = ('title', 'time', ),
# Fields that would be transformed from string into datetime objects using
- # CONTENT_DATETIME_FORMAT as the pattern
+ # DATETIME_FORMAT as the pattern
FIELDS_AS_DATETIME = ('time', ),
# Fields that would be transformed from string into list objects using
View
4 volt/engine/builtins/plain.py
@@ -35,7 +35,7 @@ class PlainEngine(TextEngine):
# Date and time format used in plain page content headers
# Used for parsing the headers
# Default is e.g. '2004-03-13 22:10'
- CONTENT_DATETIME_FORMAT = '%Y/%m/%d %H:%M',
+ DATETIME_FORMAT = '%Y/%m/%d %H:%M',
# Directory path for storing plain page content
# relative to the default Volt content directory
@@ -58,7 +58,7 @@ class PlainEngine(TextEngine):
PROTECTED = ('id', 'content', ),
# Fields that would be transformed from string into datetime objects using
- # CONTENT_DATETIME_FORMAT as the pattern
+ # DATETIME_FORMAT as the pattern
FIELDS_AS_DATETIME = ('time', ),
# Fields that would be transformed from string into list objects using
View
18 volt/gen.py → volt/generator.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
---------
-volt.gen
---------
+--------------
+volt.generator
+--------------
-Volt site generator.
+Volt main site generator.
:copyright: (c) 2012 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
@@ -20,7 +20,7 @@
from inspect import isclass
from time import time
-from volt import __version__
+from volt import VERSION
from volt.config import CONFIG, SessionConfig
from volt.engine.core import Engine
from volt.plugin.core import Plugin
@@ -40,7 +40,7 @@ def main(self):
This method consists of three distinct steps that results in the final
site generation:
- 1. Output directory preparation: contents from the 'layout'
+ 1. Output directory preparation: contents from the 'asset'
directory are copied into a new 'site' directory. If a 'site'
directory exists prior to the copying, it will be removed.
@@ -94,13 +94,13 @@ def get_processor_class(self, processor_name, processor_type, \
return obj
def prepare_output(self):
- """Copies the layout directory contents to site directory."""
+ """Copies the asset directory contents to site directory."""
message = "Preparing 'site' directory"
console(message)
self.logger.debug(message)
if os.path.exists(CONFIG.VOLT.SITE_DIR):
shutil.rmtree(CONFIG.VOLT.SITE_DIR)
- shutil.copytree(CONFIG.VOLT.LAYOUT_DIR, CONFIG.VOLT.SITE_DIR, \
+ shutil.copytree(CONFIG.VOLT.ASSET_DIR, CONFIG.VOLT.SITE_DIR, \
ignore=shutil.ignore_patterns(CONFIG.SITE.IGNORE_PATTERN))
def run_engines(self):
@@ -202,7 +202,7 @@ def run():
if CONFIG.SITE.ENGINES:
sys.stdout.write("\n")
- message = "Volt %s Static Site Generator" % __version__
+ message = "Volt %s Static Site Generator" % VERSION
console(message, is_bright=True)
logger.debug(message)
View
10 volt/main.py
@@ -18,7 +18,7 @@
from functools import partial
from datetime import datetime
-from volt import __version__, gen, server
+from volt import VERSION, generator, server
from volt.config import CONFIG
from volt.exceptions import ConfigNotFoundError
from volt.utils import console, LoggableMixin
@@ -66,7 +66,7 @@ def build_logger(self):
logger.addHandler(logfile)
with open('volt.log', 'w') as log:
- log.write("#Volt %s Log\n" % __version__)
+ log.write("#Volt %s Log\n" % VERSION)
log.write("#Date: %s\n" % datetime.now().strftime("%Y-%m-%d"))
log.write("#Fields: time, log-level, caller, log-message\n")
@@ -124,7 +124,7 @@ def run_init(self, cmd_name='init'):
sys.exit(1)
# get volt installation directory and demo dir
- target_path = os.path.join(os.path.dirname(__file__), "data", cmd_name)
+ target_path = os.path.join(os.path.dirname(__file__), 'templates', cmd_name)
# we only need the first layer to do the copying
parent_dir, child_dirs, top_files = os.walk(target_path).next()
@@ -150,7 +150,7 @@ def run_demo(self):
def run_gen(self):
"""Generates the static site."""
os.chdir(CONFIG.VOLT.ROOT_DIR)
- gen.run()
+ generator.run()
def run_serve(self):
"""Generates the static site, and if successful, runs the Volt server."""
@@ -159,7 +159,7 @@ def run_serve(self):
def run_version(self):
"""Shows version number."""
- console("Volt %s\n" % __version__)
+ console("Volt %s\n" % VERSION)
def main(cli_arglist=None):
View
10 volt/server.py
@@ -34,8 +34,8 @@
from SimpleHTTPServer import SimpleHTTPRequestHandler
from SocketServer import ThreadingTCPServer
-from volt import __version__
-from volt import gen
+from volt import VERSION
+from volt import generator
from volt.config import CONFIG
from volt.utils import console, LoggableMixin
@@ -91,7 +91,7 @@ def process_request(self, request, client_address):
# not sure I understand why it needs to load first
# but hey it works (possible bug later on?)
CONFIG._load()
- gen.run()
+ generator.run()
self.logger.debug('done: regenerating site')
ThreadingTCPServer.process_request(self, request, client_address)
@@ -135,7 +135,7 @@ class VoltHTTPRequestHandler(SimpleHTTPRequestHandler, LoggableMixin):
"""
- server_version = 'VoltHTTPServer/' + __version__
+ server_version = 'VoltHTTPServer/' + VERSION
def log_error(self, format, *args):
# overwritten to unclutter log message.
@@ -214,7 +214,7 @@ def run():
if run_address == '127.0.0.1':
run_address = 'localhost'
- message = "Volt %s Development Server" % __version__
+ message = "Volt %s Development Server" % VERSION
console(message, is_bright=True)
logger.debug(message)
View
0 volt/data/__init__.py → volt/templates/__init__.py
File renamed without changes.
View
0 volt/data/demo/layout/css/main.css → volt/templates/demo/assets/css/main.css
File renamed without changes.
View
0 volt/data/demo/layout/css/main.min.css → volt/templates/demo/assets/css/main.min.css
File renamed without changes.
View
0 volt/data/demo/layout/css/reset.css → volt/templates/demo/assets/css/reset.css
File renamed without changes.
View
0 volt/data/demo/layout/js/custom.js → volt/templates/demo/assets/js/custom.js
File renamed without changes.
View
0 volt/data/demo/layout/robots.txt → volt/templates/demo/assets/robots.txt
File renamed without changes.
View
4 .../data/demo/content/blog/01_hello-world.md → ...ates/demo/contents/blog/01_hello-world.md
@@ -13,9 +13,9 @@ resulting website anywhere you want.
This website is a small example of what you can do with Volt. Everything
needed to generate this site was taken from three source directories:
-**content**, containing the actual contents of the site;
+**contents**, containing the actual contents of the site;
**templates**, containing the HTML template files, and
-**layout**, for all other files such as css or image files. All
+**assets**, for all other files such as css or image files. All
settings that determines the behaviors and looks of the generated site are
configurable via **voltconf.py**, Volt's central configuration file.
View
0 ...content/blog/02_getting-your-hands-wet.md → ...ontents/blog/02_getting-your-hands-wet.md
File renamed without changes.
View
0 volt/data/demo/content/blog/03_top-cat.md → ...emplates/demo/contents/blog/03_top-cat.md
File renamed without changes.
View
0 volt/data/demo/content/blog/04_hong-kong.md → ...plates/demo/contents/blog/04_hong-kong.md
File renamed without changes.
View
0 volt/data/demo/content/plain/about-volt.md → ...mplates/demo/contents/plain/about-volt.md
File renamed without changes.
View
0 volt/data/demo/templates/base.html → volt/templates/demo/templates/base.html
File renamed without changes.
View
0 .../data/demo/templates/blog_pagination.html → ...lates/demo/templates/blog_pagination.html
File renamed without changes.
View
0 volt/data/demo/templates/blog_unit.html → volt/templates/demo/templates/blog_unit.html
File renamed without changes.
View
0 volt/data/demo/templates/index.html → volt/templates/demo/templates/index.html
File renamed without changes.
View
0 volt/data/demo/templates/plain_unit.html → .../templates/demo/templates/plain_unit.html
File renamed without changes.
View
0 volt/data/demo/voltconf.py → volt/templates/demo/voltconf.py
File renamed without changes.
View
0 volt/data/init/templates/base.html → volt/templates/init/templates/base.html
File renamed without changes.
View
0 .../data/init/templates/blog_pagination.html → ...lates/init/templates/blog_pagination.html
File renamed without changes.
View
0 volt/data/init/templates/blog_post.html → volt/templates/init/templates/blog_post.html
File renamed without changes.
View
0 volt/data/init/templates/index.html → volt/templates/init/templates/index.html
File renamed without changes.
View
0 volt/data/init/templates/page.html → volt/templates/init/templates/page.html
File renamed without changes.
View
2 volt/data/init/voltconf.py → volt/templates/init/voltconf.py
@@ -42,7 +42,7 @@
INDEX_HTML_ONLY = True,
# Ignore patterns
- # Filenames that match this pattern will not be copied from layout directory
+ # Filenames that match this pattern will not be copied from asset directory
# to site directory
IGNORE_PATTERN = '',
)
View
2 volt/test/__init__.py
@@ -21,7 +21,7 @@ def make_sessionconfig_mock():
VOLT = {'USER_CONF': os.path.join(USER_DIR, 'voltconf.py'),
'ROOT_DIR': USER_DIR,
- 'CONTENT_DIR': os.path.join(USER_DIR, 'content'),
+ 'CONTENT_DIR': os.path.join(USER_DIR, 'contents'),
'TEMPLATE_DIR': os.path.join(USER_DIR, 'templates'),
'SITE_DIR': os.path.join(USER_DIR, 'site'),
}
View
2 volt/test/fixtures/install_dir/default.py
@@ -2,7 +2,7 @@
VOLT = Config(
USER_CONF = 'voltconf.py',
- CONTENT_DIR = 'content',
+ CONTENT_DIR = 'contents',
TEMPLATE_DIR = 'templates',
)
View
4 volt/test/test_config.py
@@ -38,7 +38,7 @@ def test_load_consolidation(self):
def test_load_dir_resolution(self):
# default.py dir resolution
self.assertEqual(self.CONFIG.VOLT.CONTENT_DIR, os.path.join(USER_DIR, \
- 'content'))
+ 'contents'))
# voltconf.py dir resolution
self.assertEqual(self.CONFIG.VOLT.TEMPLATE_DIR, os.path.join(USER_DIR, \
'mytemplates'))
@@ -72,7 +72,7 @@ def test_get_root_dir_current(self):
self.assertEqual(self.CONFIG.get_root_dir(start_dir), USER_DIR)
def test_get_root_dir_child(self):
- start_dir = os.path.join(USER_DIR, "content", "foo", "bar", "baz")
+ start_dir = os.path.join(USER_DIR, "contents", "foo", "bar", "baz")
self.assertEqual(self.CONFIG.get_root_dir(start_dir), USER_DIR)
def test_get_root_dir_error(self):
View
2 volt/test/test_engine_builtins.py
@@ -115,7 +115,7 @@ def test_parse_header_as_list(self):
self.assertEqual(self.unit.tags, expected)
def test_parse_header_as_datetime(self):
- self.unit.config.CONTENT_DATETIME_FORMAT = '%Y/%m/%d %H:%M'
+ self.unit.config.DATETIME_FORMAT = '%Y/%m/%d %H:%M'
self.unit.config.FIELDS_AS_DATETIME = ('time', )
header_string = "time: 2004/03/13 22:10"
self.unit.parse_header(header_string)
View
2 volt/test/test_engine_core.py
@@ -122,7 +122,7 @@ def test_prime_consolidation(self):
self.assertEqual(self.engine.config.BAR, 'engine bar in user')
self.assertEqual(self.engine.config.QUX, 'engine qux in default')
self.assertEqual(self.engine.config.CONTENT_DIR, os.path.join(\
- USER_DIR, 'content', 'engine_test'))
+ USER_DIR, 'contents', 'engine_test'))
self.assertEqual(self.engine.config.UNIT_TEMPLATE, os.path.join(\
USER_DIR, 'templates', 'template.html'))
View
36 volt/test/test_gen.py → volt/test/test_generator.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
"""
-------------------
-volt.test.test_gen
-------------------
+------------------------
+volt.test.test_generator
+------------------------
-Tests for volt.gen.
+Tests for volt.generator.
:copyright: (c) 2012 Wibowo Arindrarto <bow@bow.web.id>
:license: BSD
@@ -17,7 +17,7 @@
from mock import patch
from volt.engine.core import Engine
-from volt.gen import Generator
+from volt.generator import Generator
from volt.plugin.core import Plugin
from volt.test import INSTALL_DIR, USER_DIR, make_sessionconfig_mock
@@ -25,56 +25,56 @@
SessionConfig_mock = make_sessionconfig_mock()
-@patch('volt.gen.CONFIG.VOLT.ROOT_DIR', USER_DIR)
-@patch('volt.gen.CONFIG', SessionConfig_mock)
-class GenCases(unittest.TestCase):
+@patch('volt.generator.CONFIG.VOLT.ROOT_DIR', USER_DIR)
+@patch('volt.generator.CONFIG', SessionConfig_mock)
+class GeneratorCases(unittest.TestCase):
def setUp(self):
- self.gen = Generator()
+ self.generator = Generator()
- @patch('volt.gen.path_import')
+ @patch('volt.generator.path_import')
def test_get_processor_class_unknown_type(self, path_import_mock):
builtin_engine_name = 'volt.test.fixtures.install_dir.engine.builtins.in_install'
path_import_mock.return_value = __import__(builtin_engine_name)
- self.assertRaises(AssertionError, self.gen.get_processor_class, \
+ self.assertRaises(AssertionError, self.generator.get_processor_class, \
'in_install', 'foo', INSTALL_DIR)
def test_get_processor_class_unknown_name(self):
- self.assertRaises(ImportError, self.gen.get_processor_class, \
+ self.assertRaises(ImportError, self.generator.get_processor_class, \
'foo', 'engines', INSTALL_DIR)
def test_get_processor_class_builtin_engine(self):
- returned = self.gen.get_processor_class('in_install', 'engines', \
+ returned = self.generator.get_processor_class('in_install', 'engines', \
INSTALL_DIR)
self.assertEqual(returned.__name__, 'TestBuiltinEngine')
self.assertTrue(issubclass(returned, Engine))
def test_get_processor_class_user_engine(self):
- returned = self.gen.get_processor_class('in_user', 'engines', \
+ returned = self.generator.get_processor_class('in_user', 'engines', \
INSTALL_DIR)
self.assertEqual(returned.__name__, 'TestUserEngine')
self.assertTrue(issubclass(returned, Engine))
def test_get_processor_class_both_engine(self):
- returned = self.gen.get_processor_class('in_both', 'engines', \
+ returned = self.generator.get_processor_class('in_both', 'engines', \
INSTALL_DIR)
self.assertEqual(returned.__name__, 'TestUserEngine')
self.assertTrue(issubclass(returned, Engine))
def test_get_processor_class_builtin_plugin(self):
- returned = self.gen.get_processor_class('in_install', 'plugins', \
+ returned = self.generator.get_processor_class('in_install', 'plugins', \
INSTALL_DIR)
self.assertEqual(returned.__name__, 'TestBuiltinPlugin')
self.assertTrue(issubclass(returned, Plugin))
def test_get_processor_class_user_plugin(self):
- returned = self.gen.get_processor_class('in_user', 'plugins', \
+ returned = self.generator.get_processor_class('in_user', 'plugins', \
INSTALL_DIR)
self.assertEqual(returned.__name__, 'TestUserPlugin')
self.assertTrue(issubclass(returned, Plugin))
def test_get_processor_class_both_plugin(self):
- returned = self.gen.get_processor_class('in_both', 'plugins', \
+ returned = self.generator.get_processor_class('in_both', 'plugins', \
INSTALL_DIR)
self.assertEqual(returned.__name__, 'TestUserPlugin')
self.assertTrue(issubclass(returned, Plugin))

0 comments on commit abb95da

Please sign in to comment.
Something went wrong with that request. Please try again.