Class: BatchManager::Executor

Inherits:
Object
  • Object
show all
Includes:
Utils
Defined in:
lib/batch_manager/executor.rb

Class Method Summary collapse

Methods included from Utils

included

Class Method Details

.exec(batch_file, options = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/batch_manager/executor.rb', line 6

def exec(batch_file, options = {})
  @batch_file_path = batch_full_path(batch_file)
  if File.exist?(@batch_file_path)
    @batch_status = BatchManager::BatchStatus.new(@batch_file_path)
    @wet = options[:wet]
    @disable_stdout = options[:daemon]
    if options[:force] || !@wet || @batch_status.can_run?
      log_run_duration { exec_batch_script }
    else
      raise "Cannot run this batch."
    end
  else
    raise "File not exist."
  end
end