dockit 4.3.0 → 5.0.0
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 +4 -4
- data/VERSION +1 -1
- data/lib/dockit/cli.rb +27 -23
- data/lib/dockit/digitalocean.rb +6 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c63b7d392b7e6a3f85e25cf63f8ed6b74938ccd
|
4
|
+
data.tar.gz: 0d9841ce6661fc986c240303f32df0a7d49b2082
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0588c22232ac3f574dacf0a7189ff8e472692571469f3f2b6ccae984e599790b80af5774ab3a77b8c2f546da90fbe13963fc55d97117e3442ddb436d9b28bffc'
|
7
|
+
data.tar.gz: ed2b13e3102e0fb90bb46b3e188592bb7aa18956dd175b02e9af94d52772a5cee26acb3670940f45838c6bfee04e72f61f360cf6112df33063ffe21145f0850d
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5.0.0
|
data/lib/dockit/cli.rb
CHANGED
@@ -179,32 +179,32 @@ class Default < Thor
|
|
179
179
|
end
|
180
180
|
end
|
181
181
|
|
182
|
-
desc 'push REGISTRY [SERVICE]', 'push image for SERVICE to REGSITRY'
|
182
|
+
desc 'push REGISTRY [SERVICE ...]', 'push image for SERVICE(s) to REGSITRY'
|
183
183
|
option :force, type: :boolean, desc: 'overwrite current lastest version'
|
184
184
|
option :tag, desc: 'repos tag (defaults to "latest")', aliases: ['t']
|
185
|
-
def push(registry,
|
186
|
-
exec(
|
185
|
+
def push(registry, *services)
|
186
|
+
exec(services) do |s|
|
187
187
|
s.push(registry, options[:tag], options[:force])
|
188
188
|
end
|
189
189
|
end
|
190
190
|
|
191
|
-
desc 'pull REGISTRY [SERVICE]', 'pull image for SERVICE from REGSITRY'
|
191
|
+
desc 'pull REGISTRY [SERVICE ...]', 'pull image for SERVICE(s) from REGSITRY'
|
192
192
|
option :force, type: :boolean, desc: 'overwrite current tagged version'
|
193
193
|
option :tag, desc: 'repos tag (defaults to "latest")', aliases: ['t']
|
194
|
-
def pull(registry,
|
195
|
-
exec(
|
194
|
+
def pull(registry, *services)
|
195
|
+
exec(services) do |s|
|
196
196
|
s.pull(registry, options[:tag], options[:force])
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
desc 'build [SERVICE]', "Build image from current directory or service name"
|
201
|
-
def build(
|
202
|
-
exec(
|
200
|
+
desc 'build [SERVICE ...]', "Build image(s) from current directory or service name(s)"
|
201
|
+
def build(*services)
|
202
|
+
exec(services) do |s|
|
203
203
|
s.build()
|
204
204
|
end
|
205
205
|
end
|
206
206
|
|
207
|
-
desc 'git-build', 'build from git
|
207
|
+
desc 'git-build [SERVICE ...]', 'build image(s) for current directory or service(s) from git'
|
208
208
|
option :branch, desc: '<tree-ish> git reference', default: GIT_BRANCH
|
209
209
|
option :package, type: :boolean, desc: 'update package config export'
|
210
210
|
option :tag, type: :boolean,
|
@@ -226,8 +226,8 @@ class Default < Thor
|
|
226
226
|
branch, not ~master~.
|
227
227
|
LONGDESC
|
228
228
|
|
229
|
-
def git_build(
|
230
|
-
exec(
|
229
|
+
def git_build(*services)
|
230
|
+
exec(services) do |s|
|
231
231
|
unless repos = s.config.get(:repos)
|
232
232
|
say "'repos' not defined in config file. Exiting…", :red
|
233
233
|
exit 1
|
@@ -282,18 +282,22 @@ class Default < Thor
|
|
282
282
|
@@dockit ||= Dockit::Env.new(debug: options[:debug])
|
283
283
|
end
|
284
284
|
|
285
|
-
def exec(
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
285
|
+
def exec(services)
|
286
|
+
services = [services] unless services.is_a?(Array)
|
287
|
+
services.push(nil) unless services.count.positive?
|
288
|
+
services.each do |service|
|
289
|
+
file = _file(service)
|
290
|
+
if file != DOCKIT_FILE
|
291
|
+
say "Processing #{service}", :blue
|
292
|
+
# problem w/ path length for docker build, so change to local directory
|
293
|
+
Dir.chdir(File.dirname(file))
|
294
|
+
end
|
292
295
|
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
296
|
+
locals = options[:locals]||{}
|
297
|
+
locals[:env] = options[:env] || ''
|
298
|
+
yield Dockit::Service.new(locals: locals)
|
299
|
+
|
300
|
+
end
|
297
301
|
end
|
298
302
|
|
299
303
|
def _file(service)
|
data/lib/dockit/digitalocean.rb
CHANGED
@@ -28,14 +28,14 @@ class DO < Thor
|
|
28
28
|
say "Droplet #{options.remote} exists. Please destroy it first.", :red
|
29
29
|
exit 1
|
30
30
|
end
|
31
|
-
say "creating droplet: #{options.remote}"
|
31
|
+
say "creating droplet: #{options.remote}", :green
|
32
32
|
d = client.droplets.create(DropletKit::Droplet.new(
|
33
33
|
name: options.remote,
|
34
34
|
region: options.region,
|
35
35
|
size: options[:size],
|
36
36
|
image: options[:image],
|
37
37
|
ssh_keys: client.ssh_keys.all.collect(&:id)))
|
38
|
-
say [d.id, d.status, d.name].join(' ')
|
38
|
+
say [d.id, d.status, d.name].join(' '), :blue
|
39
39
|
end
|
40
40
|
|
41
41
|
desc 'available', 'list available docker images'
|
@@ -98,14 +98,14 @@ class DO < Thor
|
|
98
98
|
msg = "#{k}(#{id[0..11]}[#{name}]):"
|
99
99
|
if ssh(options.remote, options.user,
|
100
100
|
"docker images --no-trunc | grep #{id} > /dev/null")
|
101
|
-
say ". #{msg} exists"
|
101
|
+
say ". #{msg} exists", :blue
|
102
102
|
else
|
103
103
|
if options.backup
|
104
104
|
tag = "#{name}:#{options.tag}"
|
105
|
-
say "#{msg} tagging as #{tag}"
|
105
|
+
say "#{msg} tagging as #{tag}", :green
|
106
106
|
ssh(options.remote, options.user, "docker tag #{name} #{tag}")
|
107
107
|
end
|
108
|
-
say "#{msg} pushing"
|
108
|
+
say "#{msg} pushing", :green
|
109
109
|
ssh(options.remote, options.user, 'docker load', "docker save #{name}")
|
110
110
|
end
|
111
111
|
end
|
@@ -151,7 +151,7 @@ class DO < Thor
|
|
151
151
|
def service(name)
|
152
152
|
Dockit::Service.new(
|
153
153
|
service_file(name),
|
154
|
-
locals: {env: options.env
|
154
|
+
locals: {env: options.env || ''}.merge(options[:locals]||{}))
|
155
155
|
end
|
156
156
|
|
157
157
|
def service_file(name)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dockit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 5.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rick Frankel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|