docker_deploy 0.1.1 → 0.1.2

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: f2c1ca6ba03a922837423fefa9c35e93dd9aa553
4
- data.tar.gz: 0c0e6536e1b5e84576cc4c110fcff28cdf02a53e
3
+ metadata.gz: 1c87bef033c84edc20c5374e3db7e1dd4529134a
4
+ data.tar.gz: 4d1d410a0943d2f588fd77c391996d75886286d5
5
5
  SHA512:
6
- metadata.gz: df1ddf8e1380db78c3e42950a29c03817bc9fbfe13500b0f1a0dec38519452b41619461eaf4003bc815570f4d451eb66a37a3a6e5c3de0b01fafa509258eaa6a
7
- data.tar.gz: ef8faaffd025f8132db1383748c8a1fe959aaefad28033a9d88a9ddd8c94cdbf59bf9903523302f3cfb026af1ba45b20dac358928adcaf9355bc58c8130cd25c
6
+ metadata.gz: ad82a948cb2860c0ced2e2088a16610f14e37c8abebf07b9a6906a796a32a4654d65255b3b042f094ebcfbe78edf164401c9633682df0c89206d21a319639f51
7
+ data.tar.gz: 00c4c938679942f75f5accb4bb0ce7d0b3ec75b2bb77f6ae4578b32a433b267f8ce5e264e0fc33f8af6337722e4aa3e596bd24e0bc621b4f35f6b646e73bdf24
@@ -1,9 +1,10 @@
1
1
  module DockerDeploy
2
2
  class Context
3
- attr_reader :stages, :variables, :ports, :links
3
+ attr_reader :stages, :variables, :ports, :links, :env_files
4
4
 
5
5
  def initialize
6
6
  @stages = []
7
+ @env_files = []
7
8
  @variables = {}
8
9
  @ports = {}
9
10
  @links = {}
@@ -21,6 +22,10 @@ module DockerDeploy
21
22
  @links.merge!(links)
22
23
  end
23
24
 
25
+ def env_file(env_file)
26
+ @env_files.push(env_file)
27
+ end
28
+
24
29
  def image(name = nil)
25
30
  @image = name if name
26
31
  @image
@@ -1,11 +1,12 @@
1
1
  module DockerDeploy
2
2
  class Stage
3
- attr_reader :name, :servers, :variables, :links
3
+ attr_reader :name, :servers, :variables, :links, :env_files
4
4
 
5
5
  def initialize(context, name)
6
6
  @context = context
7
7
  @name = name
8
8
  @servers = []
9
+ @env_files = []
9
10
  @variables = {}
10
11
  @ports = {}
11
12
  @links = {}
@@ -24,6 +25,10 @@ module DockerDeploy
24
25
  @links.merge!(links)
25
26
  end
26
27
 
28
+ def env_file(env_file)
29
+ @env_files.push(env_file)
30
+ end
31
+
27
32
  def deploy(sequence = nil)
28
33
  @deploy = sequence if sequence
29
34
  @deploy
@@ -39,21 +44,25 @@ module DockerDeploy
39
44
  end
40
45
 
41
46
  def link_mappings
42
- @context.links.merge(@links).each_with_object("") do |(from, to), s|
43
- s << " --link %s:%s " % [from, to]
44
- end
47
+ format_params("--link %s:%s", @context.links.merge(@links))
45
48
  end
46
49
 
47
50
  def port_mappings
48
- @context.ports.merge(@ports).each_with_object("") do |(from, to), s|
49
- s << " -p %d:%d " % [from, to]
50
- end
51
+ format_params("-p %s:%s", @context.ports.merge(@ports))
51
52
  end
52
53
 
53
54
  def options
54
- @context.variables.merge(@variables).each_with_object("") do |(k, v), s|
55
- s << " -e %s=%s " % [Shellwords.escape(k), Shellwords.escape(v)] if v.present?
56
- end
55
+ format_params("--env-file %s", @context.env_files + @env_files) + " " +
56
+ format_params("-e %s=%s", @context.variables.merge(@variables))
57
+ end
58
+
59
+ private
60
+
61
+ def format_params(pattern, enumerable)
62
+ enumerable.map do |args|
63
+ args = [args].flatten.map { |v| Shellwords.escape(v) }
64
+ pattern % args
65
+ end.join(" ")
57
66
  end
58
67
  end
59
68
  end
@@ -1,3 +1,3 @@
1
1
  module DockerDeploy
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_deploy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonas Nicklas
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-10-31 00:00:00.000000000 Z
12
+ date: 2014-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sshkit