Sha256: 42e3e6fe0d8e492b5210f6e785fc66f6c75b66c64a47b6d9b97ac520c750d243

Contents?: true

Size: 1.22 KB

Versions: 68

Compression:

Stored size: 1.22 KB

Contents

module DPL
  class Provider
    class RubyGems < Provider
      requires 'gems', version: '>= 0.8.3'

      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
        log "Looking up gem #{options[: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|
          if options[:host]
            log ::Gems.push(File.new(f), options[:host])
          else
            log ::Gems.push(File.new f)
          end
        end
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
dpl-1.8.48.travis.2486.5 lib/dpl/provider/rubygems.rb
dpl-1.8.47 lib/dpl/provider/rubygems.rb
dpl-1.8.47.travis.2485.5 lib/dpl/provider/rubygems.rb
dpl-1.8.47.travis.2484.5 lib/dpl/provider/rubygems.rb
dpl-1.8.47.travis.2483.5 lib/dpl/provider/rubygems.rb
dpl-1.8.47.travis.2459.3 lib/dpl/provider/rubygems.rb
dpl-1.8.47.travis.2458.3 lib/dpl/provider/rubygems.rb
dpl-1.8.46 lib/dpl/provider/rubygems.rb
dpl-1.8.47.travis.2456.5 lib/dpl/provider/rubygems.rb
dpl-1.8.46.travis.2455.5 lib/dpl/provider/rubygems.rb
dpl-1.8.46.travis.2454.5 lib/dpl/provider/rubygems.rb
dpl-1.8.46.travis.2451.5 lib/dpl/provider/rubygems.rb
dpl-1.8.46.travis.2449.5 lib/dpl/provider/rubygems.rb
dpl-1.8.46.travis.2444.5 lib/dpl/provider/rubygems.rb
dpl-1.8.45 lib/dpl/provider/rubygems.rb
dpl-1.8.46.travis.2418.5 lib/dpl/provider/rubygems.rb
dpl-1.8.45.travis.2417.5 lib/dpl/provider/rubygems.rb
dpl-1.8.44 lib/dpl/provider/rubygems.rb
dpl-1.8.45.travis.2398.5 lib/dpl/provider/rubygems.rb
dpl-1.8.44.travis.2397.5 lib/dpl/provider/rubygems.rb