Class: Scatter::Commands::Node::Add
- Inherits:
-
SubCommand
- Object
- SubCommand
- Scatter::Commands::Node::Add
- Defined in:
- lib/scatter/commands/node/add.rb
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(out, remote_name, node, credentials) ⇒ Add
constructor
A new instance of Add.
Constructor Details
#initialize(out, remote_name, node, credentials) ⇒ Add
Returns a new instance of Add.
5 6 7 8 |
# File 'lib/scatter/commands/node/add.rb', line 5 def initialize(out, remote_name, node, credentials) super(out) @remote_name, @node, @credentials = remote_name, node, credentials end |
Instance Method Details
#execute! ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/scatter/commands/node/add.rb', line 10 def execute! remote = Scatter::Config.find_remote(@remote_name) raise CommandLineError, "Unknown remote #{@remote_name}" unless remote raise CommandLineError, "Remote #{@remote_name} already has node #{@node}" if remote.find_node(@node) remote.nodes << Scatter::Node.new(remote, @node, *(@credentials.split('@'))) Scatter::Config.save! end |