Module: Nib::Command

Included in:
CodeClimate, Console, Debug, Exec, Run, Setup, Shell
Defined in:
lib/nib/command.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
# File 'lib/nib/command.rb', line 2

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

    extend ClassMethods
  end
end

Instance Method Details

#alternate_compose_fileObject



39
# File 'lib/nib/command.rb', line 39

def alternate_compose_file; end

#entrypointObject



41
# File 'lib/nib/command.rb', line 41

def entrypoint; end

#executeObject



22
23
24
# File 'lib/nib/command.rb', line 22

def execute
  exec(script)
end

#initialize(service, command, options = '') ⇒ Object



16
17
18
19
20
# File 'lib/nib/command.rb', line 16

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

#scriptObject



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/nib/command.rb', line 26

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