Class: Travis::CLI::Setup::RubyGems

Inherits:
Service
  • Object
show all
Defined in:
lib/travis/cli/setup/ruby_gems.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

#runObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/travis/cli/setup/ruby_gems.rb', line 9

def run
  deploy 'rubygems', 'release' do |config|
    authorization_file  = File.expand_path('.rubygems/authorization', ENV['HOME'])
    credentials_file    = File.expand_path('.gem/credentials', ENV['HOME'])

    config['api_key'] ||= File.read(authorization_file)                       if File.exist? authorization_file
    config['api_key'] ||= YAML.load_file(credentials_file)[:rubygems_api_key] if File.exist? credentials_file
    config['api_key'] ||= ask("RubyGems API token: ") { |q| q.echo = "*" }.to_s
    config['gem']     ||= ask("Gem name: ") { |q| q.default = repository.name }.to_s

    on("Release only tagged commits? ", config, 'tags' => true)
  end
end