dockerploy 0.0.3 → 0.0.4

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- MmJiMDlmMDFkMmE1MzVjZWUwNTU0NWM2NDU5MDkxMWVkMjI5NzFiZg==
4
+ N2YyODBjNmEwZGZhMmY5MDZjNDMyZGUxZGQ0MmVkYmY0M2I0YWJlZg==
5
5
  data.tar.gz: !binary |-
6
- NzhlOGFiMDYwNzFmN2VjNmE3MDIyOWIzYzM5ZjAxOWI3ZTkyNWEyZg==
6
+ NDYyMTM0MDVlZGJkNTA2OTA4YTk2YzZiMmRkMmEzMzdmMTVjYjk4Mg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDA0ODIwNGQwNTMzODg0NGYwOTRiNGI1NTBjZTExYzBhMGY4NTIyYjUxNmMz
10
- YjVlNWVjNDczNmNiOTVmN2RjNzQzYTBlYmUzYTg4MDRjNmM0NTU3MzBkYmJk
11
- ZDY2ZmNlN2UzOTI4MmM3OTEyNGJlNjljYzUyZjVhOTFkNmI1NjA=
9
+ N2ZmMGM1YTg5MjBmMWEzYzQxNzdhOGUzZjE5YmQ1ODBmMjYzNmIwZGQzMjYz
10
+ Mjg0MTM2OWRkODA5ZWE1OWJjMzkxZGQwNjJmMDBmMTdiMjBiMGNlMWY0OTdi
11
+ NWVjYWUyMTA4YTEzMTlmYjI4YTg3N2E3NjI1MzhiNjE2YWZiOWE=
12
12
  data.tar.gz: !binary |-
13
- MGQyNGMzYzQwNmU2OWNkN2QwMmI3OWE1MDRkNjM0MDg3MGE4NjhkNGMxNzIw
14
- M2QxYzAwYWM3MjI5NjIwZTJhODI2NTViMjFhY2FkOGE5Yzg0MWQyYzQyZjcz
15
- OGU0MDU3N2MwN2IzMmYxYjVjY2JlNjM0Zjc2Yjc5MmRiMjgzNjc=
13
+ Njc1YjZiNTRkYjNmNzg1YzVjODYyZDY2ODBkNDlhNTEwMTJjOTkzMzc3NDkx
14
+ MGVjZDA3ODY2NDk1NDdkNzcxMjJkNjgyZTQ4NGUzZDZkODM4ZmU5ZGE1NzRm
15
+ MjAyN2E3MTIwMThjMjk2NjQ3ZGM3OGE5Zjc5ODE2YTNkM2UwOGM=
@@ -20,6 +20,8 @@ module Dockerploy
20
20
  command << option_delimiter + port_option(server)
21
21
  command << option_delimiter + volume_option
22
22
  command << option_delimiter + environment_variables_option
23
+ custom_variables = custom_environment_variables_option(server)
24
+ command << option_delimiter + custom_variables if custom_variables.length > 0
23
25
  command << option_delimiter + image_name
24
26
  ssh_client.command(command)
25
27
  end
@@ -87,6 +89,17 @@ module Dockerploy
87
89
  result.strip
88
90
  end
89
91
 
92
+ def custom_environment_variables_option(server)
93
+ result = ''
94
+ variables = server[:custom_variables]
95
+ if variables
96
+ variables.each_pair do |key, value|
97
+ result << sprintf("-e %s='%s' ", key.upcase, value)
98
+ end
99
+ end
100
+ result.strip
101
+ end
102
+
90
103
  def port_option(server)
91
104
  container_config = server[:container]
92
105
  result = ''
@@ -1,4 +1,4 @@
1
1
  module Dockerploy
2
2
  # Version of Dockerploy
3
- VERSION = '0.0.3'
3
+ VERSION = '0.0.4'
4
4
  end
@@ -0,0 +1,28 @@
1
+ image_name: docker/image
2
+ docker_username: dockeruser
3
+ docker_host: tcp://test.host:4243
4
+ application_name: app
5
+ test:
6
+ branch: master
7
+ env_file: spec/fixtures/test.yml
8
+ servers:
9
+ - host: server.host
10
+ username: server_user
11
+ password: server_pass
12
+ port: 2000
13
+ custom_variables:
14
+ role: web_role
15
+ container:
16
+ host: container.host1
17
+ ssh_port: 1022
18
+ http_port: 8080
19
+ - host: server.host
20
+ username: server_user
21
+ password: server_pass
22
+ port: 2000
23
+ custom_variables:
24
+ role: worker_role
25
+ container:
26
+ host: container.host2
27
+ ssh_port: 1022
28
+ http_port: 8080
@@ -59,6 +59,28 @@ docker run -d --name app_8080 --hostname app \
59
59
  end
60
60
  end
61
61
 
62
+ context 'custom variables exist' do
63
+ let(:fixture_path) { 'spec/fixtures/config_with_custom_env.yml' }
64
+
65
+ it 'creates a container with custom environment variables' do
66
+ expected_command1 = <<-SHELL
67
+ docker run -d --name app_8080 --hostname app \
68
+ -p container.host1:1022:22 -p container.host1:8080:80 \
69
+ -e BRANCH='master' -e APP_ENV='test' -e ROLE='web_role' docker/image
70
+ SHELL
71
+ expected_command2 = <<-SHELL
72
+ docker run -d --name app_8080 --hostname app \
73
+ -p container.host2:1022:22 -p container.host2:8080:80 \
74
+ -e BRANCH='master' -e APP_ENV='test' -e ROLE='worker_role' docker/image
75
+ SHELL
76
+ expected_command1.chomp!
77
+ expected_command2.chomp!
78
+ expect(ssh_client).to receive(:command).with(expected_command1)
79
+ expect(ssh_client).to receive(:command).with(expected_command2)
80
+ subject.deploy
81
+ end
82
+ end
83
+
62
84
  context 'volumes exists' do
63
85
  let(:fixture_path) { 'spec/fixtures/config_with_volumes.yml' }
64
86
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sunjin Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-20 00:00:00.000000000 Z
11
+ date: 2015-02-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -140,6 +140,7 @@ files:
140
140
  - lib/dockerploy/templates/config.yml.erb
141
141
  - lib/dockerploy/version.rb
142
142
  - spec/fixtures/config.yml
143
+ - spec/fixtures/config_with_custom_env.yml
143
144
  - spec/fixtures/config_with_env_file.yml
144
145
  - spec/fixtures/config_with_hooks.yml
145
146
  - spec/fixtures/config_with_hooks_for_each_env.yml
@@ -177,6 +178,7 @@ specification_version: 4
177
178
  summary: Deploy dockerized an application
178
179
  test_files:
179
180
  - spec/fixtures/config.yml
181
+ - spec/fixtures/config_with_custom_env.yml
180
182
  - spec/fixtures/config_with_env_file.yml
181
183
  - spec/fixtures/config_with_hooks.yml
182
184
  - spec/fixtures/config_with_hooks_for_each_env.yml