Class: DPL::Provider::RubyGems
- Inherits:
-
DPL::Provider
- Object
- DPL::Provider
- DPL::Provider::RubyGems
- Defined in:
- lib/dpl/provider/rubygems.rb
Instance Method Summary collapse
- #check_app ⇒ Object
- #check_auth ⇒ Object
- #gemspec ⇒ Object
- #gemspec_glob ⇒ Object
- #needs_key? ⇒ Boolean
- #push_app ⇒ Object
- #setup_auth ⇒ Object
- #setup_gem ⇒ Object
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 #{[:gem]}" info = ::Gems.info([: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 [:gemspec].gsub('.gemspec', '') if [:gemspec] end |
#gemspec_glob ⇒ Object
50 51 52 |
# File 'lib/dpl/provider/rubygems.rb', line 50 def gemspec_glob [:gemspec_glob] || "#{gemspec || option(:gem)}.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 "for f in #{gemspec_glob}; do gem build $f; done" Dir.glob("#{option(:gem)}-*.gem") do |f| if [:host] log ::Gems.push(File.new(f), [: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 [:api_key] ::Gems.username = option(:user, :username) unless [:api_key] ::Gems.password = option(:password) unless [:api_key] end |
#setup_gem ⇒ Object
16 17 18 |
# File 'lib/dpl/provider/rubygems.rb', line 16 def setup_gem [:gem] ||= [:app] end |