DEV: Allow plugins to exclude seed data

This allows plugins to specify if they would like to filter out any seed
data files from running during migrations.
This commit is contained in:
Blake Erickson
2020-06-15 15:28:07 -06:00
parent a2f80670e1
commit a2713578dd
3 changed files with 19 additions and 1 deletions

View File

@ -78,6 +78,10 @@ class Plugin::Instance
@seed_data ||= HashWithIndifferentAccess.new({})
end
def seed_fu_filter(filter = nil)
@seed_fu_filter = filter
end
def self.find_all(parent_path)
[].tap { |plugins|
# also follows symlinks - http://stackoverflow.com/q/357754
@ -415,6 +419,10 @@ class Plugin::Instance
SeedFu.fixture_paths.concat(paths)
end
def register_seedfu_filter(filter = nil)
DiscoursePluginRegistry.register_seedfu_filter(filter)
end
def listen_for(event_name)
return unless self.respond_to?(event_name)
DiscourseEvent.on(event_name, &self.method(event_name))