Printing to screen in a rake task
STDOUT.sync = true
verbose rakefile - print all executed command lines to stdout
rake --trace
will probably give you everything you need
Rails how to run rake task
You can run Rake tasks from your shell by running:
rake task_name
To run from from Ruby (e.g., in the Rails console or another Rake task):
Rake::Task['task_name'].invoke
To run multiple tasks in the same namespace with a single task, create the following new task in your namespace:
task :runall => [:iqmedier, :euroads, :mikkelsen, :orville] do
# This will run after all those tasks have run
end
How to get PID of current rake task?
You get the current PID in Ruby with Process.pid
Can I catch errors and continue to next Rake task?
Rake is just Ruby, so you can use Ruby's error handling feature.
namespace :test do
task :migrate do
begin
Rake::Task['A:migrate'].invoke
rescue => e
log(e)
end
Rake::Task['B:migrate'].invoke
end
end
Related Topics
Scientific Programming with Ruby
In Ruby, How to I Control the Order in Which Test::Unit Tests Are Run
What Is a Robust Installation Process for Nokogiri (On Ubuntu)
How to Configure Mongomapper and Activerecord in Same Ruby Rails Project
What's the Fastest Way to Check If a Word from One String Is in Another String
How to Assign Multiple Values to a Hash Key
Using Ruby and Net-Ssh, How to Authenticate Using the Key_Data Parameter with Net::Ssh.Start
How to Use Truly Local Variables in Ruby Proc/Lambda
How to Make Rake Tasks Run Under My Sinantra App/Environment
Ruby on Rails - Differentiating Plural VS Singular Resource in a Rest API
Why Isn't My Cocoapods Post_Install Hook Updating My Preprocessor MACros
How to Profile Ruby 1.9.2 Scripts with Memory Allocation Reports
Ruby on Rails: If Current Page? Is Homepage, Don't Show Form
How to Split a String into Only Two Parts, by the Last Occurrence of the Split Char
How to Get a List of Files That Have Been 'Required' in Ruby
I'm Getting "Found Character That Cannot Start Any Token While Scanning for the Next Token"