class R::BuildStep

Manages reporting build progress.

Attributes

cmd[RW]

The command to execute. @return [Array<String>]

desc[RW]

The verb describing this step. @return [String]

importance[R]

The command’s importance. @return [Symbol] :low, :medium or :high

out[RW]

The command output. @return [String]

status[RW]

The exit status of the command. @return [Process::Status]

Public Class Methods

new(cmd=[], out="", desc="", status=0) click to toggle source

Constructor

@param cmd [Array<String>] The command executed. @param out [String] The output generated. @param desc [String] A verb describing the event.

# File lib/rub/r/command.rb, line 250
def initialize(cmd=[], out="", desc="", status=0)
        @cmd    = cmd
        @out    = out
        @desc   = desc
        @status = status
        
        # For some reason self is needed.
        self.importance = :high
end

Public Instance Methods

format_cmd(cmd) click to toggle source

Format the command.

Format’s the command in the prettiest way possible. Theoretically this command could be pasted into a shell and execute the desired command.

@param cmd [Array<String>] The command.

# File lib/rub/r/command.rb, line 267
def format_cmd(cmd)
        cmd.map do |e|
                if /[~`!#$&*(){};'"]/ =~ e
                        "'#{e.sub(/['"]/, '\\\1')}'"
                else
                        e
                end
        end.join(' ')
end
importance=(i) click to toggle source

Set the command’s importance. @param i [Symbol] :low, :medium or :high @return [Symbol] i

# File lib/rub/r/command.rb, line 230
def importance=(i)
        @importance = i
        case i
                when :low
                        @importancei = 1
                when :med
                        @importancei = 2
                when :high
                        @importancei = 3
                else
                        $stderr.puts "Unknown importance #{i.inspect}, defaulting to :high."
                        @importancei = 3
        end
end
print() click to toggle source

Print the result.