Class: Nib::Shell

Inherits:
Object
  • Object
show all
Includes:
Command
Defined in:
lib/nib/shell.rb

Constant Summary collapse

SCRIPT =
<<~SH.freeze
  if hash bash 2>/dev/null ; then
    bash
  elif hash ash 2>/dev/null ; then
    ash
  else
    sh
  fi
SH

Instance Method Summary collapse

Methods included from Command

included, #initialize

Instance Method Details

#executeObject



14
15
16
17
# File 'lib/nib/shell.rb', line 14

def execute
  system('mkdir', '-p', './tmp')
  super
end

#scriptObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/nib/shell.rb', line 19

def script
  @script ||= <<~SCRIPT
    docker-compose \
      run \
      --rm \
      -e HISTFILE=./tmp/shell_history \
      #{service} \
      #{command}
  SCRIPT
end