Class: Raykit::Command

Inherits:
Object
  • Object
show all
Defined in:
lib/raykit/command.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#log_levelObject

Returns the value of attribute log_level.



5
6
7
# File 'lib/raykit/command.rb', line 5

def log_level
  @log_level
end

Instance Method Details

#run(command) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/raykit/command.rb', line 6

def run(command) 
    timer = Timer.new
    exit,exit,exit = Open3.capture3(command)
    if(exit == 0)#system(command))

        puts timer.elapsed_str + " " +  Rainbow(command).yellow.bright
        return timer.elapsed_str + " " + command
    else
        puts "\r\n" + command + "\r\n"
        system(command)
        puts ''
        abort Rainbow(timer.elapsed_str).red.bright + " " +  Rainbow(command).white
    end
end