aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2012-01-13 06:25:43 -0800
committerSantiago Pastorino <santiago@wyeworks.com>2012-01-13 12:40:10 -0200
commit70631e723ca9503b387f25076b9fb7f68726f81e (patch)
tree8904169d2683b1d79b42666367d153c987eaccaf
parent05367e656f0b5c5d5bb3c4676c81fdd064b1cd02 (diff)
downloadrails-70631e723ca9503b387f25076b9fb7f68726f81e.tar.gz
rails-70631e723ca9503b387f25076b9fb7f68726f81e.tar.bz2
rails-70631e723ca9503b387f25076b9fb7f68726f81e.zip
Merge pull request #4451 from guilleiguaran/add-therubyracer-commented
-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 24f210913a..0a73271834 100644
--- a/railties/lib/rails/generators/app_base.rb
+++ b/railties/lib/rails/generators/app_base.rb
@@ -202,7 +202,9 @@ module Rails
group :assets do
gem 'sass-rails', :git => 'git://github.com/rails/sass-rails.git', :branch => '3-2-stable'
gem 'coffee-rails', :git => 'git://github.com/rails/coffee-rails.git', :branch => '3-2-stable'
- #{"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
@@ -213,7 +215,9 @@ module Rails
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
- #{"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
@@ -226,6 +230,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 c456347e5c..a4589c49f4 100644
--- a/railties/test/generators/app_generator_test.rb
+++ b/railties/test/generators/app_generator_test.rb
@@ -230,14 +230,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