vagrant-docker-compose 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cad20fa21be8f29efe766761fcb709b0cc0216ae
4
- data.tar.gz: 309b813b4ac63e7922dc72b72af96b71eeeb6fab
3
+ metadata.gz: 5719f78a211c2e93115b316c4730e0c6ba1f0b43
4
+ data.tar.gz: 3b9f8ecac2ee72bdd1889bec135d3f986ca913f7
5
5
  SHA512:
6
- metadata.gz: e61c9cb012ea59722303795cb2b73a7970bdbde28332924da8720a387d0983d2c41cd9b240940a941b6501a5b3367c729fa7defa6a37b7cc384c3db42e01fda1
7
- data.tar.gz: e61fe2302eef57e8aef3ee0e60710008799d06366b7dd1896c1eb0f8c155b92cb4b0cb2a56bf97f265d722b013013f319f67c0dbb011a7308d546c42c07390fa
6
+ metadata.gz: 144f8ae1e5a6f2b4286570543aad4010a3deec3fa16a2bd9e743cc5ff4fcf41b65652f9a51bc22424e77222e61a60e46e21c72974e1af193646c606f4622d37f
7
+ data.tar.gz: 70b77f91b465d91247be867116edba0a7a5ba47419c3ee35f3ea2d0a4b6ec8545e5619a61d4bf57b840e376fca958661dfe9cd8a77f549be9f01bd95bd26d1bf
@@ -1,3 +1,5 @@
1
+ ## ISC License
2
+
1
3
  Copyright (c) 2015, Leigh McCulloch
2
4
 
3
5
  Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.
data/README.md CHANGED
@@ -106,6 +106,7 @@ docker-compose --x-networking -f [yml] up -d --timeout 20
106
106
  * `yml` – one or more [Compose files](https://docs.docker.com/compose/compose-file/) (YAML), may be a `String` for a single file, or `Array` for multiple.
107
107
  * `compose_version` – defaults to `1.6.2`.
108
108
  * `project_name` – compose will default to naming the project `vagrant`.
109
+ * `env` – a `Hash` of environment variables to value that are passed to the `docker-compose` commands, defaults to an empty `Hash`.
109
110
  * `executable_symlink_path` – the location the executable will be symlinked to, defaults to `/usr/local/bin/docker-compose`.
110
111
  * `executable_install_path` – the location the executable will be stored, defaults to `<executable_symlink_path>-<compose_version>`, i.e. `/usr/local/bin/docker-compose-1.5.0`.
111
112
  * `options` - a `String` that's included as the first arguments when calling the docker-compose executable, you can use this to pass arbitrary options/flags to docker-compose, default to `nil`.
@@ -10,10 +10,12 @@ end
10
10
  Vagrant.configure("2") do |config|
11
11
  config.vm.box = "hashicorp/precise64"
12
12
 
13
- config.vm.network(:forwarded_port, guest: 8080, host: 8080)
13
+ port = 9090
14
+
15
+ config.vm.network(:forwarded_port, guest: port, host: port)
14
16
  config.vm.network(:forwarded_port, guest: 3333, host: 3333)
15
17
 
16
18
  config.vm.provision :shell, inline: "apt-get update"
17
19
  config.vm.provision :docker
18
- config.vm.provision :docker_compose, yml: ["/vagrant/docker-compose-base.yml","/vagrant/docker-compose.yml"], rebuild: true, project_name: "myproject", run: "always"
20
+ config.vm.provision :docker_compose, env: { "PORT" => "#{port}" }, yml: ["/vagrant/docker-compose-base.yml","/vagrant/docker-compose.yml"], rebuild: true, project_name: "myproject", run: "always"
19
21
  end
@@ -3,7 +3,7 @@ app:
3
3
  links:
4
4
  - redis
5
5
  ports:
6
- - "8080:8080"
6
+ - "${PORT}:8080"
7
7
  volumes:
8
8
  - ./app/:/app/
9
9
  redis:
@@ -6,7 +6,7 @@ module VagrantPlugins
6
6
  up: "-d"
7
7
  }
8
8
 
9
- attr_accessor :yml, :rebuild, :project_name, :executable_symlink_path, :executable_install_path, :compose_version, :options, :command_options
9
+ attr_accessor :yml, :rebuild, :project_name, :env, :executable_symlink_path, :executable_install_path, :compose_version, :options, :command_options
10
10
 
11
11
  def yml=(yml)
12
12
  files = yml.is_a?(Array) ? yml : [yml]
@@ -19,6 +19,7 @@ module VagrantPlugins
19
19
  def initialize
20
20
  @project_name = UNSET_VALUE
21
21
  @compose_version = UNSET_VALUE
22
+ @env = UNSET_VALUE
22
23
  @executable_symlink_path = UNSET_VALUE
23
24
  @executable_install_path = UNSET_VALUE
24
25
  @options = UNSET_VALUE
@@ -28,12 +29,17 @@ module VagrantPlugins
28
29
  def finalize!
29
30
  @project_name = nil if @project_name == UNSET_VALUE
30
31
  @compose_version = "1.6.2" if @compose_version == UNSET_VALUE
32
+ @env = {} if @env == UNSET_VALUE
31
33
  @executable_symlink_path = "/usr/local/bin/docker-compose" if @executable_symlink_path == UNSET_VALUE
32
34
  @executable_install_path = "#{@executable_symlink_path}-#{@compose_version}" if @executable_install_path == UNSET_VALUE
33
35
  @options = nil if @options == UNSET_VALUE
34
36
  @command_options = {} if @command_options == UNSET_VALUE
35
37
  @command_options = DEFAULT_COMMAND_OPTIONS.merge(@command_options)
36
38
  end
39
+
40
+ def env_s
41
+ @env.map { |k, v| "#{k}=#{Shellwords.escape(v)}" }.join(" ")
42
+ end
37
43
  end
38
44
  end
39
45
  end
@@ -11,7 +11,7 @@ module VagrantPlugins
11
11
  def build
12
12
  @machine.ui.detail(I18n.t(:docker_compose_build))
13
13
  @machine.communicate.tap do |comm|
14
- comm.sudo("#{@config.executable_install_path} #{@config.options} #{cli_options_for_yml_file} build #{@config.command_options[:build]}") do |type, data|
14
+ comm.sudo("#{@config.env_s} #{@config.executable_install_path} #{@config.options} #{cli_options_for_yml_file} build #{@config.command_options[:build]}") do |type, data|
15
15
  handle_comm(type, data)
16
16
  end
17
17
  end
@@ -20,7 +20,7 @@ module VagrantPlugins
20
20
  def rm
21
21
  @machine.ui.detail(I18n.t(:docker_compose_rm))
22
22
  @machine.communicate.tap do |comm|
23
- comm.sudo("#{@config.executable_install_path} #{@config.options} #{cli_options_for_yml_file} rm #{@config.command_options[:rm]}") do |type, data|
23
+ comm.sudo("#{@config.env_s} #{@config.executable_install_path} #{@config.options} #{cli_options_for_yml_file} rm #{@config.command_options[:rm]}") do |type, data|
24
24
  handle_comm(type, data)
25
25
  end
26
26
  end
@@ -29,7 +29,7 @@ module VagrantPlugins
29
29
  def up
30
30
  @machine.ui.detail(I18n.t(:docker_compose_up))
31
31
  @machine.communicate.tap do |comm|
32
- comm.sudo("#{@config.executable_install_path} #{@config.options} #{cli_options_for_yml_file} up #{@config.command_options[:up]}") do |type, data|
32
+ comm.sudo("#{@config.env_s} #{@config.executable_install_path} #{@config.options} #{cli_options_for_yml_file} up #{@config.command_options[:up]}") do |type, data|
33
33
  handle_comm(type, data)
34
34
  end
35
35
  end
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module DockerComposeProvisioner
3
- VERSION = "1.0.0"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-docker-compose
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leigh McCulloch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-06 00:00:00.000000000 Z
11
+ date: 2016-07-14 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Vagrant provisioner for docker compose.
14
14
  email:
@@ -18,7 +18,7 @@ extra_rdoc_files: []
18
18
  files:
19
19
  - ".gitignore"
20
20
  - Gemfile
21
- - LICENSE
21
+ - LICENSE.md
22
22
  - README.md
23
23
  - Rakefile
24
24
  - example/Vagrantfile
@@ -60,7 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
60
60
  version: '0'
61
61
  requirements: []
62
62
  rubyforge_project:
63
- rubygems_version: 2.4.8
63
+ rubygems_version: 2.5.1
64
64
  signing_key:
65
65
  specification_version: 4
66
66
  summary: A Vagrant provisioner for docker compose.