Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

Rake tasks not included for gems

#510

I was working on converting a plugin to a gem which had a few Rake tasks. After packaging it as a gem, I noticed it didn't include the Rake tasks for it.

I tracked it down to railties/lib/tasks/rails.rb, and saw that it wasn't actually doing anything for gems.

I could see two ways of dealing with this:

Add a line to tasks/rails like:

Dir["#{RAILS_ROOT}/vendor/gems/*/tasks/**/*.rake"].sort.each { |ext| load ext }

Look for under tasks under the gem's lib, ie foo would look under vendor/gems/foo/lib/foo/tasks/**/*.rake. I imagine it'd look something like:

Rails.configuration.gems.each do |gem|
  gem_dir = File.join(RAILS_ROOT, 'vendor', 'gems', gem.name)
  Dir["#{gem_dir}/#{gem.lib || gem.name}/tasks/**/*.rake"].sort.each { |ext| load ext }
end

Reported by Josh Nichols · June 30th, 2008 @ 12:32 AM

State: duplicate
Milestone: 2.x
Assigned to: nobody
Importance: none

Activity

  1. Josh Nichols
    Josh Nichols
    • Tag changed from gems, rake to gems, patch, rake

    Here's a patch for the first approach.

    June 30th, 2008 @ 12:34 AM

  2. James Healy
  3. josh
    josh
    • State changed from new to duplicate

    September 30th, 2008 @ 05:53 PM