aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-01-13 06:25:43 -0800
committerJosé Valim <jose.valim@gmail.com>2012-01-13 06:25:43 -0800
commit1e69181c5f4120d604fe86a9c2620694760d6c8e (patch)
treeb7608198fb618cbac7c0051bfd1d31290649d5ec
parentdaf59a73861bee7726a502c24a796c67e2ecd45f (diff)
parent94bcdd60eaecd81e243731ac62af56b68f91b9fe (diff)
downloadrails-1e69181c5f4120d604fe86a9c2620694760d6c8e.tar.gz
rails-1e69181c5f4120d604fe86a9c2620694760d6c8e.tar.bz2
rails-1e69181c5f4120d604fe86a9c2620694760d6c8e.zip
Merge pull request #4451 from guilleiguaran/add-therubyracer-commented
Add therubyracer gem commented in default Gemfile
-rw-r--r--railties/lib/rails/generators/app_base.rb16
-rw-r--r--railties/test/generators/app_generator_test.rb6
2 files changed, 16 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb
index 046b8f3925..d3420a6a3c 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -195,7 +195,9 @@ module Rails
group :assets do
gem 'sass-rails', :git => 'https://github.com/rails/sass-rails.git'
gem 'coffee-rails', :git => 'https://github.com/rails/coffee-rails.git'
- #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ #{javascript_runtime_gemfile_entry}
gem 'uglifier', '>= 1.0.3'
end
GEMFILE
@@ -206,7 +208,9 @@ module Rails
group :assets do
gem 'sass-rails', '~> 4.0.0.beta'
gem 'coffee-rails', '~> 4.0.0.beta'
- #{"gem 'therubyrhino'\n" if defined?(JRUBY_VERSION)}
+
+ # See https://github.com/sstephenson/execjs#readme for more supported runtimes
+ #{javascript_runtime_gemfile_entry}
gem 'uglifier', '>= 1.0.3'
end
GEMFILE
@@ -219,6 +223,14 @@ module Rails
"gem '#{options[:javascript]}-rails'" unless options[:skip_javascript]
end
+ def javascript_runtime_gemfile_entry
+ if defined?(JRUBY_VERSION)
+ "gem 'therubyrhino'\n"
+ else
+ "# gem 'therubyracer'\n"
+ end
+ end
+
def bundle_command(command)
say_status :run, "bundle #{command}"
diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb
index 70ef37ee0f..f3071843e2 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -229,14 +229,12 @@ class AppGeneratorTest < Rails::Generators::TestCase
assert_file "test/performance/browsing_test.rb"
end
- def test_inclusion_of_therubyrhino_under_jruby
+ def test_inclusion_of_javascript_runtime
run_generator([destination_root])
if defined?(JRUBY_VERSION)
assert_file "Gemfile", /gem\s+["']therubyrhino["']$/
else
- assert_file "Gemfile" do |content|
- assert_no_match(/gem\s+["']therubyrhino["']$/, content)
- end
+ assert_file "Gemfile", /# gem\s+["']therubyracer["']$/
end
end