CommandExecuter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 15
Duplicated Lines 0 %
Metric Value
wmc 3
dl 0
loc 15
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute! 0 7 2
A execute() 0 4 1
1
module Carrasco
2
  class CommandExecuter
3
    CommandError = Class.new(StandardError)
4
    def execute(command)
5
      system(command.to_s)
6
      $?.exitstatus
7
    end
8
9
    def execute!(command)
10
      code = execute(command)
11
12
      unless code == 0
13
        raise CommandError.new("Command '#{command}' exited with code #{code}")
14
      end
15
    end
16
  end
17
end
18