Permalink
Browse files

Add an option to skip installation of Turbolinks

  • Loading branch information...
schuetzm committed Jun 14, 2014
1 parent a041107 commit e3dca3acc6919b0824bc126f8a397f5f4e7484a2
Showing with 21 additions and 2 deletions.
  1. +7 −2 railties/lib/rails/generators/app_base.rb
  2. +14 −0 railties/test/generators/app_generator_test.rb
@@ -50,6 +50,9 @@ def self.add_shared_options_for(name)
class_option :skip_spring, type: :boolean, default: false,
desc: "Don't install Spring application preloader"
+ class_option :skip_turbolinks, type: :boolean, default: false,
+ desc: "Don't install Turbolinks"
+
class_option :database, type: :string, aliases: '-d', default: 'sqlite3',
desc: "Preconfigure for selected database (options: #{DATABASES.join('/')})"
@@ -287,8 +290,10 @@ def javascript_gemfile_entry
gems << GemfileEntry.version("#{options[:javascript]}-rails", nil,
"Use #{options[:javascript]} as the JavaScript library")
- 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
@@ -448,6 +448,20 @@ def test_skip_spring
end
end
+ def test_skip_turbolinks
+ run_generator [destination_root, "--skip-turbolinks"]
+
+ assert_file "Gemfile" do |content|
+ assert_no_match(/turbolinks/, content)
+ end
+ assert_file "app/views/layouts/application.html.erb" do |content|
+ assert_no_match(/data-turbolinks-track/, content)
+ end
+ assert_file "app/assets/javascripts/application.js" do |content|
+ assert_no_match(/turbolinks/, content)
+ end
+ end
+
def test_gitignore_when_sqlite3
run_generator

0 comments on commit e3dca3a

Please sign in to comment.