6

I'm hosting a private gem on Gemfury and would like to override rake release task to push to my Gemfury private URL instead of Rubygems.

I'de like to keep the Git tag creation though.

Any ideas where I should begin to?

Here is what my Rakefile looks like:

require 'bundler/gem_tasks'
require 'rspec/core/rake_task'

RSpec::Core::RakeTask.new(:spec)

task default: :spec
task test:    :spec
4

1 回答 1

6

Actually found the answer:

Rakefile

require 'bundler/gem_tasks'
require 'rubygems/builder'
require 'gemfury'
require 'gemfury/command'

# Override rubygem_push to push to gemfury instead when doing `rake release`
module Bundler
  class GemHelper
    def rubygem_push(path)
      ::Gemfury::Command::App.start(['push', path])
    end
  end
end

Now when doing:

rake release

It create git tags and push to my Gemfury private gem repository.

You'll want to create a file in ~/.gem/gemfury with your secret key:

---
:gemfury_api_key: 1H...
于 2013-08-16T17:28:18.620 回答