Class: Rubu::Action

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

Overview

Build activity.

Direct Known Subclasses

Build, Flow, RubyCommand, ShellCommand

Constant Summary

@@host =
[]

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Action) initialize

Returns a new instance of Action



63
64
65
66
67
68
69
# File 'lib/rubu.rb', line 63

def initialize
    @status = :success
    @errmsg = nil
    @output = nil

    @subs = []
end

Instance Attribute Details

- (Object) errmsg (readonly)

Storage for error message.



55
56
57
# File 'lib/rubu.rb', line 55

def errmsg
  @errmsg
end

- (Object) output (readonly)

Command output.



58
59
60
# File 'lib/rubu.rb', line 58

def output
  @output
end

- (Object) status (readonly)

Status after execution.



52
53
54
# File 'lib/rubu.rb', line 52

def status
  @status
end

- (Object) subs (readonly)

Sub actions.



61
62
63
# File 'lib/rubu.rb', line 61

def subs
  @subs
end

Instance Method Details

- (Object) display(msg)

Display command output.



104
105
106
107
# File 'lib/rubu.rb', line 104

def display( msg )
    @output = msg
    STDOUT.puts @output
end

- (Object) error(msg)

Report (and store) error.



98
99
100
101
# File 'lib/rubu.rb', line 98

def error( msg )
    @errmsg = msg
    STDERR.puts "Rubu Error: #{@errmsg}"
end

- (Object) host

Current host.



93
94
95
# File 'lib/rubu.rb', line 93

def host
    @@host[-1]
end

- (Object) host_in

Push host.



83
84
85
# File 'lib/rubu.rb', line 83

def host_in
    @@host.push self
end

- (Object) host_out

Pop host.



88
89
90
# File 'lib/rubu.rb', line 88

def host_out
    @@host.pop
end

- (Object) pick(flow)

Take flow into use.



78
79
80
# File 'lib/rubu.rb', line 78

def pick( flow )
    Flow[ flow ].use
end

- (Object) use

Register Action to host (upper level).



72
73
74
75
# File 'lib/rubu.rb', line 72

def use
    host.subs.push( self ) if host
    self
end