etc/ci_setup.rb in heroku_hatchet-5.0.3 vs etc/ci_setup.rb in heroku_hatchet-6.0.0

- old
+ new

@@ -1,8 +1,16 @@ #!/usr/bin/env ruby -require 'bundler' require 'shellwords' + +STDOUT.sync = true + +def run_cmd(command) + puts "== Running: #{command}" + result = `#{command}` + raise "Command failed: #{command.inspect}\nResult: #{result}" unless $?.success? +end + puts "== Setting Up CI ==" netrc_file = "#{ENV['HOME']}/.netrc" unless File.exists?(netrc_file) File.open(netrc_file, 'w') do |file| @@ -12,20 +20,16 @@ password #{ENV.fetch('HEROKU_API_KEY')} machine api.heroku.com login #{ENV.fetch('HEROKU_API_USER')} password #{ENV.fetch('HEROKU_API_KEY')} EOF - `chmod 0600 "$HOME/.netrc"` + run_cmd 'chmod 0600 "$HOME/.netrc"' end end -[ - "bundle exec hatchet ci:install_heroku", - "bundle exec hatchet install", - "git config --get user.email > /dev/null || git config --global user.email #{ENV.fetch('HEROKU_API_USER').shellescape}", - "git config --get user.name > /dev/null || git config --global user.name 'BuildpackTester'", -].each do |command| - puts "== Running: #{command}" - result = `#{command}` - raise "Command failed: #{command.inspect}\nResult: #{result}" unless $?.success? -end +run_cmd "bundle exec hatchet ci:install_heroku" +run_cmd "bundle exec hatchet install" +run_cmd "git config --get user.email > /dev/null || git config --global user.email #{ENV.fetch('HEROKU_API_USER').shellescape}" +run_cmd "git config --get user.name > /dev/null || git config --global user.name 'BuildpackTester'" + puts "== Done ==" +