Sha256: 07f7bbbb541ff1a352626f280f57e67e6fdfd7b49718a32846d8f4b5e9eeaf99

Contents?: true

Size: 743 Bytes

Versions: 6

Compression:

Stored size: 743 Bytes

Contents

module Nib::Command
  def self.included(base)
    base.instance_eval do
      attr_reader :service, :command, :options

      extend ClassMethods
    end
  end

  module ClassMethods
    def execute(args, options = '')
      new(args.shift, args.join(' '), options).execute
    end
  end

  def initialize(service, command, options = '')
    @service = service
    @command = command
    @options = options
  end

  def execute
    exec(script)
  end

  def script
    @script ||= <<-SCRIPT
      docker-compose \
        #{alternate_compose_file} \
        run \
        --rm \
        #{entrypoint} \
        #{options} \
        #{service} \
        #{command}
    SCRIPT
  end

  def alternate_compose_file; end

  def entrypoint; end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nib-2.1.1 lib/nib/command.rb
nib-2.1.0 lib/nib/command.rb
nib-2.0.2 lib/nib/command.rb
nib-2.0.1 lib/nib/command.rb
nib-2.0.0 lib/nib/command.rb
nib-1.7.0 lib/nib/command.rb