diff --git a/dotbot/dispatcher.py b/dotbot/dispatcher.py index 35b0889..f6fae9d 100644 --- a/dotbot/dispatcher.py +++ b/dotbot/dispatcher.py @@ -22,7 +22,11 @@ class Dispatcher(object): def dispatch(self, tasks): success = True for task in tasks: + for action in task: + if action == 'meta': + self._handle_metadata(task['meta']) + continue handled = False for plugin in self._plugins: if plugin.can_handle(action): @@ -42,5 +46,12 @@ class Dispatcher(object): self._plugins = [plugin(self._base_directory) for plugin in Executor.__subclasses__()] + def _handle_metadata(self, metadata): + if 'title' in metadata: + self._log.warning(metadata['title']) + + if 'description' in metadata: + self._log.info(' ' + metadata['description']) + class DispatchError(Exception): pass diff --git a/dotbot/executor/__init__.py b/dotbot/executor/__init__.py index 1762f78..1189d8c 100644 --- a/dotbot/executor/__init__.py +++ b/dotbot/executor/__init__.py @@ -1,3 +1,4 @@ from .executor import Executor from .linker import Linker from .commandrunner import CommandRunner +from .meta import Meta diff --git a/dotbot/executor/meta.py b/dotbot/executor/meta.py new file mode 100644 index 0000000..5ec79da --- /dev/null +++ b/dotbot/executor/meta.py @@ -0,0 +1,16 @@ +from . import Executor + +class Meta(Executor): + ''' + Dummy handler for metadata support + ''' + + _directive = 'meta' + + def can_handle(self, directive): + return directive == self._directive + + def handle(self, directive, data): + if directive != self._directive: + raise ValueError('Header cannot handle directive %s' % directive) + return True