Sha256: 443602bf965db5a9114addf9740eeaf8fd120cb048f680c1b41b40ac53400913

Contents?: true

Size: 1.3 KB

Versions: 95

Compression:

Stored size: 1.3 KB

Contents

require 'gems'

module DPL
  class Provider
    class RubyGems < Provider
      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 "for f in #{gemspec_glob}; do gem build $f; done"
        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

      def gemspec_glob
        options[:gemspec_glob] || "#{gemspec || option(:gem)}.gemspec"
      end
    end
  end
end

Version data entries

95 entries across 95 versions & 1 rubygems

Version Path
dpl-rubygems-1.10.6.travis.3114.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.6.travis.3090.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.5.travis.3089.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.5.travis.3069.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.5.travis.3062.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3055.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3054.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3053.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3047.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3040.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3032.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3030.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.3.travis.3021.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.3 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.4.travis.3022.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.3.travis.3020.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.3.travis.3017.6 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.3.travis.3014.6 lib/dpl/provider/rubygems.rb