Class: DPL::Provider::RubyGems

Inherits:
DPL::Provider show all
Defined in:
lib/dpl/provider/rubygems.rb

Instance Attribute Summary

Attributes inherited from DPL::Provider

#context, #options

Instance Method Summary collapse

Methods inherited from DPL::Provider

apt_get, #cleanup, #commit_msg, context, #create_key, #deploy, #detect_encoding?, #encoding_for, #error, experimental, #initialize, #log, new, npm_g, #option, pip, requires, #run, #setup_git_credentials, #setup_git_ssh, #sha, shell, #uncleanup, #user_agent, #warn

Constructor Details

This class inherits a constructor from DPL::Provider

Instance Method Details

#check_appObject



24
25
26
27
28
29
# File 'lib/dpl/provider/rubygems.rb', line 24

def check_app
  setup_auth
  setup_gem
  info = ::Gems.info(options[:gem])
  log "Found gem #{info['name']}"
end

#check_authObject



31
32
33
34
# File 'lib/dpl/provider/rubygems.rb', line 31

def check_auth
  setup_auth
  log "Authenticated with username #{::Gems.username}" if ::Gems.username
end

#gemspecObject



20
21
22
# File 'lib/dpl/provider/rubygems.rb', line 20

def gemspec
  options[:gemspec].gsub('.gemspec', '') if options[:gemspec]
end

#needs_key?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/dpl/provider/rubygems.rb', line 12

def needs_key?
  false
end

#push_appObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/dpl/provider/rubygems.rb', line 36

def push_app
  setup_auth
  setup_gem
  context.shell "gem build #{gemspec || option(:gem)}.gemspec"
  Dir.glob("#{gemspec || option(:gem)}-*.gem") do |f|
    if options[:host]
      log ::Gems.push(File.new(f), options[:host])
    else
      log ::Gems.push(File.new f)
    end
  end
end

#setup_authObject



6
7
8
9
10
# File 'lib/dpl/provider/rubygems.rb', line 6

def setup_auth
  ::Gems.key = option(:api_key) if options[:api_key]
  ::Gems.username = option(:user) unless options[:api_key]
  ::Gems.password = option(:password) unless options[:api_key]
end

#setup_gemObject



16
17
18
# File 'lib/dpl/provider/rubygems.rb', line 16

def setup_gem
  options[:gem] ||= options[:app]
end