So I'm writing a small gem and I have a '/tasks' dir in it with some specific rake tasks. How do I make those tasks available automatically everywhere, where the gem is required? For example I wish I could run 'rake mygemrake:task' inside my rails root dir after I have the gem installed.
A:
You have to import those tasks in application's Rakefile. This is how it looks in mine (I am using bundler08 to manage my gems):
%w(gem1 gem2 gem3).each do |g|
Dir[File.dirname(__FILE__) + "/vendor/bundler_gems/**/#{g}*/tasks/*.rake"].each do |f|
import f
end
end
skalee
2010-07-28 16:34:09