Skip to content

Commit

Permalink
improve #6318
Browse files Browse the repository at this point in the history
  • Loading branch information
mpapis authored and drogus committed May 16, 2012
1 parent 57d534e commit 5904295
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
9 changes: 5 additions & 4 deletions railties/lib/rails/generators/app_base.rb
Expand Up @@ -249,13 +249,14 @@ def bundle_command(command)
# We unset temporary bundler variables to load proper bundler and Gemfile.
#
# Thanks to James Tucker for the Gem tricks involved in this call.
_bundle_command = Gem.bin_path('bundler', 'bundle')

bundle_gemfile, rubyopt = ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", ""
bundle_bin_path, bundle_gemfile, rubyopt = ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", "", ""

print `"#{Gem.ruby}" "#{Gem.bin_path('bundler', 'bundle')}" #{command}`
print `"#{Gem.ruby}" "#{_bundle_command}" #{command}`

ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_gemfile, rubyopt
ENV['BUNDLE_BIN_PATH'], ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_bin_path, bundle_gemfile, rubyopt
end

def run_bundle
Expand Down
7 changes: 6 additions & 1 deletion railties/test/generators/plugin_new_generator_test.rb
Expand Up @@ -100,6 +100,12 @@ def test_ensure_that_database_option_is_passed_to_app_generator

def test_generation_runs_bundle_install_with_full_and_mountable
result = run_generator [destination_root, "--mountable", "--full"]
assert_file "#{destination_root}/Gemfile.lock" do |contents|
assert_match(/bukkits/, contents)
end
assert_match(/run bundle install/, result)
assert_match(/Using bukkits \(0\.0\.1\)/, result)
assert_match(/Your bundle is complete/, result)
assert_equal 1, result.scan("Your bundle is complete").size
end

Expand Down Expand Up @@ -348,4 +354,3 @@ def action(*args, &block)
silence(:stdout){ generator.send(*args, &block) }
end
end

0 comments on commit 5904295

Please sign in to comment.