This project is archived and is in readonly mode.
Vendored Gems Not Being Activated With Rake Tasks
Reported by John Dzak | March 10th, 2009 @ 10:24 PM
Observed in rails >=2.3 when rails gems are vendored.
When Rakefile calls boot.rb, load_initializer (for class VendorBoot) will stub gem specs, but will not add_gem_load_paths.
If you have another gem that requires a vendored gem, you will receive an error message like..
rake -T
rake aborted!
can't activate activesupport (>= 2.0.0, runtime), already activated activesupport-2.3.1
Before Fix
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
end
After Fix
def load_initializer
require "#{RAILS_ROOT}/vendor/rails/railties/lib/initializer"
Rails::Initializer.run(:install_gem_spec_stubs)
Rails::Initializer.run(:add_gem_load_paths)
end
Comments and changes to this ticket
-
Matt Jones March 11th, 2009 @ 10:51 AM
- Assigned user set to Matt Jones
It would be more descriptive to run Rails::GemDependency.add_frozen_gem_paths directly, as that's whats accomplished here. Calling add_gem_load_paths implies that config.gem stuff is getting loaded, which is not the case.
I'm curious, however, how you encountered this error. What gems are you using, and do you have 'require' and/or 'gem' statements in your rake tasks?
-
John Dzak March 11th, 2009 @ 04:43 PM
Ah cool, thanks.
So we encounter this error when a rake tasks in our rails project loads another task which is housed in a gem we wrote. That task eventually calls require 'activesupport' and that is where we encounter the problem.
BTW, this will only happen if the 2.3.1 gems that are vendored are not installed in rubygems. We noticed the problem on a machine that only had the 2.2.2 gems installed.
-
Matt Jones March 12th, 2009 @ 09:44 AM
Does add_frozen_gem_paths solve the problem? 2.3 is right around the corner, and it would be good to get a patch in.
-
Repository March 13th, 2009 @ 10:25 AM
- State changed from new to resolved
(from [9d906707bea997016fd370e33e12dbc21cfcc531]) Vendored gem paths now being loaded if they exist [#2204 state:resolved]
Signed-off-by: Pratik Naik pratiknaik@gmail.com http://github.com/rails/rails/co...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Attachments
Referenced by
- 2204 Vendored Gems Not Being Activated With Rake Tasks (from [9d906707bea997016fd370e33e12dbc21cfcc531]) Vendore...