Sha256: 55058f7ff8de2a24d25a21f50e51e0f40d474c92d697d5bb909a3df72f8117c0

Contents?: true

Size: 559 Bytes

Versions: 5

Compression:

Stored size: 559 Bytes

Contents

require 'multi_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 = ::MultiJson.load(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

5 entries across 5 versions & 1 rubygems

Version Path
serverspec-2.7.0 lib/serverspec/type/docker_base.rb
serverspec-2.6.0 lib/serverspec/type/docker_base.rb
serverspec-2.5.0 lib/serverspec/type/docker_base.rb
serverspec-2.4.0 lib/serverspec/type/docker_base.rb
serverspec-2.3.1 lib/serverspec/type/docker_base.rb