dockerun 0.3.4 → 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: 777e1a207665d2cb3e4418a2890441779663c1fe5eb39dd49f498a4445213cff
4
- data.tar.gz: a81b53e08e2e3e109104f05545e6f30f12bd2dc10590f6bd356180f8e4b919cd
3
+ metadata.gz: d56f73dfb5c9d69bf40fc5390cf7f97fe1d372741876849c93f18c736c4cfd74
4
+ data.tar.gz: 9a04ddab0fd5c33068f5d94d91a38cae34662b00efe41ec3d5dbb64d9050b5ff
5
5
  SHA512:
6
- metadata.gz: c55faea206d5bcddaee2c78d82aa101e15279236c749a43c43614aa840f4e48c7fdf02f0285207c84d76ce2cd53aa6b99974cffbaa2f035617f3ce7276522eb1
7
- data.tar.gz: 0d666b21e41d00232f0af9354877419e6479b09286fb219369ae528b1fbb5b185d8ef85af5f695b9f85f5c3fca332f1347ef9b042fb1bf70e83ae9ab00cfb927
6
+ metadata.gz: 67558d361248855d989b111878b00f43f6180b04bfb2f541b1491f8fb67e281c13e66398d5d9005a9ecd27710ce2353bea650555c40d6c5c96aa136b521db69a
7
+ data.tar.gz: cdf8d67ba8487b7b6425387c10cf444885f1729230559de48033f9182d330ee1a7b14e570feb33550e7efe209ab00e436365b46b145323cc3b45bfde5062ef0a
data/.release_history.yml CHANGED
@@ -52,3 +52,5 @@ dockerun:
52
52
  :timestamp: 1680596515.6388657
53
53
  - :version: 0.3.3
54
54
  :timestamp: 1680598096.8177018
55
+ - :version: 0.3.4
56
+ :timestamp: 1680600334.3304904
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dockerun (0.3.4)
4
+ dockerun (0.3.6)
5
5
  colorize
6
6
  docker-cli (>= 0.3.1)
7
7
  teLogger
@@ -27,7 +27,7 @@ GEM
27
27
  toolrack
28
28
  tty-command
29
29
  tty-prompt
30
- git_cli (0.11.2)
30
+ git_cli (0.11.4)
31
31
  gvcs
32
32
  ptools (~> 1.4.0)
33
33
  teLogger
@@ -36,11 +36,19 @@ GEM
36
36
  teLogger
37
37
  toolrack
38
38
  tty-prompt
39
- gvcs (0.1.1)
39
+ gvcs (0.1.2)
40
40
  pastel (0.8.0)
41
41
  tty-color (~> 0.5)
42
42
  ptools (1.4.3)
43
43
  rake (13.0.6)
44
+ release-gem (0.1.18)
45
+ colorize
46
+ git_cli
47
+ gvcs
48
+ teLogger
49
+ toolrack
50
+ tty-command
51
+ tty-prompt
44
52
  rspec (3.12.0)
45
53
  rspec-core (~> 3.12.0)
46
54
  rspec-expectations (~> 3.12.0)
@@ -55,7 +63,7 @@ GEM
55
63
  rspec-support (~> 3.12.0)
56
64
  rspec-support (3.12.0)
57
65
  teLogger (0.2.2)
58
- toolrack (0.21.0)
66
+ toolrack (0.22.1)
59
67
  tty-color (0.6.0)
60
68
  tty-command (0.10.1)
61
69
  pastel (~> 0.8)
@@ -79,6 +87,7 @@ DEPENDENCIES
79
87
  devops_assist
80
88
  dockerun!
81
89
  rake (~> 13.0)
90
+ release-gem
82
91
  rspec (~> 3.0)
83
92
 
84
93
  BUNDLED WITH
data/Rakefile CHANGED
@@ -8,3 +8,4 @@ require 'devops_assist'
8
8
  RSpec::Core::RakeTask.new(:spec)
9
9
 
10
10
  task default: :spec
