Sha256: 28ee17b003d98f37912a0e54fe04418b7c055e9ca6474f0e13b1897aae51b02f

Contents?: true

Size: 1.17 KB

Versions: 489

Compression:

Stored size: 1.17 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
        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

489 entries across 489 versions & 1 rubygems

Version Path
dpl-1.8.33.travis.2025.5 lib/dpl/provider/rubygems.rb
dpl-1.8.33.travis.1999.5 lib/dpl/provider/rubygems.rb
dpl-1.8.33.travis.1976.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1958.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1957.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1956.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1955.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1950.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1949.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1935.5 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1901.6 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1900.4 lib/dpl/provider/rubygems.rb
dpl-1.8.32.travis.1899.3 lib/dpl/provider/rubygems.rb
dpl-1.8.31.travis.1897.3 lib/dpl/provider/rubygems.rb
dpl-1.8.31.travis.1898.3 lib/dpl/provider/rubygems.rb
dpl-1.8.31 lib/dpl/provider/rubygems.rb
dpl-1.8.31.travis.1895.3 lib/dpl/provider/rubygems.rb
dpl-1.8.31.travis.1892.3 lib/dpl/provider/rubygems.rb
dpl-1.8.31.travis.1882.3 lib/dpl/provider/rubygems.rb