Class: Rake::Application
- Inherits:
-
Object
- Object
- Rake::Application
- Defined in:
- lib/webby/apps/main.rb
Overview
:stopdoc: Monkey patches so that rake displays the correct application name in the help messages.
Instance Method Summary collapse
- #display_prerequisites ⇒ Object
- #display_tasks_and_comments ⇒ Object
-
#standard_exception_handling ⇒ Object
Provide standard execption handling for the given block.
Instance Method Details
#display_prerequisites ⇒ Object
200 201 202 203 204 205 |
# File 'lib/webby/apps/main.rb', line 200 def display_prerequisites tasks.each do |t| puts "#{name} #{t.name}" t.prerequisites.each { |pre| puts " #{pre}" } end end |
#display_tasks_and_comments ⇒ Object
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/webby/apps/main.rb', line 207 def display_tasks_and_comments displayable_tasks = tasks.select { |t| t.comment && t.name =~ .show_task_pattern } if .full_description displayable_tasks.each do |t| puts "#{name} #{t.name_with_args}" t.full_comment.split("\n").each do |line| puts " #{line}" end puts end else width = displayable_tasks.collect { |t| t.name_with_args.length }.max || 10 max_column = truncate_output? ? terminal_width - name.size - width - 7 : nil displayable_tasks.each do |t| printf "#{name} %-#{width}s # %s\n", t.name_with_args, max_column ? truncate(t.comment, max_column) : t.comment end end end |
#standard_exception_handling ⇒ Object
Provide standard execption handling for the given block.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
# File 'lib/webby/apps/main.rb', line 230 def standard_exception_handling begin yield rescue SystemExit => ex # Exit silently with current status exit(ex.status) rescue SystemExit, OptionParser::InvalidOption => ex # Exit silently exit(1) rescue Exception => ex # Exit with error message $stderr.puts "#{name} aborted!" $stderr.puts ex. if .trace $stderr.puts ex.backtrace.join("\n") else $stderr.puts ex.backtrace.find {|str| str =~ /#{@rakefile}/ } || "" $stderr.puts "(See full trace by running task with --trace)" end exit(1) end end |