Module: Coque::Runnable

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

Instance Method Summary collapse

Instance Method Details

#log_startObject



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

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

#runObject



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

def run
  log_start
  get_result
end

#run!Object



20
21
22
23
24
25
26
# File 'lib/coque/runnable.rb', line 20

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

#success?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/coque/runnable.rb', line 16

def success?
  run.success?
end

#to_aObject



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

def to_a
  run.to_a
end

#to_a!Object



7
8
9
10
11
12
13
14
# File 'lib/coque/runnable.rb', line 7

def to_a!
  res = run
  rows = res.to_a
  unless res.exit_code == 0
    raise "Coque Command Failed: #{self}"
  end
  rows
end