Sha256: ec4e77040d50b0beeb18922e90c30bcd6813759a2618f2a63241c14bf1444a25

Contents?: true

Size: 728 Bytes

Versions: 5

Compression:

Stored size: 728 Bytes

Contents

module Minke
  module Docker
    class Network
      def initialize network_name, shell_runner
        @network_name = network_name
        @shell_runner = shell_runner
        @created_network = false
      end

      def create
        if find_network.to_s == ''
          @shell_runner.execute("docker network create #{@network_name}") 
          @created_network = true
        end
      end

      def remove
        if find_network.to_s != '' && @created_network == true
          @shell_runner.execute("docker network rm #{@network_name}", true)
        end
      end

      private 
      def find_network
        @shell_runner.execute_and_return("docker network ls | grep #{@network_name}")
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
minke-1.15.0 lib/minke/docker/network.rb
minke-1.14.5 lib/minke/docker/network.rb
minke-1.14.4 lib/minke/docker/network.rb
minke-1.14.3 lib/minke/docker/network.rb
minke-1.14.2 lib/minke/docker/network.rb