mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Print bundle install
output in rails new
as soon as it's available
Previously, running `rails new` would not print any of the output from `bundle install` until all the gems had finished installing. This made it look like the generator was hanging at the `bundle install` step. This commit switches to using `system` so that the bundle command can output as it needs to. This has the added benefit of including output bundler produces on standard error, which the previous code ignored since backticks only capture standard out. This is not a big deal right now since bundler does not currently print errors to standard error, but that may change in the future (see: bundler/bundler/issues/3353).
This commit is contained in:
parent
3064533076
commit
2a5bb9d56e
2 changed files with 13 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
* Print `bundle install` output in `rails new` as soon as it's available
|
||||
|
||||
Running `rails new` will now print the output of `bundle install` as
|
||||
it is available, instead of waiting until all gems finish installing.
|
||||
|
||||
*Max Holder*
|
||||
|
||||
* Add a new-line to the end of route method generated code.
|
||||
|
||||
We need to add a `\n`, because we cannot have two routes
|
||||
|
|
|
@ -315,10 +315,6 @@ module Rails
|
|||
# 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.
|
||||
#
|
||||
# We unset temporary bundler variables to load proper bundler and Gemfile.
|
||||
#
|
||||
# Thanks to James Tucker for the Gem tricks involved in this call.
|
||||
|
@ -326,8 +322,12 @@ module Rails
|
|||
|
||||
require 'bundler'
|
||||
Bundler.with_clean_env do
|
||||
output = `"#{Gem.ruby}" "#{_bundle_command}" #{command}`
|
||||
print output unless options[:quiet]
|
||||
full_command = %Q["#{Gem.ruby}" "#{_bundle_command}" #{command}]
|
||||
if options[:quiet]
|
||||
system(full_command, out: File::NULL)
|
||||
else
|
||||
system(full_command)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue