Class: DockerCompose::Interactive::Service
- Inherits:
-
Object
- Object
- DockerCompose::Interactive::Service
- Defined in:
- lib/capistrano/dockercompose/interactive/service.rb
Instance Method Summary collapse
- #exec(cmd, capture = false) ⇒ Object
- #id ⇒ Object
-
#initialize(compose, name, config) ⇒ Service
constructor
A new instance of Service.
- #run(cmd, capture = false, args = "--rm") ⇒ Object
Constructor Details
#initialize(compose, name, config) ⇒ Service
Returns a new instance of Service.
5 6 7 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 5 def initialize(compose, name, config) @compose, @name, @config = compose, name, config end |
Instance Method Details
#exec(cmd, capture = false) ⇒ Object
14 15 16 17 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 14 def exec(cmd, capture=false) cmd = "exec #{@name} #{cmd}" @compose.execute_compose_command(cmd, capture) end |
#id ⇒ Object
9 10 11 12 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 9 def id result = @compose.execute_compose_command("ps -q #{@name}", true) result.split(';').shift.strip end |
#run(cmd, capture = false, args = "--rm") ⇒ Object
19 20 21 22 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 19 def run(cmd, capture=false, args="--rm") cmd = "run #{args} #{@name} #{cmd}" @compose.execute_compose_command(cmd, capture) end |