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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b8e0d2cd02f77d0d0aa4b9b88e466d8fb388feba
4
- data.tar.gz: 65ec572c9a6041650bcf1ded75ccb6722d667292
3
+ metadata.gz: 9c63b7d392b7e6a3f85e25cf63f8ed6b74938ccd
4
+ data.tar.gz: 0d9841ce6661fc986c240303f32df0a7d49b2082
5
5
  SHA512:
6
- metadata.gz: eec1994dec78dff9b6342e0d1ce71e949ee0deedbe484a71e2c51633570c1ec3ed8d94d44f1c3846a8c00113bb1f2bd42a17445c81b7788572ccb527c3eab122
7
- data.tar.gz: 2a73df495488e168d34bcfaedb16f6a64b1d7566b33e87562abee08bceb0b0cb0b13ed8994ab34c45df36830f4021b42582a06bf898aa51db308742e64a7b6f8
6
+ metadata.gz: '0588c22232ac3f574dacf0a7189ff8e472692571469f3f2b6ccae984e599790b80af5774ab3a77b8c2f546da90fbe13963fc55d97117e3442ddb436d9b28bffc'
7
+ data.tar.gz: ed2b13e3102e0fb90bb46b3e188592bb7aa18956dd175b02e9af94d52772a5cee26acb3670940f45838c6bfee04e72f61f360cf6112df33063ffe21145f0850d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.3.0
1
+ 5.0.0
@@ -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, service=nil)
186
- exec(service) do |s|
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, service=nil)
195
- exec(service) do |s|
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(service=nil)
202
- exec(service) do |s|
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 repository'
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(service=nil)
230
- exec(service) do |s|
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(service)
286
- file = _file(service)
287
- if file != DOCKIT_FILE
288
- say "Processing #{service}"
289
- # problem w/ path length for docker build, so change to local directory
290
- Dir.chdir(File.dirname(file))
291
- end
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
- locals = options[:locals]||{}
294
- env = options[:env]
295
- locals[:env] = env ? "-#{env}" : ""
296
- yield Dockit::Service.new(locals: locals)
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)
@@ -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 ? "-#{options.env}" : ''}.merge(options[:locals]||{}))
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.3.0
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-02-20 00:00:00.000000000 Z
11
+ date: 2017-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler