Class: Matrixeval::DockerCompose
- Inherits:
-
Object
- Object
- Matrixeval::DockerCompose
- Defined in:
- lib/matrixeval/docker_compose.rb,
lib/matrixeval/docker_compose/file.rb,
lib/matrixeval/docker_compose/extend.rb,
lib/matrixeval/docker_compose/extend_raw.rb
Defined Under Namespace
Classes: Extend, ExtendRaw, File
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Instance Method Summary collapse
-
#initialize(context) ⇒ DockerCompose
constructor
A new instance of DockerCompose.
- #run(arguments) ⇒ Object
Constructor Details
#initialize(context) ⇒ DockerCompose
Returns a new instance of DockerCompose.
8 9 10 |
# File 'lib/matrixeval/docker_compose.rb', line 8 def initialize(context) @context = context end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
6 7 8 |
# File 'lib/matrixeval/docker_compose.rb', line 6 def context @context end |
Instance Method Details
#run(arguments) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/matrixeval/docker_compose.rb', line 12 def run(arguments) forward_arguments = arguments.map do |arg| arg.match(/\s/) ? "\"#{arg}\"" : arg end.join(" ") no_tty = %w[bash sh zsh dash].include?(arguments[0]) ? '' : '--no-TTY' system( <<~DOCKER_COMPOSE_COMMAND #{docker_compose} \ run --rm \ #{no_tty} \ #{context.docker_compose_service_name} \ #{forward_arguments} DOCKER_COMPOSE_COMMAND ) ensure stop_containers clean_containers_and_anonymous_volumes remove_network turn_on_stty_opost end |