docker_core 0.0.36 → 0.0.37

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/docker_core.rb +42 -9
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fd55c6918dc257c2505498aa7df47baa69323551f0fc044bfb1f7b5550e5fff1
4
- data.tar.gz: 96e1e4a3c8c855d4c11f79da51edb8ec0530ff1d08f2df904ae6dc1560d5bd1b
3
+ metadata.gz: e0375cb2f88d368c24f8b45c30ef14a8be4bf0f599b1bbf09aa889ffb4e7ff37
4
+ data.tar.gz: eb33596964712179047258e7ae4736d7d342fabb8fb0af55f7ee732d52a71e39
5
5
  SHA512:
6
- metadata.gz: dc8cfe3b768718901c057f780a0ee73425c24ddb6cff24046ce123a0079e428c962ac6c0372209558f191a442e077c5c12e558f2505860613e7de650a90fd6ee
7
- data.tar.gz: 07d546f99ec45bf205a6721e3ac457f44cd86e62702fa48acdf83f5bd9a34ecfac5aaea66b14ad329679632db894d93fe61ec08b07ab2fab27dedd8567bac337
6
+ metadata.gz: 977cc7b87c3e7385cde5f924445c505f4d7c5ca9067ab7e1d35ab4e0cb8d04df470bb95ffb13bc26fbc661636f52565c18666b7d090d2a5bab2666745e389cec
7
+ data.tar.gz: a800981a96c1978b33236991d25c04dae4f452f952ba55a7a46f5125ed93c01a4e4e5d0b50a0ec283f85f9695dd996f9f5234e193d67d3a1c4b0ec013e482c72
data/lib/docker_core.rb CHANGED
@@ -113,13 +113,46 @@ module DockerCore
113
113
  return File.expand_path('~/.swarm')
114
114
  end
115
115
 
116
- # def self.profile_path
117
- # return File.realpath('profile.sh', self.deploy_path)
118
- # end
119
- #
120
- # def self.runner_path
121
- # return File.realpath('runner.rb', self.deploy_path)
122
- # end
116
+ def self.profile_path
117
+ return File.realpath('profile.sh', self.deploy_path)
118
+ end
119
+
120
+ def self.runner_path
121
+ return File.realpath('runner.rb', self.deploy_path)
122
+ end
123
+
124
+ # @see https://github.com/moby/moby/issues/31564
125
+ # @param [String] name
126
+ # @param [Boolean] echo
127
+ def self.check_name(name, echo: false)
128
+ color = Color::YELLOW
129
+ name = "#{name}"
130
+ items = name.chars
131
+
132
+ if items.empty? || 63 < items.length
133
+ if echo
134
+ Color.echo("'#{name}' should be between 1 and 63 characters long", color)
135
+ end
136
+
137
+ return false
138
+ end
139
+
140
+ if [items.first, items.last].include?('-')
141
+ if echo
142
+ Color.echo("'#{name}' should not start or end with a hyphen(-)", color)
143
+ end
144
+
145
+ return false
146
+ end
147
+
148
+ test = name.match?(/^[a-zA-Z0-9-]+$/)
149
+
150
+ if false == test && echo
151
+ Color.echo("'#{name}' should be a-z or A-Z or 0-9 and hyphen (-)", color)
152
+ end
153
+
154
+ return test
155
+ end
123
156
 
124
157
  # @param [String] swarm
125
158
  def self.write_swarm(swarm = '')
@@ -583,8 +616,8 @@ module DockerCore
583
616
 
584
617
  Process.run('deluser', USER, throw: false)
585
618
  Process.run('delgroup', GROUP, throw: false)
586
- Process.run('addgroup', { system: true, gid: gid }, GROUP, throw: false)
587
- Process.run('adduser', { system: true, 'disabled-password': true, 'no-create-home': true, ingroup: GROUP, gecos: USER, shell: '/bin/bash', uid: uid }, USER, throw: false)
619
+ Process.run('addgroup', { system: true, gid: gid }, GROUP)
620
+ Process.run('adduser', { system: true, 'disabled-password': true, 'no-create-home': true, ingroup: GROUP, gecos: USER, shell: '/bin/bash', uid: uid }, USER)
588
621
  end
589
622
 
590
623
  # @param [String] stdout
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docker_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.36
4
+ version: 0.0.37
5
5
  platform: ruby
6
6
  authors:
7
7
  - agrozyme