Sha256: bda8682fe77270509043f0178c9193154fc82e42d93346fb69f83fdf8089cd63

Contents?: true

Size: 927 Bytes

Versions: 8

Compression:

Stored size: 927 Bytes

Contents

require "rake"

##
# Gemcutter plugin for hoe.
#
# === Extra Configuration Options:
#
# otp_command:: Shell command to run to populate GEM_HOST_OTP_CODE.

module Hoe::Gemcutter
  include Rake::DSL if defined?(Rake::DSL)

  Hoe::DEFAULT_CONFIG["otp_command"] = false

  def gem_push gems
    with_config do |config, _|
      otp_command = config["otp_command"]

      ENV["GEM_HOST_OTP_CODE"] = `#{otp_command}`.chomp if otp_command
    end

    gems.each do |g|
      sh Gem.ruby, "-S", "gem", "push", g
    end
  end

  ##
  # Define release_to_gemcutter and attach it to the release task.

  def define_gemcutter_tasks
    desc "Push gem to gemcutter."
    task :release_to_gemcutter => [:clean, :package, :release_sanity] do
      pkg   = "pkg/#{spec.name}-#{spec.version}"
      gems  = Dir["#{pkg}*.gem"]

      gem_push gems
    end

    task :release_to => :release_to_gemcutter
  end
end unless defined? Hoe::Gemcutter

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hoe-4.0.5 lib/hoe/gemcutter.rb
hoe-4.0.4 lib/hoe/gemcutter.rb
hoe-4.0.3 lib/hoe/gemcutter.rb
hoe-4.0.2 lib/hoe/gemcutter.rb
hoe-4.0.1 lib/hoe/gemcutter.rb
hoe-4.0.0 lib/hoe/gemcutter.rb
hoe-3.26.0 lib/hoe/gemcutter.rb
hoe-3.25.0 lib/hoe/gemcutter.rb