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 rake task to setup DB layer for non-rails deployments #62

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wiggly
Copy link

@wiggly wiggly commented Feb 13, 2017

Add a new rake task to set up db layers for non-rails setups and update README to provide at least one example of this.

@@ -25,7 +29,7 @@ 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}."
task environment => ['db:seed:common'] + environment_dependencies
task environment => ['db:seed:setup', 'db:seed:common'] + environment_dependencies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -15,7 +19,7 @@ namespace :db do
end

desc "Load the seed data from db/seeds.rb and db/seeds/#{Seedbank.matcher}."
task 'common' => common_dependencies
task 'common' => ['db:seed:setup'] + common_dependencies

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -134,7 +134,7 @@ def setup
it 'is dependent on the seeds in the environment directory' do
prerequisite_seeds = Pathname.glob(environment_directory.join(Seedbank.matcher), Seedbank.nesting).sort.map do |seed_file|
['db', 'seed', environment, File.basename(seed_file, '.seeds.rb')].join(':')
end.unshift('db:seed:common')
end.unshift('db:seed:common').unshift('db:seed:setup')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -68,7 +68,7 @@ def setup
it 'is dependent on only the common seeds' do
prerequisite_seeds = self.class.glob_dummy_seeds.sort.map do |seed_file|
['db', 'seed', File.basename(seed_file, '.seeds.rb')].join(':')
end
end.unshift('db:seed:setup')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@@ -48,7 +48,7 @@ def self.glob_dummy_seeds
it 'is dependent on the common seeds and db:seed:original' do
prerequisite_seeds = self.class.glob_dummy_seeds.sort.map do |seed_file|
['db', 'seed', File.basename(seed_file, '.seeds.rb')].join(':')
end.unshift('db:seed:original')
end.unshift('db:seed:original').unshift('db:seed:setup')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@james2m
Copy link
Owner

james2m commented Mar 9, 2017

@wiggly Thanks for this. I get the idea, I'd been thinking about dropping in an orm_adapters folder and requiring those prior to loading seeds.rake. There are currently some active_record environment dependencies in seeds.rake, I'd like to pull them out and keep seeds.rake clean.

If you were to structure this PR in that way, I could do the same for Rails do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants