Module: Coque::Runnable

Included in:
Cmd, Pipeline
Defined in:
lib/coque/runnable.rb

Instance Method Summary collapse

Instance Method Details

#log_end(seconds) ⇒ Object



26
27
28
29
30
# File 'lib/coque/runnable.rb', line 26

def log_end(seconds)
  if Coque.logger
    Coque.logger.info("Coque Command: #{self.to_s} finished in #{seconds} seconds.")
  end
end

#log_startObject



32
33
34
35
36
# File 'lib/coque/runnable.rb', line 32

def log_start
  if Coque.logger
    Coque.logger.info("Executing Coque Command: #{self.to_s}")
  end
end

#runObject



17
18
19
20
21
22
23
24
# File 'lib/coque/runnable.rb', line 17

def run
  log_start
  start_time = Time.now
  result = get_result
  end_time = Time.now
  log_end(end_time - start_time)
  result
end

#run!Object



11
12
13
14
15
# File 'lib/coque/runnable.rb', line 11

def run!
  if !success?
    raise "Coque Command Failed: #{self}"
  end
end

#success?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/coque/runnable.rb', line 7

def success?
  run.success?
end

#to_aObject



3
4
5
# File 'lib/coque/runnable.rb', line 3

def to_a
  run.to_a
end