Sha256: ecd58a8f87350d344120ce85733d784c916ba68267dc2a1b17167a3863d66068

Contents?: true

Size: 625 Bytes

Versions: 6

Compression:

Stored size: 625 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 \
        run \
        --rm \
        #{options} \
        #{service} \
        #{command}
    SCRIPT
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nib-1.4.0 lib/nib/command.rb
nib-1.3.0 lib/nib/command.rb
nib-1.2.2 lib/nib/command.rb
nib-1.2.1 lib/nib/command.rb
nib-1.2.0 lib/nib/command.rb
nib-1.1.0 lib/nib/command.rb