Class: Standup::Scripts::Node

Inherits:
Base
  • Object
show all
Defined in:
lib/standup/scripts/node.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#params

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#name, #script_file, #with_processed_file

Constructor Details

#initialize(node) ⇒ Node

Returns a new instance of Node.



4
5
6
7
8
9
# File 'lib/standup/scripts/node.rb', line 4

def initialize node
  super
  merge_params node.params[name]
  @node = node
  @remoting = nil
end

Instance Attribute Details

#nodeObject

Returns the value of attribute node.



18
19
20
# File 'lib/standup/scripts/node.rb', line 18

def node
  @node
end

Class Method Details

.executeObject



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/standup/scripts/node.rb', line 24

def self.execute
  all_nodes = Settings.nodes.keys
  
  nodes = if all_nodes.length > 1
    node_args = argument('<node[,node]>', 'node', ['all'] + all_nodes).strip.split(',')
    
    if node_args.include? 'all'
      all_nodes
    else
      node_args
    end
  else
    all_nodes
  end
  
  run_on_nodes nodes
end

.run_on_nodes(nodes) ⇒ Object



42
43
44
# File 'lib/standup/scripts/node.rb', line 42

def self.run_on_nodes nodes
  nodes.each {|node| Standup::Node.new(node).run_script name}
end

Instance Method Details

#put_titleObject



20
21
22
# File 'lib/standup/scripts/node.rb', line 20

def put_title
  bright_p "#{@node.name}:#{name}", HighLine::CYAN
end