Class: Service
- Inherits:
-
Object
- Object
- 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.
3 4 5 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 3 def initialize(compose, name, config) @compose, @name, @config = compose, name, config end |
Instance Method Details
#exec(cmd, capture = false) ⇒ Object
12 13 14 15 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 12 def exec(cmd, capture=false) cmd = "exec #{@name} #{cmd}" @compose.execute_compose_command(cmd, capture) end |
#id ⇒ Object
7 8 9 10 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 7 def id result = @compose.execute_compose_command("ps -q #{@name}", true) result.split(';').shift.strip end |
#run(cmd, capture = false, args = "--rm") ⇒ Object
17 18 19 20 |
# File 'lib/capistrano/dockercompose/interactive/service.rb', line 17 def run(cmd, capture=false, args="--rm") cmd = "run #{args} #{@name} #{cmd}" @compose.execute_compose_command(cmd, capture) end |