Class: SmartMachine::Machines::Network
- Defined in:
- lib/smart_machine/machines/network.rb
Instance Method Summary collapse
- #downer ⇒ Object
-
#initialize(name:) ⇒ Network
constructor
A new instance of Network.
- #uper ⇒ Object
Methods inherited from Base
#machine_has_engine_installed?, #platform_on_machine?, #user_bash
Methods included from Logger
configure_logger_for, included, #logger, logger_for
Constructor Details
#initialize(name:) ⇒ Network
Returns a new instance of Network.
4 5 6 7 8 9 10 11 12 |
# File 'lib/smart_machine/machines/network.rb', line 4 def initialize(name:) config = SmartMachine.config.network.dig(name.to_sym) raise "network config for #{name} not found." unless config @driver = config.dig(:driver) @name = name.to_s @home_dir = File.('~') end |
Instance Method Details
#downer ⇒ Object
20 21 22 23 24 |
# File 'lib/smart_machine/machines/network.rb', line 20 def downer raise "Error: Could not remove network: #{@name}" unless system("docker network rm '#{@name}'", out: File::NULL) puts "Removed network: #{@name}" end |
#uper ⇒ Object
14 15 16 17 18 |
# File 'lib/smart_machine/machines/network.rb', line 14 def uper raise "Error: Could not create network: #{@name}" unless system(command.compact.join(' '), out: File::NULL) puts "Created network: #{@name}" end |