Permalink
Browse files

Merge pull request #6318 from mpapis/master

fix `bundle exec rails new app` not running `bundle install` properly
  • Loading branch information...
2 parents 3bc73df + aed906a commit 0be7fabd4eb77828e7deff7513faa3834d1a021a @josevalim josevalim committed May 15, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 railties/lib/rails/generators/app_base.rb
View
8 railties/lib/rails/generators/app_base.rb
@@ -246,8 +246,16 @@ def bundle_command(command)
# is easier to silence stdout in the existing test suite this way. The
# end-user gets the bundler commands called anyway, so no big deal.
#
+ # We unset temporary bundler variables to load proper bundler and Gemfile.
+ #
# Thanks to James Tucker for the Gem tricks involved in this call.
+
+ bundle_gemfile, rubyopt = ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT']
+ ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = "", ""
+
print `"#{Gem.ruby}" "#{Gem.bin_path('bundler', 'bundle')}" #{command}`
+
+ ENV['BUNDLE_GEMFILE'], ENV['RUBYOPT'] = bundle_gemfile, rubyopt
end
def run_bundle

6 comments on commit 0be7fab

@spastorino
Ruby on Rails member

Seems like this commit broke some railties tests http://travis-ci.org/#!/rails/rails/jobs/1334117

@josevalim
Ruby on Rails member
@rafaelfranca
Ruby on Rails member

I think @drogus is trying to fix it in this branch https://github.com/rails/rails/tree/possible-railties-fix

@drogus
Ruby on Rails member

@josevalim this thing is not as simple as removing the test, the underlying issue is worse. I'm not sure if other tests are affected, but even if not there is a lot of warnings about bundler (can't find bundler gem). The issue is that bundler has problems with GEM_PATH if you run bundle exec and want to run subprocess with another Gemfile. I'm trying to get the fix to bundler, if I don't succeed in pushing it soon, I will revert this changes and wait for the fix (I pushed another branch with revert to see if it passes).

@drogus
Ruby on Rails member

Also, sorry for this, I should have revert earlier, I just thought that I will be able to fix it quicker.

@drogus
Ruby on Rails member

For the record: I reverted all the changes related to this here: 0f5cc34

I will bring them back as soon as I can settle up what will be the best fix in bundler.

Please sign in to comment.