Module: DockerCompose

Defined in:
lib/docker_compose_ruby.rb

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.project_nameObject

Returns the value of attribute project_name.



8
9
10
# File 'lib/docker_compose_ruby.rb', line 8

def project_name
  @project_name
end

.yamlObject

Returns the value of attribute yaml.



8
9
10
# File 'lib/docker_compose_ruby.rb', line 8

def yaml
  @yaml
end

.yaml_pathObject

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

.delete(options = {}) ⇒ String

Deletes the set of containers listed in your compose file.

Examples:

DockerCompose.delete

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (String)


54
55
56
57
# File 'lib/docker_compose_ruby.rb', line 54

def delete(options = {})
  options = nil if options.empty?
  compose('delete',options)
end

.set_project_name(name) ⇒ String

Set Specific compose project name.

Examples:

DockerCompose.set_project_name('test_project')

Parameters:

  • name (String)

Returns:

  • (String)


30
31
32
33
# File 'lib/docker_compose_ruby.rb', line 30

def set_project_name(name)
  @project_name = "-p #{name}"
  name
end

.set_yaml_path(path) ⇒ String

Set Path to Docker Compose Yaml File.

Examples:

DockerCompose.set_yaml_path('/Users/test/projects/docker-compose.yml')

Parameters:

  • path (String)

Returns:

  • (String)


18
19
20
21
# File 'lib/docker_compose_ruby.rb', line 18

def set_yaml_path(path)
  @yaml_path = "-f #{path}"
  @yaml = YAML.load_file(path)
end

.start(options = {}) ⇒ String

Starts the set of containers listed in your compose file.

Examples:

DockerCompose.up

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (String)


78
79
80
81
# File 'lib/docker_compose_ruby.rb', line 78

def start(options = {})
  options = nil if options.empty?
  compose('start', options)
end

.stop(options = {}) ⇒ String

Stops the set of containers listed in your compose file.

Examples:

DockerCompose.stop

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (String)


66
67
68
69
# File 'lib/docker_compose_ruby.rb', line 66

def stop(options = {})
  options = nil if options.empty?
  compose('stop', options)
end

.up(options = {}) ⇒ String

Ups the set of containers listed in your compose file.

Examples:

DockerCompose.up

Parameters:

  • options (Hash) (defaults to: {})

Returns:

  • (String)


42
43
44
45
# File 'lib/docker_compose_ruby.rb', line 42

def up(options = {})
  options = nil if options.empty?
  compose('up',options)
end

.versionString

Displays the current version of Docker compose

Examples:

DockerCompose.version

Parameters:

  • options (Hash)

Returns:

  • (String)


90
91
92
# File 'lib/docker_compose_ruby.rb', line 90

def version
  compose('-v')
end