Sha256: 011eb38c6b07e7d64e730e4ffa60133b0a86040c534fd5a42b85d3344562bc3e

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

require 'json'

module Serverspec::Type
  class DockerBase < Base
    def exist?
      get_inspection.success?
    end

    def [](key)
      value = inspection
      key.split('.').each do |k|
        value = value[k]
      end
      value
    end

    def inspection
      return @inspection if @inspection
      @inspection = JSON.parse(get_inspection.stdout)[0]
    end

    private
    def get_inspection
      return @get_inspectiob if @get_inspection
      @get_inspection = @runner.run_command("docker inspect #{@name}")
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
serverspec-2.3.0 lib/serverspec/type/docker_base.rb