Skip to content

Commit

Permalink
Merge pull request #3494 from matthew16550/register_auto_watched_folder
Browse files Browse the repository at this point in the history
Add BasePlugin.register_auto_watched_folder()
  • Loading branch information
Kwpolska committed Jan 2, 2021
2 parents 59a0cdc + 0982be1 commit 578e535
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Expand Up @@ -6,6 +6,7 @@ Features

* Provide the full ``GLOBAL_CONTEXT`` to the post list shortcode plugin
(Issue #3481)
* Add ``BasePlugin.register_auto_watched_folder()``

New in v8.1.2
=============
Expand Down
1 change: 1 addition & 0 deletions nikola/nikola.py
Expand Up @@ -414,6 +414,7 @@ def __init__(self, **config):
self.injected_deps = defaultdict(list)
self.shortcode_registry = {}
self.metadata_extractors_by = default_metadata_extractors_by()
self.registered_auto_watched_folders = set()

self.rst_transforms = []
self.template_hooks = {
Expand Down
3 changes: 3 additions & 0 deletions nikola/plugin_categories.py
Expand Up @@ -98,6 +98,9 @@ def get_deps(self, filename):
"""Find the dependencies for a file."""
return []

def register_auto_watched_folder(self, folder: str) -> None:
self.site.registered_auto_watched_folders.add(folder)


class PostScanner(BasePlugin):
"""The scan method of these plugins is called by Nikola.scan_posts."""
Expand Down
1 change: 1 addition & 0 deletions nikola/plugins/command/auto/__init__.py
Expand Up @@ -184,6 +184,7 @@ def _execute(self, options, args):
watched.add(item)
for item in self.site._plugin_places:
watched.add(item)
watched |= self.site.registered_auto_watched_folders
# Nikola itself (useful for developers)
watched.add(pkg_resources.resource_filename('nikola', ''))

Expand Down

0 comments on commit 578e535

Please sign in to comment.