I have a Rakefile with a Rake task that I would normally call from the command line:
Rakefile
rake blog:post Title
I\'d like to write a
In a script with Rails loaded (e.g. rails runner script.rb)
rails runner script.rb
def rake(*tasks) tasks.each do |task| Rake.application[task].tap(&:invoke).tap(&:reenable) end end rake('db:migrate', 'cache:clear', 'cache:warmup')