Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add BasePlugin.register_auto_watched_folder() #3494

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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