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.15.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.14.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.14.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.7 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.6 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.5 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.4 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.3 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.2 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.13.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.12.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.10.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.10.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.9.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.8.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.8.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.7.0 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.6.1 lib/gitlab/qa/docker/command.rb
gitlab-qa-5.6.0 lib/gitlab/qa/docker/command.rb