11
+ require 'release/gem'
data/dockerun.gemspec CHANGED
@@ -46,4 +46,5 @@ Gem::Specification.new do |spec|
46
46
 
47
47
  # For more information and examples about making a new gem, checkout our
48
48
  # guide at: https://bundler.io/guides/creating_gem.html
49
+ spec.add_development_dependency 'release-gem'
49
50
  end
@@ -115,9 +115,6 @@ module Dockerun
115
115
  when :add_to_bundle?
116
116
  cli.yes?("\n Add directory '#{val.first}' to bundler config local? ".yellow)
117
117
 
118
- when :add_mount_to_container
119
- config.add_mount_to_container(imageName, *val)
120
-
121
118
  when :add_more_volume_mapping?
122
119
  cli.yes?("\n Add more volume mapping? ".yellow)
123
120
 
@@ -155,6 +152,7 @@ module Dockerun
155
152
  contNames = config.container_names(imageName)
156
153
 
157
154
  selContName = nil
155
+ port_mapping = {}
158
156
  if contNames.length == 0
159
157
  selContName = nil
160
158
  elsif contNames.length == 1
@@ -176,7 +174,7 @@ module Dockerun
176
174
  end
177
175
  end
178
176
 
179
- selContName = run_docker_container(imageName, selContName, mount_points) do |ops, *args|
177
+ selContName, otherConfigs = run_docker_container(imageName, selContName, mount_points) do |ops, *args|
180
178
  case ops
181
179
  when :new_container_name
182
180
  cli.ask("\n Please provide a new container name : ".yellow, required: true)
@@ -213,6 +211,10 @@ module Dockerun
213
211
 
214
212
  config.add_container(imageName, selContName)
215
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
+
216
218
  config.to_storage
217
219
 
218
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)
@@ -10,12 +10,13 @@ module Dockerun
10
10
  def self.from_storage
11
11
  path = File.join(Dir.getwd, FILENAME)
12
12
  if File.exist?(path)
13
- cont = nil
14
- File.open(path,"r") do |f|
15
- cont = f.read
16
- end
13
+ #cont = nil
14
+ #File.open(path,"r") do |f|
15
+ # cont = f.read
16
+ #end
17
17
 
18
- Config.new(YAML.load(cont), true)
18
+ #Config.new(YAML.load(cont), true)
19
+ Config.new(YAML.unsafe_load_file(path), true)
19
20
  else
20
21
  Config.new({}, false)
21
22
  end
@@ -71,7 +72,12 @@ module Dockerun
71
72
  def add_mount_to_container(imageName, container, mount)
72
73
  add_container(imageName, container)
73
74
  @images[imageName][container][:mount] = [] if @images[imageName][container][:mount].nil?
74
- @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
75
81
  end
76
82
 
77
83
  def container_mount_points(imageName, container)
@@ -83,6 +89,18 @@ module Dockerun
83
89
  end
84
90
  end
85
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
+
86
104
  def to_storage
87
105
  res = { images: @images }
88
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
 
@@ -239,7 +239,6 @@ module Dockerun
239
239
  @shared_dirs[File.basename(dest)] = dest
240
240
  end
241
241
 
242
- block.call(:add_mount_to_container, container_name, mount.last)
243
242
  repeat = block.call(:add_more_volume_mapping?)
244
243
  break if not repeat
245
244
 
@@ -248,6 +247,9 @@ module Dockerun
248
247
  end
249
248
 
250
249
 
250
+ #
251
+ # Try to run once to install bundle config --local and create alias during image building
252
+ #
251
253
  insideDockerConfig = File.join(File.dirname(__FILE__),"..","..","template","setup_ruby_devenv.rb.erb")
252
254
  if File.exist?(insideDockerConfig)
253
255
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dockerun
4
- VERSION = "0.3.4"
4
+ VERSION = "0.3.6"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dockerun
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ian
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-04 00:00:00.000000000 Z
11
+ date: 2023-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toolrack
@@ -108,6 +108,20 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: release-gem
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ">="
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
111
125
  description: ''
112
126
  email:
113
127
  - cameronian0@protonmail.com