Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Override rake release task to use Gemfury

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
like image 815
Pierre-Louis Gottfrois Avatar asked Aug 14 '13 10:08

Pierre-Louis Gottfrois


1 Answers

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...
like image 127
Pierre-Louis Gottfrois Avatar answered Oct 20 '22 12:10

Pierre-Louis Gottfrois