-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18806 from Fryguy/product_feature_seed_plugins
Make MiqProductFeature seeding pluggable
- Loading branch information
Showing
6 changed files
with
147 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class MiqProductFeature < ApplicationRecord | ||
module Seeding | ||
extend ActiveSupport::Concern | ||
|
||
RELATIVE_FIXTURE_PATH = "db/fixtures/miq_product_features".freeze | ||
FIXTURE_PATH = Rails.root.join(RELATIVE_FIXTURE_PATH).freeze | ||
|
||
module ClassMethods | ||
def seed_files | ||
return seed_root_filename, seed_core_files + seed_plugin_files | ||
end | ||
|
||
private | ||
|
||
def seed_root_filename | ||
"#{FIXTURE_PATH}.yml" | ||
end | ||
|
||
def seed_core_files | ||
Dir.glob("#{FIXTURE_PATH}/*.y{,a}ml").sort | ||
end | ||
|
||
def seed_plugin_files | ||
Vmdb::Plugins.flat_map do |plugin| | ||
Dir.glob("#{plugin.root.join(RELATIVE_FIXTURE_PATH)}{.yml,.yaml,/*.yml,/*.yaml}").sort | ||
end | ||
end | ||
end | ||
end | ||
end |
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
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