I have an existing .rake file. It used to have one task and I added one more task to the existing rake file.
But when I try to run, it throws an error:
rake aborted!
Don't know how to build task ___
abc.rake
file:
namespace abcd
namespace abcde
task pqr do
------------------
end
task mno do ( new task which I added)
---------------------
end
end
end
But when I used command: rake abcd:abcde:mno
-- it showed above error
So I used rake -T -A
, I am able to see the rake task abcd:abcde:pqr
but am unable to see the other one.
I am new to rails. Please help me out.
Thanks in advance.
Go to Websites & Domains and click Ruby. After gems installation you can try to run a Rake task by clicking Run rake task. In the opened dialog, you can provide some parameters and click OK - this will be equivalent to running the rake utility with the specified parameters in the command line.
Rake is a software task management and build automation tool created by Jim Weirich. It allows the user to specify tasks and describe dependencies as well as to group tasks in a namespace. It is similar in to SCons and Make.
You can get a list of Rake tasks available to you, which will often depend on your current directory, by typing rake --tasks . Each task has a description, and should help you find the thing you need.
In Rails 6.x you have to use rails instead of rake. The example from user400617 above
namespace :abcd do
namespace :abcde do
task :pqr do
puts 'Inside PQR'
end
task :new_added_task do
puts 'Inside New Added Task'
end
task :mno => [:new_added_task] do
puts 'Inside Mno'
end
end
end
would be run like this
rails abcd:abcde:pqr # Output => Inside PQR
rails abcd:abcde:mno # Output => Inside New Added Task
# Inside Mno
rails abcd:abcde:new_added_task # Output => Inside New Added Task
Took me a while to figure this out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With