dockerun 0.3.5 → 0.3.6

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
  SHA256:
3
- metadata.gz: e780ee279842afa1d97ce5bd7aa09961d35f8fd5510ff86551d8701ee7d33475
4
- data.tar.gz: 3a3f2e91045841ef670b4a1e01d28ccd75f0f5d7452a7e25807ac2b1a76f2468
3
+ metadata.gz: d56f73dfb5c9d69bf40fc5390cf7f97fe1d372741876849c93f18c736c4cfd74
4
+ data.tar.gz: 9a04ddab0fd5c33068f5d94d91a38cae34662b00efe41ec3d5dbb64d9050b5ff
5
5
  SHA512:
6
- metadata.gz: da62e413cd4d6dc7c78402cd5a48b31ad7896d98266d64678b3cfea24888140a1fa2e3162f9d7316852d0886288f3a3362f61c11c39293b15c797fea97e2eb3d
7
- data.tar.gz: 97bfaf132fd15ee8dbee661b9fc5e274019f7c31e6d91480fcb9212e90d84d595d8a359e37f4336c4cc2b15877178e0ad5f6ed4a1409b0140836e4a3f0e7d495
6
+ metadata.gz: 67558d361248855d989b111878b00f43f6180b04bfb2f541b1491f8fb67e281c13e66398d5d9005a9ecd27710ce2353bea650555c40d6c5c96aa136b521db69a
7
+ data.tar.gz: cdf8d67ba8487b7b6425387c10cf444885f1729230559de48033f9182d330ee1a7b14e570feb33550e7efe209ab00e436365b46b145323cc3b45bfde5062ef0a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerun (0.3.5)
4
+ dockerun (0.3.6)
5
5
  colorize
6
6
  docker-cli (>= 0.3.1)
7
7
  teLogger
@@ -152,6 +152,7 @@ module Dockerun
152
152
  contNames = config.container_names(imageName)
153
153
 
154
154
  selContName = nil
155
+ port_mapping = {}
155
156
  if contNames.length == 0
156
157
  selContName = nil
157
158
  elsif contNames.length == 1
@@ -173,7 +174,7 @@ module Dockerun
173
174
  end
174
175
  end
175
176
 
176
- selContName = run_docker_container(imageName, selContName, mount_points) do |ops, *args|
177
+ selContName, otherConfigs = run_docker_container(imageName, selContName, mount_points) do |ops, *args|
177
178
  case ops
178
179
  when :new_container_name
179
180
  cli.ask("\n Please provide a new container name : ".yellow, required: true)
@@ -210,6 +211,10 @@ module Dockerun
210
211
 
211
212
  config.add_container(imageName, selContName)
212
213
 
214
+ config.add_mount_to_container(imagename, selContName, mount_points)
215
+
216
+ config.add_port_mapping_to_container(imagename, selContName, @otherConfigs[:port_mapping]) if not_empty?(@otherConfigs[:port_mapping])
217
+
213
218
  config.to_storage
214
219
 
215
220
  end
@@ -49,7 +49,7 @@ module Dockerun
49
49
  end
50
50
  end
51
51
 
52
- contName = run_docker_container(imageName, nil) do |ops, *args|
52
+ contName, otherConfigs = run_docker_container(imageName, nil) do |ops, *args|
53
53
  case ops
54
54
  when :new_container_name
55
55
  cli.ask("Please provide a new container name : ", required: true)
@@ -55,7 +55,7 @@ module Dockerun
55
55
 
56
56
  contNames = config.container_names(imageName)
57
57
 
58
- selContName = run_docker_container(imageName, selContName) do |ops, *args|
58
+ selContName, otherConfigs = run_docker_container(imageName, selContName) do |ops, *args|
59
59
  case ops
60
60
  when :new_container_name
61
61
  cli.ask("Please provide a new container name : ", required: true)
@@ -72,7 +72,12 @@ module Dockerun
72
72
  def add_mount_to_container(imageName, container, mount)
73
73
  add_container(imageName, container)
74
74
  @images[imageName][container][:mount] = [] if @images[imageName][container][:mount].nil?
75
- @images[imageName][container][:mount] << mount
75
+ case mount.class
76
+ when Array
77
+ @images[imageName][container][:mount]concat(mount)
78
+ else
79
+ @images[imageName][container][:mount] << mount
80
+ end
76
81
  end
77
82
 
78
83
  def container_mount_points(imageName, container)
@@ -84,6 +89,18 @@ module Dockerun
84
89
  end
85
90
  end
86
91
 
92
+ def add_port_mapping_to_container(imageName, container, port_mapping)
93
+ add_container(imageName, container)
94
+ @images[imageName][container][:port_mapping] = [] if @images[imageName][container][:port_mapping].nil?
95
+ case mount.class
96
+ when Array
97
+ @images[imageName][container][:port_mapping]concat(port_mapping)
98
+ else
99
+ @images[imageName][container][:port_mapping] << port_mapping
100
+ end
101
+ end
102
+
103
+
87
104
  def to_storage
88
105
  res = { images: @images }
89
106
 
@@ -49,6 +49,7 @@ module Dockerun
49
49
  #end
50
50
  end
51
51
 
52
+ @other_configs = {}
52
53
  if reuse == true
53
54
 
54
55
  Dockerun.udebug "Find out of container '#{container_name}' is running..."
@@ -143,13 +144,21 @@ module Dockerun
143
144
 
144
145
  #end
145
146
 
147
+ addPortMapping = block.call(:add_port_mapping?)
148
+ port_mapping = {}
149
+ if addPortMapping
150
+ portOnHost = block.call(:port_on_host)
151
+ portOnDocker = block.call(:port_on_docker)
152
+ port_mapping[portOnHost] = portOnDocker
153
+ end
146
154
 
155
+ @other_configs[:port_mapping] = port_mapping if not_empty?(port_mapping)
147
156
 
148
- dcFact.create_container_from_image(image_name, interactive: true, tty: true, container_name: container_name, mount: mount_points).run
157
+ dcFact.create_container_from_image(image_name, interactive: true, tty: true, container_name: container_name, mount: mount_points, ports: port_mapping).run
149
158
 
150
159
  end
151
160
 
152
- container_name
161
+ [container_name, @other_configs]
153
162
 
154
163
  end
155
164
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dockerun
4
- VERSION = "0.3.5"
4
+ VERSION = "0.3.6"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian