vagrant-docker-compose 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ec0c779c611426816ec4cf201f08bc9dbd623d76
4
- data.tar.gz: 8294a0fd3a95b6797c1a2a6f726e5a4d5bc76538
3
+ metadata.gz: 3930486d1aca6411df319ba44bf95db974ee92a0
4
+ data.tar.gz: 5fc231c462804a9c894eac310df38a58efccbfe6
5
5
  SHA512:
6
- metadata.gz: 7be92c16845f98d12be8b311c2c68f81c60030fa640a802aeca05fd418b9aeaecf0e01d640ee9815a8984fa3591d390df08d942645d14b64d432b77ea0b4f999
7
- data.tar.gz: 796485b45d0973e7a2952e369decf74cc515427423b7a321ec1c3a309b993e81b7b7108479d69331c6824301964a75f3ef7f40a7b115fa53ebea4d55d3929e67
6
+ metadata.gz: faa873b961027a58f5eefa22064d4ea4c35145b0be46a4dcd3f3dd12ee75606dc2dea6b13efd16aeb2d29f1e1fe8a1f69ef9ac02eadb7fdd4c99fdf2a32932ae
7
+ data.tar.gz: f20c1bbef3c16f41aebe8417ce72774cc3b75b354731b18a175662b1a6aa6827887a57655ee4f16c01567d2c301e2a8a9713efe2b44cbf98cfc9fd27087f21e9
data/README.md CHANGED
@@ -35,7 +35,7 @@ end
35
35
  Equivalent to running:
36
36
 
37
37
  ```bash
38
- docker-compose -f [yml] up
38
+ docker-compose -f [yml] up -d
39
39
  ```
40
40
 
41
41
  ### To install, rebuild and run docker-compose on `vagrant up`
@@ -52,16 +52,39 @@ end
52
52
  Equivalent to running:
53
53
 
54
54
  ```bash
55
- docker-compose -f [yml] rm
55
+ docker-compose -f [yml] rm --force
56
56
  docker-compose -f [yml] build
57
- docker-compose -f [yml] up
57
+ docker-compose -f [yml] up -d
58
58
  ```
59
59
 
60
+ ### To install, rebuild and run docker-compose with options on `vagrant up`
61
+
62
+ ```ruby
63
+ Vagrant.configure("2") do |config|
64
+ config.vm.box = "ubuntu/trusty64"
65
+
66
+ config.vm.provision :docker
67
+ config.vm.provision :docker_compose, yml: "/vagrant/docker-compose.yml", rebuild: true,
68
+ options: "--x-networking", command_options: { rm: "", up: "-d --timeout 20"}, run: "always"
69
+ end
70
+ ```
71
+
72
+ Equivalent to running:
73
+
74
+ ```bash
75
+ docker-compose --x-networking -f [yml] rm
76
+ docker-compose --x-networking -f [yml] build
77
+ docker-compose --x-networking -f [yml] up -d --timeout 20
78
+ ```
79
+
80
+
60
81
  ### Other configs
61
82
 
62
83
  * `compose_version` – defaults to `1.5.0`.
63
84
  * `project_name` – compose will default to naming the project `vagrant`.
64
85
  * `executable` – the location the executable will be stored, defaults to `/usr/local/bin/docker-compose`.
86
+ * `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`.
87
+ * `command_options` - a `Hash` of docker-compose commands to options, you can use this to pass arbitrary options/flags to the docker-compose commands, defaults to: `{ rm: "--force", up: "-d" }`.
65
88
 
66
89
  ## Example
67
90
 
data/example/Vagrantfile CHANGED
@@ -8,7 +8,7 @@ unless Vagrant.has_plugin?("vagrant-docker-compose")
8
8
  end
9
9
 
10
10
  Vagrant.configure("2") do |config|
11
- config.vm.box = "ubuntu/trusty64"
11
+ config.vm.box = "hashicorp/precise64"
12
12
 
13
13
  config.vm.network(:forwarded_port, guest: 8080, host: 8080)
14
14
 
@@ -1,7 +1,12 @@
1
1
  module VagrantPlugins
2
2
  module DockerComposeProvisioner
3
3
  class Config < Vagrant.plugin("2", :config)
4
- attr_accessor :yml, :rebuild, :project_name, :executable, :compose_version
4
+ DEFAULT_COMMAND_OPTIONS = {
5
+ rm: "--force",
6
+ up: "-d"
7
+ }
8
+
9
+ attr_accessor :yml, :rebuild, :project_name, :executable, :compose_version, :options, :command_options
5
10
 
6
11
  def yml=(yml)
7
12
  raise DockerComposeError, :yml_must_be_absolute if !Pathname.new(yml).absolute?
@@ -12,12 +17,17 @@ module VagrantPlugins
12
17
  @executable = UNSET_VALUE
13
18
  @project_name = UNSET_VALUE
14
19
  @compose_version = UNSET_VALUE
20
+ @options = UNSET_VALUE
21
+ @command_options = UNSET_VALUE
15
22
  end
16
23
 
17
24
  def finalize!
18
25
  @executable = "/usr/local/bin/docker-compose" if @executable == UNSET_VALUE
19
26
  @project_name = nil if @project_name == UNSET_VALUE
20
27
  @compose_version = "1.5.0" if @compose_version == UNSET_VALUE
28
+ @options = nil if @options == UNSET_VALUE
29
+ @command_options = {} if @command_options == UNSET_VALUE
30
+ @command_options = DEFAULT_COMMAND_OPTIONS.merge(@command_options)
21
31
  end
22
32
  end
23
33
  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} -f \"#{@config.yml}\" build") do |type, data|
14
+ comm.sudo("#{@config.executable} #{@config.options} -f \"#{@config.yml}\" 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} -f \"#{@config.yml}\" rm --force") do |type, data|
23
+ comm.sudo("#{@config.executable} #{@config.options} -f \"#{@config.yml}\" 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} -f \"#{@config.yml}\" up -d") do |type, data|
32
+ comm.sudo("#{@config.executable} #{@config.options} -f \"#{@config.yml}\" 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 = "0.0.7"
3
+ VERSION = "0.0.8"
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: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leigh McCulloch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-28 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: A Vagrant provisioner for docker compose.
14
14
  email: