Permalink
Browse files

Add back --skip-turbolinks and remove --skip-gems

For the most part of cases --skip-gems option just remove one line in
the Gemfile. This is not worth for the complexity it adds.

Closes #17196
  • Loading branch information...
rafaelfranca committed Oct 27, 2014
1 parent 9244928 commit bf17c8a531bc8059d50ad731398002a3e7162a7d
View
@@ -89,13 +89,7 @@
*Rafael Mendonça França*
-* Add a generic --skip-gems options to generator
-
- This option is useful if users want to remove some gems like jbuilder,
- turbolinks, coffee-rails, etc that don't have specific options on the
- generator.
-
- rails new my_app --skip-gems turbolinks coffee-rails
+* Add a generic --skip-turbolinks options to generator.
*Rafael Mendonça França*
@@ -41,9 +41,6 @@ def self.add_shared_options_for(name)
class_option :skip_active_record, type: :boolean, aliases: '-O', default: false,
desc: 'Skip Active Record files'
- class_option :skip_gems, type: :array, default: [],
- desc: 'Skip the provided gems files'
-
class_option :skip_sprockets, type: :boolean, aliases: '-S', default: false,
desc: 'Skip Sprockets files'
@@ -65,6 +62,9 @@ def self.add_shared_options_for(name)
class_option :edge, type: :boolean, default: false,
desc: "Setup the #{name} with Gemfile pointing to Rails repository"
+ class_option :skip_turbolinks, type: :boolean, default: false,
+ desc: 'Skip turbolinks gem'
+
class_option :skip_test_unit, type: :boolean, aliases: '-T', default: false,
desc: 'Skip Test::Unit files'
@@ -79,7 +79,7 @@ def self.add_shared_options_for(name)
end
def initialize(*args)
- @gem_filter = lambda { |gem| !options[:skip_gems].include?(gem.name) }
+ @gem_filter = lambda { |gem| true }
@extra_entries = []
super
convert_database_option_for_jruby
@@ -287,8 +287,11 @@ def javascript_gemfile_entry
"Use #{options[:javascript]} as the JavaScript library")
end
- gems << GemfileEntry.version("turbolinks", nil,
- "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks")
+ unless options[:skip_turbolinks]
+ gems << GemfileEntry.version("turbolinks", nil,
+ "Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks")
+ end
+
gems
end
end
@@ -450,12 +450,11 @@ def test_skip_spring
end
end
- def test_generator_if_skip_gems_is_given
- run_generator [destination_root, "--skip-gems", "turbolinks", "coffee-rails"]
+ def test_generator_if_skip_turbolinks_is_given
+ run_generator [destination_root, "--skip-turbolinks"]
assert_file "Gemfile" do |content|
assert_no_match(/turbolinks/, content)
- assert_no_match(/coffee-rails/, content)
end
assert_file "app/views/layouts/application.html.erb" do |content|
assert_no_match(/data-turbolinks-track/, content)

4 comments on commit bf17c8a

@rafaelfranca

This comment has been minimized.

Show comment
Hide comment
Member

rafaelfranca replied Oct 27, 2014

cc @dhh

@dhh

This comment has been minimized.

Show comment
Hide comment
@dhh

dhh Oct 27, 2014

Member
Member

dhh replied Oct 27, 2014

@fivetwentysix

This comment has been minimized.

Show comment
Hide comment

yes!

@mackermedia

This comment has been minimized.

Show comment
Hide comment
@mackermedia

mackermedia Feb 19, 2015

Any idea if this config option can be added to an application template? If so, would you mind providing an example?

Any idea if this config option can be added to an application template? If so, would you mind providing an example?

Please sign in to comment.