Module: DockerCompose
- Defined in:
- lib/docker_compose_ruby.rb
Class Attribute Summary collapse
-
.project_name ⇒ Object
Returns the value of attribute project_name.
-
.yaml ⇒ Object
Returns the value of attribute yaml.
-
.yaml_path ⇒ Object
Returns the value of attribute yaml_path.
Class Method Summary collapse
- .compose(command, options) ⇒ Object
- .delete(options = {}) ⇒ Object
- .set_project_name(name) ⇒ Object
- .set_yaml_path(path) ⇒ Object
- .start(options = {}) ⇒ Object
- .stop(options = {}) ⇒ Object
- .up(options = {}) ⇒ Object
- .version ⇒ Object
Class Attribute Details
.project_name ⇒ Object
Returns the value of attribute project_name.
8 9 10 |
# File 'lib/docker_compose_ruby.rb', line 8 def project_name @project_name end |
.yaml ⇒ Object
Returns the value of attribute yaml.
8 9 10 |
# File 'lib/docker_compose_ruby.rb', line 8 def yaml @yaml end |
.yaml_path ⇒ Object
Returns the value of attribute yaml_path.
8 9 10 |
# File 'lib/docker_compose_ruby.rb', line 8 def yaml_path @yaml_path end |
Class Method Details
.compose(command, options) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/docker_compose_ruby.rb', line 40 def compose(command, ) case command when 'up' `docker-compose #{options} #{@yaml_path} #{@project_name} #{command} -d` when 'delete' `docker-compose #{options} #{@yaml_path} #{@project_name} kill` `docker-compose #{options} #{@yaml_path} #{@project_name} rm -f` when 'stop', 'start' `docker-compose #{options} #{@yaml_path} #{@project_name} #{command}` end end |
.delete(options = {}) ⇒ Object
25 26 27 28 |
# File 'lib/docker_compose_ruby.rb', line 25 def delete( = {}) = nil if .empty? compose('delete',) end |
.set_project_name(name) ⇒ Object
15 16 17 18 |
# File 'lib/docker_compose_ruby.rb', line 15 def set_project_name(name) @project_name = "-p #{name}" name end |
.set_yaml_path(path) ⇒ Object
10 11 12 13 |
# File 'lib/docker_compose_ruby.rb', line 10 def set_yaml_path(path) @yaml_path = "-f #{path}" @yaml = YAML.load_file(path) end |
.start(options = {}) ⇒ Object
35 36 37 38 |
# File 'lib/docker_compose_ruby.rb', line 35 def start( = {}) = nil if .empty? compose('start', ) end |
.stop(options = {}) ⇒ Object
30 31 32 33 |
# File 'lib/docker_compose_ruby.rb', line 30 def stop( = {}) = nil if .empty? compose('stop', ) end |
.up(options = {}) ⇒ Object
20 21 22 23 |
# File 'lib/docker_compose_ruby.rb', line 20 def up( = {}) = nil if .empty? compose('up',) end |
.version ⇒ Object
52 53 54 |
# File 'lib/docker_compose_ruby.rb', line 52 def version compose('-v') end |