Skip to content
This repository
Browse code

improve #6318

  • Loading branch information...
commit 5904295b2327f512657a5c44503675807c45ee37 1 parent 57d534e
Michal Papis mpapis authored drogus committed
9 railties/lib/rails/generators/app_base.rb
@@ -249,13 +249,14 @@ def bundle_command(command)
249 249 # We unset temporary bundler variables to load proper bundler and Gemfile.
250 250 #
251 251 # Thanks to James Tucker for the Gem tricks involved in this call.
  252 + _bundle_command = Gem.bin_path('bundler', 'bundle')
252 253
253   - bundle_gemfile, rubyopt = ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
254   - ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", ""
  254 + bundle_bin_path, bundle_gemfile, rubyopt = ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
  255 + ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", "", ""
255 256
256   - print `"#{Gem.ruby}" "#{Gem.bin_path('bundler', 'bundle')}" #{command}`
  257 + print `"#{Gem.ruby}" "#{_bundle_command}" #{command}`
257 258
258   - ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_gemfile, rubyopt
  259 + ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_bin_path, bundle_gemfile, rubyopt
259 260 end
260 261
261 262 def run_bundle
7 railties/test/generators/plugin_new_generator_test.rb
@@ -100,6 +100,12 @@ def test_ensure_that_database_option_is_passed_to_app_generator
100 100
101 101 def test_generation_runs_bundle_install_with_full_and_mountable
102 102 result = run_generator [destination_root, "--mountable", "--full"]
  103 + assert_file "#{destination_root}/Gemfile.lock" do |contents|
  104 + assert_match(/bukkits/, contents)
  105 + end
  106 + assert_match(/run bundle install/, result)
  107 + assert_match(/Using bukkits \(0\.0\.1\)/, result)
  108 + assert_match(/Your bundle is complete/, result)
103 109 assert_equal 1, result.scan("Your bundle is complete").size
104 110 end
105 111
@@ -348,4 +354,3 @@ def action(*args, &block)
348 354 silence(:stdout){ generator.send(*args, &block) }
349 355 end
350 356 end
351   -

0 comments on commit 5904295

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