diff options
author | NorimasaAndo <norimasa.ando@gmail.com> | 2014-12-14 21:23:44 +0900 |
---|---|---|
committer | NorimasaAndo <norimasa.ando@gmail.com> | 2014-12-14 21:25:26 +0900 |
commit | 8493f44976402b20eb7eafb487ae4213cdb48c94 (patch) | |
tree | 6e7d242718d7882b762084b2452f6e93dcfdb9b9 | |
parent | 870519395f4adfcfe35054b76d3db24662871569 (diff) | |
download | rails-8493f44976402b20eb7eafb487ae4213cdb48c94.tar.gz rails-8493f44976402b20eb7eafb487ae4213cdb48c94.tar.bz2 rails-8493f44976402b20eb7eafb487ae4213cdb48c94.zip |
Fix Duplicate web-console entries in Gemfile
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 10 | ||||
-rw-r--r-- | railties/lib/rails/generators/rails/app/templates/Gemfile | 4 | ||||
-rw-r--r-- | railties/test/generators/app_generator_test.rb | 18 |
3 files changed, 22 insertions, 10 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 518277a254..3db5b50ad6 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -111,7 +111,6 @@ module Rails jbuilder_gemfile_entry, sdoc_gemfile_entry, psych_gemfile_entry, - console_gemfile_entry, @extra_entries].flatten.find_all(&@gem_filter) end @@ -267,15 +266,6 @@ module Rails GemfileEntry.new('sdoc', '~> 0.4.0', comment, group: :doc) end - def console_gemfile_entry - comment = 'Use Rails Console on the Browser' - if options.dev? || options.edge? - GemfileEntry.github 'web-console', 'rails/web-console', nil, comment - else - [] - end - end - def coffee_gemfile_entry comment = 'Use CoffeeScript for .coffee assets and views' if options.dev? || options.edge? diff --git a/railties/lib/rails/generators/rails/app/templates/Gemfile b/railties/lib/rails/generators/rails/app/templates/Gemfile index 7027312aa9..c5bd98a30e 100644 --- a/railties/lib/rails/generators/rails/app/templates/Gemfile +++ b/railties/lib/rails/generators/rails/app/templates/Gemfile @@ -32,7 +32,11 @@ group :development, :test do <%- end -%> # Access an IRB console on exception pages or by using <%%= console %> in views + <%- if options.dev? || options.edge? -%> + gem 'web-console', github: "rails/web-console" + <%- else -%> gem 'web-console', '~> 2.0' + <%- end -%> <%- if spring_install? %> # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index b7cbe04003..5f9f7ad50a 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -420,6 +420,24 @@ class AppGeneratorTest < Rails::Generators::TestCase assert_gem 'web-console' end + def test_web_console_with_dev_option + run_generator [destination_root, "--dev"] + + assert_file "Gemfile" do |content| + assert_match(/gem 'web-console',\s+github: "rails\/web-console"/, content) + assert_no_match(/gem 'web-console', '~> 2.0'/, content) + end + end + + def test_web_console_with_edge_option + run_generator [destination_root, "--edge"] + + assert_file "Gemfile" do |content| + assert_match(/gem 'web-console',\s+github: "rails\/web-console"/, content) + assert_no_match(/gem 'web-console', '~> 2.0'/, content) + end + end + def test_spring run_generator assert_gem 'spring' |