Using hoe and jeweler for rubyforge and github

24.06.2009 – 18:54

I asked myself how to get started using github as a development platform but still support rubyforge as the main server for stable gem versions?

First I tried to use only hoe but did not get a gemspec file out of it. So I added jeweler to get a gemspec via the rake target gemspec but did not want to configure hoe and jeweler separate. So I used the hoe generated gemspec object to initialize jeweler and thought that it was a good solution.

But then I stumbled upon the best solution, hoe supports the generation of gemspecs only the target name is a bit akward. Just call rake with the command rake debug_gem as recommended on github.

The previous solution combining hoe and jeweler

The rake file:

require 'rubygems'
require 'hoe'
require 'yourgem'

hoe = Hoe.spec 'yourgem' do |p|
  # self.rubyforge_name = 'yourgemx' # if different than 'yourgem'
  p.developer('Yourname', 'yourmail@example.com')
  p.remote_rdoc_dir = '' # Release to root only one project
  p.extra_deps << yourdeps
  File.open(File.join(File.dirname(__FILE__), 'VERSION'), 'w') do |file|
    file.puts Yourgem::VERSION
  end
end

begin
  require 'jeweler'
  Jeweler::Tasks.new(hoe.spec)
rescue LoadError
  puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
end

Post a Comment