module DockerCompose
Attributes
Public Class Methods
Deletes the set of containers listed in your compose file.
@param options [Hash] @return [String]
@example
DockerCompose.delete
# File lib/docker_compose_ruby.rb, line 66 def delete(options = {}) options = nil if options.empty? compose('delete',options) end
Ups the set of containers listed in your compose file.
@param options [Hash] @return [String]
@example
DockerCompose.up
# File lib/docker_compose_ruby.rb, line 54 def pull(options = {}) options = nil if options.empty? compose('pull',options) end
Set Specific compose project name.
@param name [String] @return [String]
@example
DockerCompose.set_project_name('test_project')
# File lib/docker_compose_ruby.rb, line 30 def set_project_name(name) @project_name = "-p #{name}" name end
Set Path to Docker Compose Yaml File.
@param path [String] @return [String]
@example
DockerCompose.set_yaml_path('/Users/test/projects/docker-compose.yml')
# File lib/docker_compose_ruby.rb, line 18 def set_yaml_path(path) @yaml_path = "-f #{path}" @yaml = YAML.load_file(path) end
Starts the set of containers listed in your compose file.
@param options [Hash] @return [String]
@example
DockerCompose.up
# File lib/docker_compose_ruby.rb, line 90 def start(options = {}) options = nil if options.empty? compose('start', options) end
Stops the set of containers listed in your compose file.
@param options [Hash] @return [String]
@example
DockerCompose.stop
# File lib/docker_compose_ruby.rb, line 78 def stop(options = {}) options = nil if options.empty? compose('stop', options) end
Ups the set of containers listed in your compose file.
@param options [Hash] @return [String]
@example
DockerCompose.up
# File lib/docker_compose_ruby.rb, line 42 def up(options = {}) options = nil if options.empty? compose('up',options) end
Displays the current version of Docker compose
@param options [Hash] @return [String]
@example
DockerCompose.version
# File lib/docker_compose_ruby.rb, line 102 def version compose('-v') end
Private Class Methods
# File lib/docker_compose_ruby.rb, line 107 def compose(command, options) case command when 'up' system "docker-compose #{options} #{@yaml_path} #{@project_name} #{command} -d" when 'delete' system "docker-compose #{options} #{@yaml_path} #{@project_name} kill" system "docker-compose #{options} #{@yaml_path} #{@project_name} rm -f" when 'stop', 'start', 'version', 'pull' system "docker-compose #{options} #{@yaml_path} #{@project_name} #{command}" end end