class CircleCI::CLI::Command::RetryCommand
Public Class Methods
run(options)
click to toggle source
# File lib/circleci/cli/command/retry_command.rb, line 8 def run(options) setup_token username, reponame = project_name(options).split('/') number = build_number_for(username, reponame, options) build = Response::Build.retry(username, reponame, number) if build&.username say "build #{username}/#{reponame} #{build.build_number} is triggered" else say "failed to trigger #{username}/#{reponame} #{number}" end end
Private Class Methods
build_number_for(username, reponame, options)
click to toggle source
# File lib/circleci/cli/command/retry_command.rb, line 24 def build_number_for(username, reponame, options) if options.last get_last_build_number(username, reponame) else build_number(options) end end
get_last_build_number(username, reponame)
click to toggle source
# File lib/circleci/cli/command/retry_command.rb, line 32 def get_last_build_number(username, reponame) Response::Build.failed(username, reponame).map(&:build_number).max end