lib/pah/templates/gems.rb in pah-0.0.20 vs lib/pah/templates/gems.rb in pah-0.0.21

- old
+ new

@@ -10,22 +10,40 @@ begin require 'bundler' rescue LoadError # Install bundler if needed unless run 'gem install bundler --no-ri --no-rdoc' - puts 'Error installing bundler, will attempt to continue' + puts 'Error installing bundler, will attempt to continue'.red end require 'bundler' end # Install all other gems needed from Gemfile - unless run 'bundle install --jobs=4' - puts 'Error installing gems, aborting' + status, output = bundle_install_with_progress + if status != 0 + puts output + puts 'Error installing gems, aborting'.red exit 1 end git add: 'Gemfile*' git_commit 'Add Gemfile and Gemfile.lock.' end + + def bundle_install_with_progress + require 'open3' + output = "" + status = 0 + Open3.popen3(ENV, "bundle install --jobs=4") do |stdin, stdout, stderr, wait_thr| + while line = stdout.gets + output += line + print ".".green + end + status = wait_thr.value.to_i + end + puts "" + [status, output] + end + end end end