Forum: Ruby Creating custom lib/tasks folder for rake files?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
6dcecfbe0dc75b6fb483f771432f5b35?d=identicon&s=25 andreux (Guest)
on 2009-01-08 00:24
(Received via mailing list)
How can I setup my own lib/tasks folder (similar to rails) so that all
tasks in this folder are available when running rake?

Everything I've tried so far has been unsuccessful. I get errors even
when trying to require a single .rake file from my main Rakefile:

require 'sitemap.rake'

> rake aborted!
> no such file to load -- sitemap.rake

Any suggestions?
De5a4777d1c1ceb64a229b56038ac9b7?d=identicon&s=25 Robert Evans (Guest)
on 2009-01-08 00:53
(Received via mailing list)
Add your rake tasks to lib/tasks and they should automatically be
picked up when you are in the rails root at the command line.

Just do rake -T to see all your rake tasks.

Robert Evans
http://www.codewranglers.org
http://www.robertrevans.com
A8486651a974d7d9ecc35d25de96c7ee?d=identicon&s=25 Chris Lowis (chrislo)
on 2009-01-08 01:03
> Any suggestions?

Something like this at the top of your Rakefile, perhaps?

Dir["#{File.dirname(__FILE__)}/lib/tasks/*.rake"].sort.each { |ext| load
ext }


Chris
Bee69cfed999cd13e3bff73d472a39ee?d=identicon&s=25 Hassan Schroeder (Guest)
on 2009-01-08 01:15
(Received via mailing list)
On Wed, Jan 7, 2009 at 3:24 PM, andreux <ethergraphics@gmail.com> wrote:
> How can I setup my own lib/tasks folder (similar to rails) so that all
> tasks in this folder are available when running rake?

`rake --help` is pretty informative :-)

The output includes:

    -g, --system                     Using system wide (global)
rakefiles (usually '~/.rake/*.rake').

:: as well as some other interesting possibilities.

HTH!
This topic is locked and can not be replied to.