Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/whinytasks.rb
Instance Method Summary collapse
Instance Method Details
#whine(subject, message) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/whinytasks.rb', line 6 def whine(subject, ) msg = <<END_OF_MESSAGE From: #{WhinyTasks::CONFIG[:from_alias]} <#{WhinyTasks::CONFIG[:from]}> To: #{WhinyTasks::CONFIG[:to_alias]} <#{WhinyTasks::CONFIG[:to]}> Subject: #{subject} #{} END_OF_MESSAGE Net::SMTP.start('localhost') do |smtp| smtp. msg, WhinyTasks::CONFIG[:from], WhinyTasks::CONFIG[:to] end end |
#whiny_task(deps, &block) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/whinytasks.rb', line 20 def whiny_task(deps, &block) if eval(WhinyTasks::CONFIG[:whine_if]) block_with_exception_handling = Proc.new do begin block.call rescue Exception => e whine(e., e.backtrace.join("\n")) end end task deps, &block_with_exception_handling else task deps, &block end end |