Book Image

Rake Task Management Essentials

By : Andrey Koleshko
Book Image

Rake Task Management Essentials

By: Andrey Koleshko

Overview of this book

Table of Contents (18 chapters)
Rake Task Management Essentials
Credits
About the Author
Acknowledgements
About the Reviewers
www.PacktPub.com
Preface
Index

Using command-line arguments for debugging


The main information in the development process is a backtrace—a report of a certain point in time during the execution of a program. When a rake task fails, you won't need the whole backtrace; Rake narrows it in the default behavior. To explain the idea, see the following Rakefile with failed task1:

task :task1 do
  raise 'this is an error'
end

task :task2 => :task1 do
  puts 'task 2'
end

The following is a result of the task2 execution:

$ rake task2
rake aborted!
this is an error
~/rakefile:2:in `block in <top (required)>'
Tasks: TOP => task2 => task1
(See full trace by running task with --trace)

Notice that the backtrace contains only one line of code (~/rakefile:2:in 'block in <top (required)>'). To see the full trace of the code execution, use the --backtrace option:

$ rake --backtrace task2  
rake aborted!
this is an error
~/rakefile1:2:in `block in <top (required)>'
.../ruby/gems/2.1.0/gems/rake-10.1.1/lib/rake/task...