Sha256: e02c31330576fd7de2235d3fee22e6bca0d8d8d54542ce1bb403ec978c70862c

Contents?: true

Size: 886 Bytes

Versions: 97

Compression:

Stored size: 886 Bytes

Contents

module Gitlab
  module QA
    module Docker
      class Command
        attr_reader :args

        def initialize(cmd = nil)
          @args = Array(cmd)
        end

        def <<(*args)
          tap { @args.concat(args) }
        end

        def volume(from, to, opt = :z)
          tap { @args.push("--volume #{from}:#{to}:#{opt}") }
        end

        def name(identity)
          tap { @args.push("--name #{identity}") }
        end

        def env(name, value)
          tap { @args.push(%(--env #{name}="#{value}")) }
        end

        def to_s
          "docker #{@args.join(' ')}"
        end

        def ==(other)
          to_s == other.to_s
        end

        def execute!(&block)
          Docker::Shellout.new(self).execute!(&block)
        end

        def self.execute(cmd, &block)
          new(cmd).execute!(&block)
        end
      end
    end
  end
end

Version data entries

97 entries across 97 versions & 1 rubygems

Version Path
gitlab-qa-5.5.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.4.3 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.4.2 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.4.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.4.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.3.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.2.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.1.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.1.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.0.3 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.0.2 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.0.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.20.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.19.3 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.19.2 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.19.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.19.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.18.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.17.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-4.16.0 lib/gitlab/qa/docker/command.rb