Class: DPL::Provider::RubyGems
Instance Attribute Summary
#context, #options
Instance Method Summary
collapse
apt_get, #cleanup, #commit_msg, context, #create_key, #default_text_charset, #default_text_charset?, #deploy, deprecated, #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_app ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/dpl/provider/rubygems.rb', line 24
def check_app
setup_auth
setup_gem
log "Looking up gem #{options[:gem]}"
info = ::Gems.info(options[:gem])
log "Found gem #{info['name']}"
end
|
#check_auth ⇒ Object
32
33
34
35
|
# File 'lib/dpl/provider/rubygems.rb', line 32
def check_auth
setup_auth
log "Authenticated with username #{::Gems.username}" if ::Gems.username
end
|
#gemspec ⇒ Object
20
21
22
|
# File 'lib/dpl/provider/rubygems.rb', line 20
def gemspec
options[:gemspec].gsub('.gemspec', '') if options[:gemspec]
end
|
#needs_key? ⇒ Boolean
12
13
14
|
# File 'lib/dpl/provider/rubygems.rb', line 12
def needs_key?
false
end
|
#push_app ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/dpl/provider/rubygems.rb', line 37
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_auth ⇒ Object
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_gem ⇒ Object
16
17
18
|
# File 'lib/dpl/provider/rubygems.rb', line 16
def setup_gem
options[:gem] ||= options[:app]
end
|