Class: VagrantPlugins::DockerComposeProvisioner::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-docker-compose/config.rb

Constant Summary collapse

DEFAULT_COMMAND_OPTIONS =
{
  rm: "--force",
  up: "-d"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Returns a new instance of Config.



19
20
21
22
23
24
25
26
27
# File 'lib/vagrant-docker-compose/config.rb', line 19

def initialize
  @project_name = UNSET_VALUE
  @compose_version = UNSET_VALUE
  @env = UNSET_VALUE
  @executable_symlink_path = UNSET_VALUE
  @executable_install_path = UNSET_VALUE
  @options = UNSET_VALUE
  @command_options = UNSET_VALUE
end

Instance Attribute Details

#command_optionsObject

Returns the value of attribute command_options.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def command_options
  @command_options
end

#compose_versionObject

Returns the value of attribute compose_version.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def compose_version
  @compose_version
end

#envObject

Returns the value of attribute env.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def env
  @env
end

#executable_install_pathObject

Returns the value of attribute executable_install_path.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def executable_install_path
  @executable_install_path
end

Returns the value of attribute executable_symlink_path.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def executable_symlink_path
  @executable_symlink_path
end

#optionsObject

Returns the value of attribute options.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def options
  @options
end

#project_nameObject

Returns the value of attribute project_name.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def project_name
  @project_name
end

#rebuildObject

Returns the value of attribute rebuild.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def rebuild
  @rebuild
end

#ymlObject

Returns the value of attribute yml.



9
10
11
# File 'lib/vagrant-docker-compose/config.rb', line 9

def yml
  @yml
end

Instance Method Details

#env_sObject



40
41
42
# File 'lib/vagrant-docker-compose/config.rb', line 40

def env_s
  @env.map { |k, v| "#{k}=#{Shellwords.escape(v)}" }.join(" ")
end

#finalize!Object



29
30
31
32
33
34
35
36
37
38
# File 'lib/vagrant-docker-compose/config.rb', line 29

def finalize!
  @project_name = nil if @project_name == UNSET_VALUE
  @compose_version = "1.24.1" if @compose_version == UNSET_VALUE
  @env = {} if @env == UNSET_VALUE
  @executable_symlink_path = "/usr/local/bin/docker-compose" if @executable_symlink_path == UNSET_VALUE
  @executable_install_path = "#{@executable_symlink_path}-#{@compose_version}" if @executable_install_path == UNSET_VALUE
  @options = nil if @options == UNSET_VALUE
  @command_options = {} if @command_options == UNSET_VALUE
  @command_options = DEFAULT_COMMAND_OPTIONS.merge(@command_options)
end