-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make Dispatcher have all plugins by default
This used to be the behavior, and then b5499c7 changed this, breaking some plugins (some of which subsequently implemented workarounds). This patch restores the behavior, so that if a Dispatcher is constructed without explicitly passing in plugins, it has access to all plugins. This change seems safe, in that it's unlikely that any plugins were relying on the behavior between b5499c7 and this patch, where a Dispatcher without an explicit plugin list behaved as if there were no plugins---because such a Dispatcher is not very useful!
- Loading branch information
1 parent
6489f28
commit def0568
Showing
4 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# https://github.com/anishathalye/dotbot/issues/339, https://github.com/anishathalye/dotbot/pull/332 | ||
# if plugins instantiate a Dispatcher without explicitly passing in plugins, | ||
# the Dispatcher should have access to all plugins (matching context.plugins()) | ||
|
||
import dotbot | ||
from dotbot.dispatcher import Dispatcher | ||
|
||
|
||
class Dispatch(dotbot.Plugin): | ||
def can_handle(self, directive): | ||
return directive == "dispatch" | ||
|
||
def handle(self, directive, data): | ||
dispatcher = Dispatcher( | ||
base_directory=self._context.base_directory(), | ||
options=self._context.options(), | ||
) | ||
return dispatcher.dispatch(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters