Class: GR::Run

Inherits:
Object
  • Object
show all
Defined in:
lib/git_en_masse/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(cmd) ⇒ Run

Returns a new instance of Run.



5
6
7
# File 'lib/git_en_masse/runner.rb', line 5

def initialize(cmd)
  @command = cmd
end

Instance Method Details

#cmd(path) ⇒ Object



9
10
11
12
13
# File 'lib/git_en_masse/runner.rb', line 9

def cmd(path)
  `cd #{path} 2>&1 ; #{@command} > /dev/null 2>&1`
  code = $?
  return code.to_i
end

#goObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/git_en_masse/runner.rb', line 16

def go
  path = GR::Dirs.current
  puts "\nStarting in #{path}\n".colorize(:green)
  puts "Will run #{@command}\n".colorize(:green)

  GR::Dirs.listing(path).each do |dir|
    result = self.cmd("#{path}/#{dir}")
    if result == 0
      printf(GR::FORMAT_OK, "#{dir}", "\u2713")
    else
      printf(GR::FORMAT_FATAL, "#{dir}", "\u2620")
    end
  end

end