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
zuora_connect_ui-0.10.0 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.9.2 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.9.1 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.9.0 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.13 lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.8.3 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.8.2 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.8.1 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.8.0 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.13.travis.4159.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.13.travis.4141.5 lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.7.1 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
zuora_connect_ui-0.7.0 vendor/ruby/2.6.0/gems/dpl-rubygems-1.10.12/lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.13.travis.4040.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.13.travis.4033.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.12 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.12.travis.4032.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.12.travis.3794.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.12.travis.3506.5 lib/dpl/provider/rubygems.rb
dpl-rubygems-1.10.11.travis.3504.5 lib/dpl/provider/rubygems.rb