diff --git a/railties/lib/generators/rails/app/app_generator.rb b/railties/lib/generators/rails/app/app_generator.rb index ea1930a..5ebbb14 100644 --- a/railties/lib/generators/rails/app/app_generator.rb +++ b/railties/lib/generators/rails/app/app_generator.rb @@ -175,7 +175,8 @@ module Rails::Generators end def bundle_if_dev_or_edge - run "bundle install" if dev_or_edge? + bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle') + run "#{bundle_command} install" if dev_or_edge? end protected diff --git a/railties/test/generators/app_generator_test.rb b/railties/test/generators/app_generator_test.rb index 01d643c..b9b5caf 100644 --- a/railties/test/generators/app_generator_test.rb +++ b/railties/test/generators/app_generator_test.rb @@ -9,6 +9,7 @@ class AppGeneratorTest < Rails::Generators::TestCase def setup super Rails::Generators::AppGenerator.instance_variable_set('@desc', nil) + @bundle_command = File.basename(Thor::Util.ruby_command).sub(/ruby/, 'bundle') end def teardown @@ -160,14 +161,14 @@ class AppGeneratorTest < Rails::Generators::TestCase end def test_dev_option - generator([destination_root], :dev => true).expects(:run).with("bundle install") + generator([destination_root], :dev => true).expects(:run).with("#{@bundle_command} install") silence(:stdout){ generator.invoke } rails_path = File.expand_path('../../..', Rails.root) assert_file 'Gemfile', /^gem\s+["']rails["'],\s+:path\s+=>\s+["']#{Regexp.escape(rails_path)}["']$/ end def test_edge_option - generator([destination_root], :edge => true).expects(:run).with("bundle install") + generator([destination_root], :edge => true).expects(:run).with("#{@bundle_command} install") silence(:stdout){ generator.invoke } assert_file 'Gemfile', /^gem\s+["']rails["'],\s+:git\s+=>\s+["']#{Regexp.escape("git://github.com/rails/rails.git")}["']$/ end