Class: SmartMachine::Grids::Terminal::Wetty

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_machine/grids/terminal/wetty.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, host:, ssh_host:) ⇒ Wetty

Returns a new instance of Wetty.



5
6
7
8
9
# File 'lib/smart_machine/grids/terminal/wetty.rb', line 5

def initialize(name:, host:, ssh_host:)
  @name = name
  @host = host
  @ssh_host = ssh_host
end

Instance Method Details

#downerObject



18
19
20
21
22
23
# File 'lib/smart_machine/grids/terminal/wetty.rb', line 18

def downer
  raise "Error: Could not stop container: #{@name}"   unless system("docker stop '#{@name}'", out: File::NULL)
  raise "Error: Could not remove container: #{@name}" unless system("docker rm '#{@name}'", out: File::NULL)

  puts "Stopped & Removed container: #{@name}"
end

#uperObject



11
12
13
14
15
16
# File 'lib/smart_machine/grids/terminal/wetty.rb', line 11

def uper
  raise "Error: Could not create container: #{@name}" unless system(command.compact.join(' '), out: File::NULL)
  raise "Error: Could not start container: #{@name}"  unless system("docker start #{@name}", out: File::NULL)

  puts "Created & Started container: #{@name}"
end