Sha256: 606f71874c668fbf2ecb6e1ec21a961b067e3174df957c2b29613c958f3bc1d4

Contents?: true

Size: 1.04 KB

Versions: 12

Compression:

Stored size: 1.04 KB

Contents

module DPL
  class Provider
    class RubyGems < Provider
      requires 'gems'

      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

      def needs_key?
        false
      end

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

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

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

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

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dpl-1.4.6.travis.124.2 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.119.2 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.118.4 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.117.3 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.117.4 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.117.6 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.117.5 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.117.1 lib/dpl/provider/rubygems.rb
dpl-1.4.6.travis.116.4 lib/dpl/provider/rubygems.rb
dpl-1.4.5 lib/dpl/provider/rubygems.rb
dpl-1.4.4 lib/dpl/provider/rubygems.rb
dpl-1.4.3 lib/dpl/provider/rubygems.rb