Class: Travis::CLI::Setup::Releases

Inherits:
Service
  • Object
show all
Defined in:
lib/travis/cli/setup/releases.rb

Instance Attribute Summary

Attributes inherited from Service

#command

Instance Method Summary collapse

Methods inherited from Service

description, #initialize, known_as?, #method_missing, normalized_name, service_name

Constructor Details

This class inherits a constructor from Travis::CLI::Setup::Service

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Travis::CLI::Setup::Service

Instance Method Details

#githubObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/travis/cli/setup/releases.rb', line 17

def github
  @github ||= begin
    load_gh
    Tools::Github.new(session.config['github']) do |g|
      g.drop_token    = false
      g.     = proc { ask("Username: ") }
      g.ask_password  = proc { |user| ask("Password for #{user}: ") { |q| q.echo = "*" } }
      g.ask_otp       = proc { |user| ask("Two-factor authentication code for #{user}: ") }
      g.debug         = proc { |log| debug(log) }
      g.after_tokens  = proc { g.explode = true and error("no suitable github token found") }
      g.scopes        = org? ? ['public_repo'] : ['repo']
      g.note          = "automatic releases for #{repository.slug}"
    end
  end
end

#runObject



10
11
12
13
14
15
# File 'lib/travis/cli/setup/releases.rb', line 10

def run
  deploy 'releases' do |config|
    github.with_token { |t| config['api_key'] = t }
    config['file'] = ask("File to Upload: ").to_s
  end
end