Skip to content
Permalink
Browse files
Merge pull request #1680 from getnikola/dependency-injection
Dependency injection
  • Loading branch information
ralsina committed May 4, 2015
2 parents a3e27f7 + 3717534 commit e427fc049f6ae89bdaa5c10483a4f70a67b8da9f
Showing with 9 additions and 0 deletions.
  1. +1 −0 CHANGES.txt
  2. +4 −0 nikola/nikola.py
  3. +4 −0 nikola/plugin_categories.py
@@ -4,6 +4,7 @@ New in master
Features
--------

* Plugins can manipulate task dependencies (Issue #1679)
* LINK_CHECK_WHITELIST now works with output relative and full fs paths
* Four new filters: html_tidy_nowrap, html_tidy_wrap, html_tidy_wrap_attr,
and html_tidy_mini for prettification and minification. Requires tidy5.
@@ -286,6 +286,7 @@ def __init__(self, **config):
self.quiet = config.pop('__quiet__', False)
self.configuration_filename = config.pop('__configuration_filename__', False)
self.configured = bool(config)
self.injected_deps = defaultdict(list)

self.rst_transforms = []
self.template_hooks = {
@@ -1319,6 +1320,9 @@ def flatten(task):
for task in flatten(pluginInfo.plugin_object.gen_tasks()):
assert 'basename' in task
task = self.clean_task_paths(task)
if 'task_dep' not in task:
task['task_dep'] = []
task['task_dep'].extend(self.injected_deps[task['basename']])
yield task
for multi in self.plugin_manager.getPluginsOfCategory("TaskMultiplier"):
flag = False
@@ -75,6 +75,10 @@ def inject_templates(self):
# so let’s just ignore it and be done with it.
pass

def inject_dependency(self, target, dependency):
"""Add 'dependency' to the target task's task_deps"""
self.site.injected_deps[target].append(dependency)


class Command(BasePlugin, DoitCommand):
"""These plugins are exposed via the command line.

0 comments on commit e427fc0

Please sign in to comment.