Class: Scatter::Node
- Inherits:
-
Object
- Object
- Scatter::Node
- Defined in:
- lib/scatter/node.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#remote ⇒ Object
readonly
Returns the value of attribute remote.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #encode_for_config ⇒ Object
- #full_name ⇒ Object
-
#initialize(remote, name, username, hostname) ⇒ Node
constructor
A new instance of Node.
- #list ⇒ Object
- #push(gemfile) ⇒ Object
Constructor Details
#initialize(remote, name, username, hostname) ⇒ Node
Returns a new instance of Node.
5 6 7 |
# File 'lib/scatter/node.rb', line 5 def initialize(remote, name, username, hostname) @remote, @name, @username, @hostname = remote, name, username, hostname end |
Instance Attribute Details
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
3 4 5 |
# File 'lib/scatter/node.rb', line 3 def hostname @hostname end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/scatter/node.rb', line 3 def name @name end |
#remote ⇒ Object (readonly)
Returns the value of attribute remote.
3 4 5 |
# File 'lib/scatter/node.rb', line 3 def remote @remote end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
3 4 5 |
# File 'lib/scatter/node.rb', line 3 def username @username end |
Class Method Details
.decode_from_config(remote, name, config) ⇒ Object
23 24 25 |
# File 'lib/scatter/node.rb', line 23 def self.decode_from_config(remote, name, config) new(remote, name, config['username'], config['hostname']) end |
Instance Method Details
#encode_for_config ⇒ Object
27 28 29 30 31 32 |
# File 'lib/scatter/node.rb', line 27 def encode_for_config { 'username' => @username, 'hostname' => @hostname } end |
#full_name ⇒ Object
9 10 11 |
# File 'lib/scatter/node.rb', line 9 def full_name [remote.name, name].join('/') end |
#list ⇒ Object
13 14 15 |
# File 'lib/scatter/node.rb', line 13 def list Scatter::Gemlist.parse(Scatter::Shell.capture("ssh #{@username}@#{@hostname} gem list")) end |
#push(gemfile) ⇒ Object
17 18 19 20 21 |
# File 'lib/scatter/node.rb', line 17 def push(gemfile) Scatter::Shell.execute "scp #{gemfile} #{@username}@#{@hostname}:/tmp" Scatter::Shell.execute "ssh #{@username}@#{@hostname} sudo gem install /tmp/#{File.basename(gemfile)} --no-ri --no-rdoc" Scatter::Shell.execute "ssh #{@username}@#{@hostname} scatter receive /tmp/#{File.basename(gemfile)}" end |