JP.
JP.

Reputation: 5594

overriding bundler's release, but without putting it in the gem

I'm using bundler to manage my gem's dependencies, and I'm using geminabox to host my gems once they're ready. Using bundler's rake release is bad news, because my gems will go to rubygems, not to geminabox, however the additional functionality (push a tag etc) from that task are really helpful.

I wrote a gem which adds the ability to rake release geminabox and rake release rubygems, but now my library (which has nothing to do with geminabox) depends on this bundler/geminabox thing, which in turn depends on geminabox, and futher on sinatra, rack... all of a sudden my development requirements are huge and are only specific to my development situation. Some of these gems will be released publicly and these geminabox development dependencies will not be necessary to anyone else.

I realise that injecting a gem into a bundler gemset is specifically what bundler is intended to prevent, so what would you recommend as a way to have my own custom release functionality which is not tied to the gem itself?

Upvotes: 0

Views: 332

Answers (1)

user132447
user132447

Reputation: 1701

I've redefined the default Bundler release task in my gem's Rakefiles along the lines below. You're right that you don't want to suck in Sinatra and a whole bloated stack.

You are left with 2 choices...

  1. write custom rake tasks that do everything you need from scratch
  2. redefine Bundler's default release task, since that's the only bit you want to behave differently.

Rakefile

require "bundler/gem_tasks"

Rake::TaskManager.class_eval do
  def remove_task(task_name)
    @tasks.delete(task_name.to_s)
  end
end
def remove_task(task_name)
  Rake.application.remove_task(task_name)
end

remove_task :release # So we don't publish to rubygems.org
desc "release to geminabox"
task :release => [:build] do |t|
  system "gem inabox"
end

Upvotes: 0

Related Questions