Class: Rake::GemMaintenance::GemPush

Inherits:
Object
  • Object
show all
Defined in:
lib/rake/gem/maintenance/gem_push.rb

Overview

Pushes a single gem file to one repository, retrying with a renewed API key on auth failure.

Defined Under Namespace

Classes: Result

Instance Method Summary collapse

Constructor Details

#initialize(gem_file, repository, otp_provider) ⇒ GemPush

Returns a new instance of GemPush.



11
12
13
14
15
# File 'lib/rake/gem/maintenance/gem_push.rb', line 11

def initialize(gem_file, repository, otp_provider)
  @gem_file = gem_file
  @repository = repository
  @otp_provider = otp_provider
end

Instance Method Details

#attemptObject



17
18
19
20
21
22
23
# File 'lib/rake/gem/maintenance/gem_push.rb', line 17

def attempt
  out_err, status = Open3.capture2e(env, command)
  return Result.new(true, nil) if status.success?
  return retry_with_renewed_key if auth_failure?(out_err)

  Result.new(false, out_err)
end