Matt Jones wrote:
> Troels - I'd recommend that you look for the same kind of thing in
> your Rakefiles.

Indeed - I had a rake task in `lib/tasks/` that included 
`config/environment.rb`. Thanks for your help.

Ari Maniatis wrote:
> * rake gems:install should not try to load all the rake tasks since it
> has a very specific job to do and should not be sidetracked by loading
> everything it comes across on the class path

That's not possible. Rake works by finding files with the name *.task 
and then loading them. If these files try to invoke gems at load-time, 
there is nothing rake can do. It's a fundamentally design 
flaw/limitation of rake.

> * better error reporting which detects this condition and reports
> where the problem might lie

Would definitely be nice with a trace that points to the error.

An solution could also be to move the `config.gem` lines from 
`config/environment.rb` into a separate file (Say - 
`config/gemconf.rb`), and then include it in the config file. This would 
make it possible to write a script in `script/`, that loads this config 
file and invokes gem for each dependency. Since it doesn't depend on 
rake, it wouldn't have the load-time-dependencies problem.

The reason I'm suggesting this is that some times you really need 
load-time dependencies in your rake tasks; Namely if your task extends 
some generic task, present in a gem. For example, installing the 
`rails_rcov` plugin [1] will cause an error if you don't have the `rcov` 
gem installed, since the task depends on the file `rcov/rcovtask`. 
Having a script that didn't use rake, would solve this problem entirely.

Might the rails developers be interested in a patch for this?

[1] http://svn.codahale.com/rails_rcov

--
troels
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to