Class: Nib::Exec
Instance Method Summary
collapse
Methods included from Command
#execute, included, #initialize
Instance Method Details
#action ⇒ Object
14
15
16
|
# File 'lib/nib/exec.rb', line 14
def action
command.to_s.empty? ? '' : "-c '#{command}'"
end
|
#entrypoint ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/nib/exec.rb', line 18
def entrypoint
"
if hash bash 2>/dev/null ; then
bash #{action}
elif hash ash 2>/dev/null ; then
ash #{action}
else
sh #{action}
fi
"
end
|
#script ⇒ Object
4
5
6
7
8
9
10
11
12
|
# File 'lib/nib/exec.rb', line 4
def script
@script ||= <<~SCRIPT
docker-compose \
exec \
#{options} \
#{service} \
/bin/sh -c "#{entrypoint}"
SCRIPT
end
|