This project is archived and is in readonly mode.

#510 ✓duplicate
Josh Nichols

Rake tasks not included for gems

Reported by Josh Nichols | June 30th, 2008 @ 12:32 AM | in 2.x

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',
  Dir["#{gem_dir}/#{gem.lib ||}/tasks/**/*.rake"].sort.each { |ext| load ext }

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

Shared Ticket Bins