lib/hu/deploy.rb in hu-1.3.22 vs lib/hu/deploy.rb in hu-1.3.23

- old
+ new

@@ -43,27 +43,27 @@ end end def deploy(_cmd, _opts, _argv) Hu::Tm.t(:invoke, cmd: 'deploy') - trap('INT') { shutdown; safe_abort; exit 1 } + trap('INT') { shutdown; puts "\e[0m\e[35;1m^C\e[0m"; exit 1 } at_exit do - shutdown - if $ERROR_INFO.class == SystemExit && 130 == $ERROR_INFO.status - puts - safe_abort + if $!.class == SystemExit && 130 == $!.status + puts "\n\n" end + Hu::Tm.flush! + shutdown + print "\e[0m\e[?25h" end begin @git = Rugged::Repository.discover('.') rescue Rugged::RepositoryError => e 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 - safe_abort print TTY::Cursor.prev_line Hu::Tm.t(:error_not_in_working_copy, cmd: 'deploy') exit 1 end @@ -213,11 +213,11 @@ puts Hu::Tm.t(:phase1, cmd: 'deploy') end if release_branch_exists && git_revisions[:release] == git_revisions[stag_app_name] - puts 'Phase 2/3: Your local ' + "release/#{release_tag}".bright + ' (formerly ' + 'develop'.bright + ") is live at "+"#{stag_app_name}".bright+"." + puts 'Phase 2/3: Your local ' + "release/#{release_tag}".bright + ' (formerly ' + 'develop'.bright + ') is live at ' + 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 Hu::Tm.t(:phase2, cmd: 'deploy') @@ -392,13 +392,11 @@ end [idx, table_row] end end - workers.each do |t| - t.join - end + workers.each(&:join) rows = [] ts.each do |t| idx, table_row = t.value rows[idx] = table_row @@ -438,11 +436,11 @@ missing_env = app_config[stag_app_name].keys - app_config[prod_app_name].keys unless missing_env.empty? puts missing_env.each do |var| - puts " WARNING ".color(:red).bright.inverse + " Missing config in "+prod_app_name.bright+": #{var}" + puts ' WARNING '.color(:red).bright.inverse + ' Missing config in ' + prod_app_name.bright + ": #{var}" sleep 0.42 end end Hu::Tm.t(:status_screen, cmd: 'deploy') @@ -531,21 +529,21 @@ print "\e[?25h" end end end - PTY.spawn("stty rows #{rows} cols #{cols}; "+line) do |r, _w, pid| + PTY.spawn("stty rows #{rows} cols #{cols}; " + line) do |r, _w, pid| begin until r.eof? c = r.getc @spinlock.synchronize do print c @minispin_last_char_at = Time.now c = c.encode('UTF-8', 'binary', invalid: :replace, undef: :replace, replace: "\e") # barf. # hold on when we are (likely) inside an escape sequence @minispin_disable = true if c.ord == 27 || c.ord < 9 - @minispin_disable = false if c =~ /[A-Za-z]/ || [13,10].include?(c.ord) + @minispin_disable = false if c =~ /[A-Za-z]/ || [13, 10].include?(c.ord) end end rescue Errno::EIO # Linux raises EIO on EOF, cf. # https://github.com/ruby/ruby/blob/57fb2199059cb55b632d093c2e64c8a3c60acfbb/ext/pty/pty.c#L519 @@ -816,11 +814,10 @@ `git log --pretty=format:" - %s" #{env['PREVIOUS_TAG']}..HEAD 2>/dev/null` end end def shutdown - Hu::Tm.flush! @@shutting_down = true unbusy end def busy(msg = '', format = :classic, clear = true) @@ -854,27 +851,8 @@ puts "--- DEBUG #{label} ---" ap(*args) puts "--- ^#{label}^ ---" end - def safe_abort - @spinner&.stop - printf "\e[0m\e[?25l" - printf '(ヘ・_・)ヘ┳━┳' - sleep 0.5 - printf "\e[12D(ヘ・_・)-┳━┳" - sleep 0.1 - printf "\e[12D\e[31;1m(╯°□°)╯ ┻━┻" - sleep 0.1 - printf "\e[1;31m\e[14D(╯°□°)╯ ┻━┻" - sleep 0.05 - printf "\e[0;31m\e[15D(╯°□°)╯ ┻━┻" - sleep 0.05 - printf "\e[30;1m\e[16D(╯°□°)╯ ┻━┻" - sleep 0.05 - printf "\e[17D " - printf "\e[?25h" - puts - end - end - end -end + end # /Class Deploy + end # /Class Cli +end # /Module Hu