Skip to content
Browse files

Add therubyracer gem commented in default Gemfile

  • Loading branch information...
1 parent 31472ba commit 94bcdd60eaecd81e243731ac62af56b68f91b9fe @guilleiguaran guilleiguaran committed Jan 12, 2012
Showing with 16 additions and 6 deletions.
  1. +14 −2 railties/lib/rails/generators/app_base.rb
  2. +2 −4 railties/test/generators/app_generator_test.rb
View
16 railties/lib/rails/generators/app_base.rb
@@ -195,7 +195,9 @@ def assets_gemfile_entry
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 @@ def assets_gemfile_entry
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 @@ def javascript_gemfile_entry
"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}"
View
6 railties/test/generators/app_generator_test.rb
@@ -229,14 +229,12 @@ def test_generator_if_skip_sprockets_is_given
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["']$/
@splattael
splattael added a note Jan 16, 2012

Should probably read: assert_file "Gemfile", /^\s*gem\s+["']therubyrhino["']$/

(Sorry for nitpicking)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
else
- assert_file "Gemfile" do |content|
- assert_no_match(/gem\s+["']therubyrhino["']$/, content)
- end
+ assert_file "Gemfile", /# gem\s+["']therubyracer["']$/
end
end

0 comments on commit 94bcdd6

Please sign in to comment.
Something went wrong with that request. Please try again.