-
Notifications
You must be signed in to change notification settings - Fork 91
Allow multi-level directories #86
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
base: master
Are you sure you want to change the base?
Conversation
glob_seed_files_matching('/*/').each do |directory| | ||
environment = File.basename(directory) | ||
glob_seed_files_matching('**/*/').each do |directory| | ||
regex = Regexp.new('(?<=' + Seedbank.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.
Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
@@ -19,8 +19,10 @@ namespace :db do | |||
|
|||
# Glob through the directories under seeds_path and create a task for each adding it to the dependency list. | |||
# Then create a task for the environment | |||
glob_seed_files_matching('/*/').each do |directory| | |||
environment = File.basename(directory) | |||
glob_seed_files_matching('**/*/').each do |directory| |
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.
|
||
name = environment.split("/").select(&:present?).join(":") | ||
desc "Load the seed data from db/seeds.rb, db/seeds/#{Seedbank.matcher} and db/seeds#{environment}#{Seedbank.matcher}." | ||
task name => ['db:seed:common'] + environment_dependencies |
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.
|
||
desc "Load the seed data from db/seeds.rb, db/seeds/#{Seedbank.matcher} and db/seeds/#{environment}/#{Seedbank.matcher}." | ||
task environment => ['db:seed:common'] + environment_dependencies | ||
|
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.
Layout/TrailingWhitespace: Trailing whitespace detected.
@@ -1,4 +1,4 @@ | |||
# frozen_string_literal: true | |||
module Seedbank | |||
VERSION = '0.5.0' | |||
VERSION = '0.6.0' |
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.
Would like to not restrict directory levels to one level only.
rails db:seed:development:default:cars # Load the seed data from db/seeds/development/default/cars.seeds.rb
Possible usecase: create tenant-specific rake tasks for multi-tenancy apps