Class: Specinfra::Backend::DockerCompose
- Inherits:
-
Exec
- Object
- Exec
- Specinfra::Backend::DockerCompose
- Defined in:
- lib/specinfra/backend/docker_compose.rb
Overview
Specinfra and Serverspec backend for Docker Compose.
Direct Known Subclasses
Instance Method Summary collapse
-
#add_pre_command(cmd) ⇒ String
Adds a prefix or previous instruction to the command.
-
#build_command(cmd) ⇒ String
Builds a command.
-
#initialize(config = {}) ⇒ DockerCompose
constructor
Constructs a Docker Compose Specinfra Backend.
-
#run_command(cmd, opts = {}) ⇒ Object
Runs a Specinfra command.
-
#send_file(_from, _to) ⇒ Object
Sends a file.
Constructor Details
#initialize(config = {}) ⇒ DockerCompose
Constructs a Docker Compose Specinfra Backend.
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/specinfra/backend/docker_compose.rb', line 40 def initialize(config = {}) super ::Docker.url = get_config(:docker_url) file = get_config(:docker_compose_file) fail 'Please specify docker_compose_file.' unless file @compose = ::DockerCompose.load(file) ObjectSpace.define_finalizer(self, proc { finalize }) Dir.chdir(::File.dirname(file)) { do_start } end |
Instance Method Details
#add_pre_command(cmd) ⇒ String
Adds a prefix or previous instruction to the command.
Does nothing.
83 84 85 |
# File 'lib/specinfra/backend/docker_compose.rb', line 83 def add_pre_command(cmd) cmd end |
#build_command(cmd) ⇒ String
Builds a command.
Does nothing.
72 73 74 |
# File 'lib/specinfra/backend/docker_compose.rb', line 72 def build_command(cmd) cmd end |
#run_command(cmd, opts = {}) ⇒ Object
Runs a Specinfra command.
59 60 61 62 63 |
# File 'lib/specinfra/backend/docker_compose.rb', line 59 def run_command(cmd, opts = {}) cmd = build_command(cmd) cmd = add_pre_command(cmd) docker_compose_run!(cmd, opts) end |
#send_file(_from, _to) ⇒ Object
Note:
Not implemented yet.
Sends a file.
95 96 97 |
# File 'lib/specinfra/backend/docker_compose.rb', line 95 def send_file(_from, _to) fail 'docker_compose does not support send_file' end |