-
Notifications
You must be signed in to change notification settings - Fork 92
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
[WiP] global.seeds.rb prereq file support #70
Conversation
@@ -66,7 +66,7 @@ def setup | |||
end | |||
|
|||
it 'is dependent on only the common seeds' do | |||
prerequisite_seeds = self.class.glob_dummy_seeds.sort.map do |seed_file| | |||
prerequisite_seeds = ['db:seed:global'] + self.class.glob_dummy_seeds.sort.map do |seed_file| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
task environment => ['db:seed:common'] + environment_dependencies | ||
|
||
override_dependency << "db:seed:#{environment}" if defined?(Rails) && Rails.env == environment | ||
end | ||
end | ||
|
||
# Override db:seed to run all the common and environments seeds plus the original db:seed. | ||
desc %(Load the seed data from db/seeds.rb, db/seeds/#{Seedbank.matcher} and db/seeds/ENVIRONMENT/#{Seedbank.matcher}. | ||
desc %(Load the seed data from db/global.seeds.rb, db/seeds.rb, db/seeds/#{Seedbank.matcher} and db/seeds/ENVIRONMENT/#{Seedbank.matcher}. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [140/132]
@@ -24,15 +24,15 @@ namespace :db do | |||
|
|||
environment_dependencies = seed_tasks_matching(environment, Seedbank.matcher) | |||
|
|||
desc "Load the seed data from db/seeds.rb, db/seeds/#{Seedbank.matcher} and db/seeds/#{environment}/#{Seedbank.matcher}." | |||
desc "Load the seed data from db/global.seeds.rb, db/seeds.rb, db/seeds/#{Seedbank.matcher} and db/seeds/#{environment}/#{Seedbank.matcher}." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Metrics/LineLength: Line is too long. [147/132]
def add_global_dependency(task) | ||
if global_seeds_file | ||
define_seed_task(global_seeds_file) | ||
task.enhance(['db:seed_global']) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
task.name | ||
end | ||
|
||
def original_seeds_file | ||
@_seedbank_original ||= existent(Pathname.new('../seeds.rb').expand_path(seeds_root)) | ||
end | ||
|
||
def global_seeds_file | ||
@_seedbank_global ||= existent(Pathname.new('../global.seeds.rb').expand_path(seeds_root)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming/MemoizedInstanceVariableName: Memoized variable @_seedbank_global does not match method name global_seeds_file. Use @global_seeds_file instead.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Intended to fix #68 but clearly this was much more difficult than I anticipated. Hoping you can bring it over the finish line w/ your knowledge of how this all works.