class Object
Public Instance Methods
default_to_using_the_plain_git()
click to toggle source
# File bin/gitgud, line 41 def default_to_using_the_plain_git system('git', *ARGV) end
plz_push_my_thing_on_git_thx_k_bye()
click to toggle source
# File bin/gitgud, line 34 def plz_push_my_thing_on_git_thx_k_bye CLI::UI::StdoutRouter.enable spin_group = CLI::UI::SpinGroup.new(auto_debrief: false) spin_group.add(spinner_title) { |spinner| try_to_push_this_thing(spinner) } spin_group.wait end
run_da_whole_show()
click to toggle source
# File bin/gitgud, line 45 def run_da_whole_show if ARGV[0] == 'push' ARGV.shift plz_push_my_thing_on_git_thx_k_bye else default_to_using_the_plain_git end end
spinner_title(attempt_number = 1)
click to toggle source
# File bin/gitgud, line 26 def spinner_title(attempt_number = 1) if attempt_number == 1 'Attempting git push' else "Attempting git push (Attempt ##{attempt_number})" end end
try_to_push_this_thing(spinner)
click to toggle source
# File bin/gitgud, line 6 def try_to_push_this_thing(spinner) counter = 1 while counter <= 20 spinner.update_title(spinner_title(counter)) counter += 1 output, status = Open3.capture2e('git', 'push', *ARGV) if status.success? return spinner.update_title("Successfully git pushed") elsif !output.match?(/remote: Internal Server Error\sEverything up-to-date/) spinner.update_title("Encountered error while git pushing\n#{output}") return :task_failed end end spinner.update_title("Unsuccessful after 20 attemps") :task_failed end