@@ -18,6 +18,16 @@ class LessCSSPlugin(CLTransformer): | |||||
def __init__(self, site): | def __init__(self, site): | ||||
super(LessCSSPlugin, self).__init__(site) | super(LessCSSPlugin, self).__init__(site) | ||||
def begin_site(self): | |||||
""" | |||||
Find all the less css files and set their relative deploy path. | |||||
""" | |||||
for resource in self.site.content.walk_resources(): | |||||
if resource.source_file.kind == 'less': | |||||
new_name = resource.source_file.name_without_extension + ".css" | |||||
target_folder = File(resource.relative_deploy_path).parent | |||||
resource.relative_deploy_path = target_folder.child(new_name) | |||||
def begin_text_resource(self, resource, text): | def begin_text_resource(self, resource, text): | ||||
""" | """ | ||||
Replace @import statements with {% include %} statements. | Replace @import statements with {% include %} statements. | ||||
@@ -70,8 +80,4 @@ class LessCSSPlugin(CLTransformer): | |||||
raise self.template.exception_class( | raise self.template.exception_class( | ||||
"Cannot process %s. Error occurred when " | "Cannot process %s. Error occurred when " | ||||
"processing [%s]" % (self.app.name, resource.source_file)) | "processing [%s]" % (self.app.name, resource.source_file)) | ||||
out = target.read_all() | |||||
new_name = resource.source_file.name_without_extension + ".css" | |||||
target_folder = File(resource.relative_path).parent | |||||
resource.relative_deploy_path = target_folder.child(new_name) | |||||
return out | |||||
return target.read_all() |
@@ -96,8 +96,8 @@ class SorterPlugin(Plugin): | |||||
return | return | ||||
for name, settings in config.sorter.__dict__.items(): | for name, settings in config.sorter.__dict__.items(): | ||||
self.logger.info("Adding sort methods for [%s]" % name) | |||||
sort_method_name = 'walk_resources_sorted_by_%s' % name | sort_method_name = 'walk_resources_sorted_by_%s' % name | ||||
self.logger.debug("Adding sort methods for [%s]" % name) | |||||
add_method(Node, sort_method_name, sort_method, settings=settings) | add_method(Node, sort_method_name, sort_method, settings=settings) | ||||
match_method_name = 'is_%s' % name | match_method_name = 'is_%s' % name | ||||
add_method(Resource, match_method_name, filter_method, settings) | add_method(Resource, match_method_name, filter_method, settings) | ||||
@@ -18,6 +18,16 @@ class StylusPlugin(CLTransformer): | |||||
def __init__(self, site): | def __init__(self, site): | ||||
super(StylusPlugin, self).__init__(site) | super(StylusPlugin, self).__init__(site) | ||||
def begin_site(self): | |||||
""" | |||||
Find all the styl files and set their relative deploy path. | |||||
""" | |||||
for resource in self.site.content.walk_resources(): | |||||
if resource.source_file.kind == 'styl': | |||||
new_name = resource.source_file.name_without_extension + ".css" | |||||
target_folder = File(resource.relative_deploy_path).parent | |||||
resource.relative_deploy_path = target_folder.child(new_name) | |||||
def begin_text_resource(self, resource, text): | def begin_text_resource(self, resource, text): | ||||
""" | """ | ||||
Replace @import statements with {% include %} statements. | Replace @import statements with {% include %} statements. | ||||
@@ -95,8 +105,4 @@ class StylusPlugin(CLTransformer): | |||||
raise self.template.exception_class( | raise self.template.exception_class( | ||||
"Cannot process %s. Error occurred when " | "Cannot process %s. Error occurred when " | ||||
"processing [%s]" % (stylus.name, resource.source_file)) | "processing [%s]" % (stylus.name, resource.source_file)) | ||||
out = target.read_all() | |||||
new_name = resource.source_file.name_without_extension + ".css" | |||||
target_folder = File(resource.relative_path).parent | |||||
resource.relative_deploy_path = target_folder.child(new_name) | |||||
return out | |||||
return target.read_all() |
@@ -95,7 +95,7 @@ class Generator(object): | |||||
""" | """ | ||||
Start Generation. Perform setup tasks and inform plugins. | Start Generation. Perform setup tasks and inform plugins. | ||||
""" | """ | ||||
logger.info("Begin Generation") | |||||
logger.debug("Begin Generation") | |||||
self.events.begin_generation() | self.events.begin_generation() | ||||
def load_site_if_needed(self): | def load_site_if_needed(self): | ||||
@@ -112,7 +112,7 @@ class Generator(object): | |||||
""" | """ | ||||
Generation complete. Inform plugins and cleanup. | Generation complete. Inform plugins and cleanup. | ||||
""" | """ | ||||
logger.info("Generation Complete") | |||||
logger.debug("Generation Complete") | |||||
self.events.generation_complete() | self.events.generation_complete() | ||||
def get_dependencies(self, resource): | def get_dependencies(self, resource): | ||||
@@ -34,7 +34,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): | |||||
and serve. | and serve. | ||||
""" | """ | ||||
self.server.request_time = datetime.now() | self.server.request_time = datetime.now() | ||||
logger.info("Processing request: [%s]" % self.path) | |||||
logger.debug("Processing request: [%s]" % self.path) | |||||
result = urlparse.urlparse(self.path) | result = urlparse.urlparse(self.path) | ||||
query = urlparse.parse_qs(result.query) | query = urlparse.parse_qs(result.query) | ||||
if 'refresh' in query or result.query=='refresh': | if 'refresh' in query or result.query=='refresh': | ||||
@@ -73,6 +73,7 @@ class HydeRequestHandler(SimpleHTTPRequestHandler): | |||||
if not res: | if not res: | ||||
logger.error("Cannot load file: [%s]" % path) | logger.error("Cannot load file: [%s]" % path) | ||||
print site.content.resource_deploy_map | |||||
return site.config.deploy_root_path.child(path) | return site.config.deploy_root_path.child(path) | ||||
else: | else: | ||||
@@ -188,7 +189,7 @@ class HydeWebServer(HTTPServer): | |||||
return self.regenerate() | return self.regenerate() | ||||
try: | try: | ||||
logger.info('Generating node [%s]' % node) | |||||
logger.debug('Serving node [%s]' % node) | |||||
self.generator.generate_node(node, incremental=True) | self.generator.generate_node(node, incremental=True) | ||||
except Exception, exception: | except Exception, exception: | ||||
logger.error( | logger.error( | ||||
@@ -206,9 +207,9 @@ class HydeWebServer(HTTPServer): | |||||
if not dest.exists: | if not dest.exists: | ||||
return self.generate_node(resource.node) | return self.generate_node(resource.node) | ||||
try: | try: | ||||
logger.info('Generating resource [%s]' % resource) | |||||
logger.debug('Serving resource [%s]' % resource) | |||||
self.generator.generate_resource(resource, incremental=True) | self.generator.generate_resource(resource, incremental=True) | ||||
except Exception, exception: | except Exception, exception: | ||||
logger.error( | logger.error( | ||||
'Error [%s] occured when generating the resource [%s]' | |||||
'Error [%s] occured when serving the resource [%s]' | |||||
% (repr(exception), resource)) | % (repr(exception), resource)) |