Reputation: 13414
I know we can run a task from within a rakefile like this:
Rake::Task['my_task'].execute()
How to do the same while passing arguments ?
Upvotes: 0
Views: 34
Reputation: 7246
Provided you have the following task:
task :delete_user, [:name] do |t, args|
puts "#{args.name} is being deleted."
end
You can call it using
Rake::Task['delete_user'].invoke('john')
or
Rake::Task['delete_user'].execute(Rake::TaskArguments.new([:name], ['john']))
Upvotes: 0