1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #4451 from guilleiguaran/add-therubyracer-commented

Add therubyracer gem commented in default Gemfile
This commit is contained in:
José Valim 2012-01-13 06:25:43 -08:00
commit 1e69181c5f
2 changed files with 16 additions and 6 deletions

View file

@ -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}"

View file

@ -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