Skip to content

Commit

Permalink
Add skip-seeds arg to Refinery::CmsGenerator
Browse files Browse the repository at this point in the history
  • Loading branch information
bricesanchez committed Mar 9, 2018
1 parent 88de8e2 commit c04b169
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion core/lib/generators/refinery/cms/cms_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class CmsGenerator < Rails::Generators::Base
:desc => "Skip over any database creation, migration or seeding."
class_option :skip_migrations, :type => :boolean, :default => false, :aliases => nil, :group => :runtime,
:desc => "Skip over installing or running migrations."
class_option :skip_seeds, :type => :boolean, :default => false, :aliases => nil, :group => :runtime,
:desc => "Skip over seeding."

def generate
start_pretending?
Expand Down Expand Up @@ -245,7 +247,7 @@ def prepare_database!
command = %w[railties:install:migrations]
unless self.options[:skip_db]
command |= %w[db:create db:migrate]
command |= %w[db:seed] unless self.options[:skip_migrations]
command |= %w[db:seed] unless self.options[:skip_seeds]
end
rake command.join(' ')
end
Expand Down Expand Up @@ -273,6 +275,7 @@ def run_additional_generators!
generator_args = []
generator_args << '--quiet' if self.options[:quiet]
generator_args << '--skip-migrations' if self.options[:skip_migrations]
generator_args << '--skip-seeds' if self.options[:skip_seeds] && !self.options[:skip_migrations]
Refinery::CoreGenerator.start generator_args
Refinery::Authentication::DeviseGenerator.start generator_args if defined?(Refinery::Authentication::DeviseGenerator)
Refinery::Dragonfly::DragonflyGenerator.start generator_args if defined?(Refinery::Dragonfly::DragonflyGenerator)
Expand Down
2 changes: 1 addition & 1 deletion core/lib/generators/refinery/dummy/dummy_generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def generate_test_dummy
opts[:skip_action_cable] = true
opts[:skip_action_mailer] = true
opts[:skip_keeps] = true
opts[:skip_migrations] = true
opts[:skip_seeds] = true
opts[:template] = refinery_path.join("templates", "refinery", "edge.rb").to_s

invoke Rails::Generators::AppGenerator,
Expand Down
2 changes: 1 addition & 1 deletion testing/lib/refinery/tasks/testing.rake
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace :refinery do

Refinery::DummyGenerator.start %W[--quiet --database=#{ENV['DB'].presence || 'sqlite3'}]

Refinery::CmsGenerator.start %w[--quiet --fresh-installation]
Refinery::CmsGenerator.start %w[--quiet --fresh-installation --skip-seeds]

Dir.chdir dummy_app_path
end
Expand Down

0 comments on commit c04b169

Please sign in to comment.