lib/hu/deploy.rb in hu-1.5.4 vs lib/hu/deploy.rb in hu-1.5.5

- old
+ new

@@ -3,11 +3,11 @@ module Hu class Cli < Optix::Cli class Deploy < Optix::Cli ::TTY::Formats::FORMATS[:hu] = { frames: '🌑🌒🌓🌔🌕🌖🌗🌘'.chars, interval: 10 } - ::TTY::Formats::FORMATS[:huroku] = { frames: '⣾⣽⣻⢿⡿⣟⣯⣷'.chars, interval: 10 } + ::TTY::Formats::FORMATS[:huroku] = { frames: '⣷⣯⣟⡿⢿⣻⣽⣾'.chars, interval: 10 } $stdout.sync @@shutting_down = false @@spinner = nil @@home_branch = nil @@ -73,39 +73,43 @@ end begin @git = Rugged::Repository.discover('.') rescue Rugged::RepositoryError => e + print TTY::Cursor.clear_line + TTY::Cursor.show puts puts "Git error: #{e}".color(:red) puts 'You need to be inside the working copy of the app that you wish to deploy.'.color(:red) puts exit 1 end Dir.chdir(@git.workdir) if @git.config['branch.master.remote'] != 'origin' + print TTY::Cursor.clear_line + TTY::Cursor.show puts puts "ERROR: Remote of branch 'master' does not point to 'origin'.".color(:red) puts - puts ' Sorry, we need an origin here. We really do.' + puts " Please run 'git config branch.master.remote origin'" puts exit 1 end if @git.config['gitflow.branch.master'].nil? + print TTY::Cursor.clear_line + TTY::Cursor.show puts puts "ERROR: This repository doesn't seem to be git-flow enabled.".color(:red) puts puts " Please run 'git flow init -d'" puts exit 1 end unless @git.config['gitflow.prefix.versiontag'].nil? || @git.config['gitflow.prefix.versiontag'].empty? + print TTY::Cursor.clear_line + TTY::Cursor.show puts puts 'ERROR: git-flow version prefix configured.'.color(:red) puts puts ' Please use this command to remove the prefix:' puts @@ -120,10 +124,11 @@ wc_update = Thread.new { update_working_copy } app = heroku_app_by_git(push_url) if app.nil? + print TTY::Cursor.clear_line + TTY::Cursor.show puts puts "ERROR: Found no heroku app for git remote #{push_url}".color(:red) puts ' Are you logged into the right heroku account?'.color(:red) puts puts " Please run 'git remote rm heroku'. Then run 'hu deploy' again to select a new remote." @@ -132,10 +137,11 @@ end pipeline_name, stag_app_id, prod_app_id = heroku_pipeline_details(app) if app['id'] != stag_app_id + print TTY::Cursor.clear_line + TTY::Cursor.show puts puts "ERROR: The git remote 'heroku' points to app '#{app['name']}'".color(:red) puts " which is not in stage 'staging'".color(:red) + " of pipeline '#{pipeline_name}'.".color(:red) puts @@ -231,11 +237,11 @@ puts ' ' + stag_app_name.to_s.bright + ' to begin the deploy procedure.' puts end if release_branch_exists && git_revisions[:release] == git_revisions[stag_app_name] - puts ' Phase 2/3 '.inverse + ' Your local ' + "release/#{release_tag}".bright + ' (formerly ' + 'develop'.bright + ') is live at ' + stag_app_name.to_s.bright + '.' + puts ' Phase 2/3 '.inverse + ' Your local ' + "release/#{release_tag}".bright + ' (formerly ' + 'develop'.bright + ') is live on ' + stag_app_name.to_s.bright + '.' puts ' Please test here: ' + (app['web_url']).to_s.bright puts ' If everything looks good, you may proceed and finish the release.' puts ' If there are problems: Quit, delete the release branch and start fixing.' puts elsif git_revisions[prod_app_name] != git_revisions[stag_app_name] && !release_branch_exists && git_revisions[:release] != git_revisions[stag_app_name] @@ -585,9 +591,10 @@ busy line if opts[:spinner] output, status = Open3.capture2e(line) unbusy if opts[:spinner] color = (status.exitstatus == 0) ? :green : :red if status.exitstatus != 0 || !opts[:quiet] + print TTY::Cursor.clear_line + TTY::Cursor.show puts "\n> ".color(color) + line.color(:black).bright puts output end end next unless status.exitstatus != 0