diff options
author | Xavier Noria <fxn@hashref.com> | 2011-06-10 23:43:24 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-06-10 23:43:24 +0200 |
commit | 6c58585ff5b667de4f29860e4b06e743e0614891 (patch) | |
tree | e0cab6a35f99192997b32678ae8a10365aa96afd /railties | |
parent | 8eb2b519f267e61edcf1e715489c3c9ac0244d81 (diff) | |
download | rails-6c58585ff5b667de4f29860e4b06e743e0614891.tar.gz rails-6c58585ff5b667de4f29860e4b06e743e0614891.tar.bz2 rails-6c58585ff5b667de4f29860e4b06e743e0614891.zip |
shell out to run bundler on app generation, see rationale in the comment
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/generators/app_base.rb | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/railties/lib/rails/generators/app_base.rb b/railties/lib/rails/generators/app_base.rb index 7972c72c1e..f07e090c25 100644 --- a/railties/lib/rails/generators/app_base.rb +++ b/railties/lib/rails/generators/app_base.rb @@ -188,13 +188,19 @@ module Rails end def bundle_command(command) - require 'bundler' - require 'bundler/cli' - say_status :run, "bundle #{command}" - Bundler::CLI.new.send(command) - rescue - say_status :failure, "bundler raised an exception, are you offline?", :red + + # We are going to shell out rather than invoking Bundle::CLI.new(command) + # because `rails new` loads the Thor gem and on the other hand bundler uses + # its own vendored Thor, which could be a different version. Running both + # things in the same process is a recipe for a night with paracetamol. + # + # We use backticks and #print here instead of vanilla #system because it + # 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. + # + # Thanks to James Tucker for the Gem tricks involved in this call. + print `"#{Gem.ruby}" -rubygems "#{Gem.bin_path('bundler', 'bundle')}" #{command}` end def run_bundle |