I have a rake task that needs to insert a value into multiple databases.
I\'d like to pass this value into the rake task from the command line, or from another
To run rake tasks with traditional arguments style:
rake task arg1 arg2
And then use:
task :task do |_, args|
puts "This is argument 1: #{args.first}"
end
Add following patch of rake gem:
Rake::Application.class_eval do
alias origin_top_level top_level
def top_level
@top_level_tasks = [top_level_tasks.join(' ')]
origin_top_level
end
def parse_task_string(string) # :nodoc:
parts = string.split ' '
return parts.shift, parts
end
end
Rake::Task.class_eval do
def invoke(*args)
invoke_with_call_chain(args, Rake::InvocationChain::EMPTY)
end
end