Class: SshyGuy::Server
- Inherits:
-
Object
- Object
- SshyGuy::Server
- Defined in:
- lib/sshyguy/server.rb
Class Method Summary collapse
Instance Method Summary collapse
- #command ⇒ Object
- #folder ⇒ Object
- #group ⇒ Object
-
#initialize(config) ⇒ Server
constructor
A new instance of Server.
- #shortcut ⇒ Object
- #spawn ⇒ Object
- #to_label ⇒ Object
Constructor Details
#initialize(config) ⇒ Server
Returns a new instance of Server.
9 10 11 12 |
# File 'lib/sshyguy/server.rb', line 9 def initialize(config) @config = config self.class.all << self end |
Class Method Details
.all ⇒ Object
5 6 7 |
# File 'lib/sshyguy/server.rb', line 5 def self.all @all ||= [] end |
Instance Method Details
#command ⇒ Object
24 25 26 |
# File 'lib/sshyguy/server.rb', line 24 def command @command ||= Command.new(@config) end |
#folder ⇒ Object
28 29 30 |
# File 'lib/sshyguy/server.rb', line 28 def folder @config['folder'].presence || 'Default' end |
#group ⇒ Object
36 37 38 |
# File 'lib/sshyguy/server.rb', line 36 def group @config['group'].presence || 'Default' end |
#shortcut ⇒ Object
32 33 34 |
# File 'lib/sshyguy/server.rb', line 32 def shortcut @config['shortcut'].presence end |
#spawn ⇒ Object
18 19 20 21 22 |
# File 'lib/sshyguy/server.rb', line 18 def spawn SshyGuy.log("Spawning command #{command.to_command}") system(command.to_command) exit end |
#to_label ⇒ Object
14 15 16 |
# File 'lib/sshyguy/server.rb', line 14 def to_label @config['label'] || @config['hostname'] end |