I'm calling a rake task within a task and I'm running into a roadblock when it comes to calling execute
response = Rake::Task["stuff:sample"].execute[:match => "HELLO"]
or
response = Rake::Task["stuff:sample"].execute[:match => "HELLO",:freq=>'100']
Calling task
task :sample, [:match,:freq] => :environment do |t, args|
The error I get back is 'can't convert Hash into Integer'
Any ideas?
I think the problem is in code you're not posting. Works fine for me:
james@James-Moores-iMac:/tmp$ head r.rb call.rb
==> r.rb <==
task :sample, [:match,:freq] do |t, args|
puts "hello world"
puts args[:match]
end
==> call.rb <==
require 'rubygems'
require 'rake'
load 'r.rb'
Rake::Task["sample"].execute :match => "HELLO"
james@James-Moores-iMac:/tmp$ ruby call.rb
hello world
HELLO
james@James-Moores-iMac:/tmp$
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