[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Creating custom lib/tasks folder for rake files?

andreux

1/7/2009 11:24:00 PM

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?

3 Answers

Robert Evans

1/7/2009 11:51:00 PM

0

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.codewra...
http://www.robert...

On Jan 7, 2009, at 3:24 PM, andreux 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?
>
> 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?
>


Chris Lowis

1/8/2009 12:04:00 AM

0

> 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
--
Posted via http://www.ruby-....

Hassan Schroeder

1/8/2009 12:15:00 AM

0

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!
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com