Class: Standup::Node
- Inherits:
-
Object
- Object
- Standup::Node
- Defined in:
- lib/standup/node.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#scripts ⇒ Object
readonly
Returns the value of attribute scripts.
Instance Method Summary collapse
- #id_group ⇒ Object
-
#initialize(name) ⇒ Node
constructor
A new instance of Node.
- #instance ⇒ Object
- #params ⇒ Object
- #remoting ⇒ Object
- #run_script(script_name) ⇒ Object
- #ssh_string ⇒ Object
Constructor Details
#initialize(name) ⇒ Node
Returns a new instance of Node.
5 6 7 8 9 10 11 12 13 |
# File 'lib/standup/node.rb', line 5 def initialize name @name = name @scripts = ActiveSupport::HashWithIndifferentAccess.new Standup.scripts.each do |sname, script| @scripts[sname] = script.new self end @remoting = nil end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
15 16 17 |
# File 'lib/standup/node.rb', line 15 def name @name end |
#scripts ⇒ Object (readonly)
Returns the value of attribute scripts.
15 16 17 |
# File 'lib/standup/node.rb', line 15 def scripts @scripts end |
Instance Method Details
#id_group ⇒ Object
40 41 42 |
# File 'lib/standup/node.rb', line 40 def id_group "standup_node_#{@name}" end |
#instance ⇒ Object
23 24 25 |
# File 'lib/standup/node.rb', line 23 def instance @instance ||= EC2::Instance.group_running[id_group].try(:first) end |
#params ⇒ Object
32 33 34 |
# File 'lib/standup/node.rb', line 32 def params Settings.nodes[@name] || ActiveSupport::HashWithIndifferentAccess.new end |
#remoting ⇒ Object
36 37 38 |
# File 'lib/standup/node.rb', line 36 def remoting @remoting ||= Remoting.new self end |
#run_script(script_name) ⇒ Object
17 18 19 20 21 |
# File 'lib/standup/node.rb', line 17 def run_script script_name scripts[script_name].put_title scripts[script_name].run close_remoting end |
#ssh_string ⇒ Object
27 28 29 30 |
# File 'lib/standup/node.rb', line 27 def ssh_string return '' unless instance "ssh -i #{Settings.aws.keypair_file} -C -q -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null #{scripts.ec2.params.ssh_user}@#{instance.external_ip}" end |