Sha256: 2291cf9d38e70d6dd02d939dd61744cafaac9e4bbfe1140058a2224fa7af4abb

Contents?: true

Size: 1.29 KB

Versions: 41

Compression:

Stored size: 1.29 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("#{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

41 entries across 41 versions & 2 rubygems

Version Path
dpl-rubygems-1.10.11 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.11.travis.3499.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.11.travis.3497.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.10 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.9 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.9.travis.3280.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.9.travis.3258.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.8 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.8.travis.3236.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.8.travis.3216.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.8.travis.3178.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7.travis.3177.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7.travis.3151.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7.travis.3128.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7.travis.3125.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7.travis.3126.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.7.travis.3120.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.6.travis.3119.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.6 lib/dpl/provider/rubygems.rb