Class: DockerCompose::Interactive::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/dockercompose/interactive/service.rb

Instance Method Summary collapse

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

#idObject



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