Class: Rubu::RubyCommand

Inherits:
Move
  • Object
show all
Defined in:
lib/rubu.rb

Overview

Ruby based command.

Instance Attribute Summary

Attributes inherited from Move

#errmsg, #output, #status, #subs

Instance Method Summary collapse

Methods inherited from Move

#display, #error, #host, #host_in, #host_out, #use, #warn

Constructor Details

#initialize(desc = nil, &cmd) ⇒ RubyCommand

Returns a new instance of RubyCommand



169
170
171
172
173
# File 'lib/rubu.rb', line 169

def initialize( desc = nil, &cmd )
    super()
    @desc = desc
    @cmd = cmd
end

Instance Method Details

#runObject

Execution content.



176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/rubu.rb', line 176

def run
    begin
        ret = instance_eval( &@cmd ) unless Order[ :noop ]
        @status = :success
        if @desc && Order[ :verbose ]
            STDOUT.puts @desc
        end
    rescue => f
        @status = :error
        error( f.backtrace.join("\n") )
    end

    self
end