For creating rake tasks, you need to first create a namespace.The following
is an example of how to do what you want to do :
namespace :tasks do
desc "try rake"
task :one => :environment do
puts "task one"
end
end
Once you have this in your try.rake file in /lib/tasks
when you do a rake -T , it will show you your custom rake tasks in the
following way :
rake tasks:one
and that is how you need to call it to execute the rake task as well.
I hope that helps.
Thanks & Regards,
Dhruva Sagar.
Marie von
Ebner-Eschenbach<http://www.brainyquote.com/quotes/authors/m/marie_von_ebnereschenbac.html>
- "Even a stopped clock is right twice a day."
On Mon, Aug 31, 2009 at 11:29 AM, kevin lee <
[email protected]> wrote:
>
> I am trying to write a custom rake task for my app. But however simple
> my rake task is, rake -T still does not list it. Here's my file in
> /lib/tasks called try.rake:
>
> desc "try rake"
> task :one do
> puts "task one"
> end
>
> and therefore when I run rake try.one I get the "Don't know how to build
> task 'try,one'... Anything else need to be configured to get custom
> rake task to work?
> Please help. Thanks!
> --
> 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
-~----------~----~----~----~------~----~------~--~---