Module: R2OAS::TaskLogging

Defined in:
lib/r2-oas/task_logging.rb

Instance Method Summary collapse

Instance Method Details

#task(*args, &block) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/r2-oas/task_logging.rb', line 6

def task(*args, &block)
  Rake::Task.define_task(*args) do |task|
    if block_given?
      debug_log task, "[#{task.name}] started"
      begin
        block.call(task)
        debug_log task, "[#{task.name}] finished"
      rescue StandardError => e
        debug_log task, "[#{task.name}] failed"
        raise e
      end
    end
  end
end