dory 0.2.3 → 0.2.4
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/bin/dory +122 -60
- data/lib/dory/version.rb +2 -2
- 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: 9980430347948f1151abdb39a42392ab21114200
|
4
|
+
data.tar.gz: 407c1ba0e59201032ed2fc34979b2bcfb50d9d5d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a80c27a7d3bb2f328eb86cb2fb66330927a9d9565c43730a94dc0cb5d010ead704b4658888d8cd3c317c35b6c518955a2325fdc80329f9796eac665b505ab0b6
|
7
|
+
data.tar.gz: 4d9c83fc5edb56bc000c40a2cd5c9b6582be8a416d29d8b5d15b30661d8a22d63436720a047a2d5e452b1df9f259d2d1e0a8738fcf0c37ed3e202cc7b4ab71e0
|
data/bin/dory
CHANGED
@@ -33,10 +33,13 @@ class DoryBin < Thor
|
|
33
33
|
for your custom domain to the nginx proxy. The local resolver
|
34
34
|
will also be configured to use the dnsmasq instance as a nameserver
|
35
35
|
|
36
|
-
|
36
|
+
Optionally, you can pass a list of service names as arguments
|
37
|
+
to have only one or two services started.
|
38
|
+
|
39
|
+
> $ dory up [proxy] [dns] [resolv]
|
37
40
|
LONGDESC
|
38
|
-
def up
|
39
|
-
exec_up(options)
|
41
|
+
def up(*services)
|
42
|
+
exec_up(options, services)
|
40
43
|
end
|
41
44
|
|
42
45
|
desc 'down', 'Stop all dory services'
|
@@ -44,11 +47,14 @@ class DoryBin < Thor
|
|
44
47
|
Stops all dory services. Can optionally pass [-d|--destroy]
|
45
48
|
to destroy the containers when they stop.
|
46
49
|
|
47
|
-
|
50
|
+
Optionally, you can pass a list of service names as arguments
|
51
|
+
to have only one or two services started.
|
52
|
+
|
53
|
+
> $ dory down [-d|--destroy] [proxy] [dns] [resolv]
|
48
54
|
LONGDESC
|
49
55
|
option :destroy, type: :boolean, aliases: 'd', default: true
|
50
|
-
def down
|
51
|
-
exec_down(options)
|
56
|
+
def down(*services)
|
57
|
+
exec_down(options, services)
|
52
58
|
end
|
53
59
|
|
54
60
|
desc 'version', 'Check current installed version of dory'
|
@@ -63,9 +69,9 @@ class DoryBin < Thor
|
|
63
69
|
> $ dory restart [-d|--destroy]
|
64
70
|
LONGDESC
|
65
71
|
option :destroy, type: :boolean, aliases: 'd', default: true
|
66
|
-
def restart
|
67
|
-
exec_down(options)
|
68
|
-
exec_up(options)
|
72
|
+
def restart(*services)
|
73
|
+
exec_down(options, services)
|
74
|
+
exec_up(options, services)
|
69
75
|
end
|
70
76
|
|
71
77
|
desc 'status', 'Report status of the dory services'
|
@@ -162,40 +168,49 @@ class DoryBin < Thor
|
|
162
168
|
end
|
163
169
|
end
|
164
170
|
|
165
|
-
def exec_up(options)
|
171
|
+
def exec_up(options, services)
|
172
|
+
services = sanitize_services(services)
|
173
|
+
return unless services
|
174
|
+
|
166
175
|
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
|
167
176
|
settings = Dory::Config.settings
|
168
|
-
if
|
169
|
-
|
170
|
-
|
171
|
-
|
177
|
+
if services.include?('proxy')
|
178
|
+
if nginx_proxy_enabled?(settings)
|
179
|
+
puts "nginx_proxy enabled in config file".green if options[:verbose]
|
180
|
+
if Dory::Proxy.start
|
181
|
+
puts "Successfully started nginx proxy".green
|
182
|
+
else
|
183
|
+
puts "Error starting nginx proxy".red
|
184
|
+
end
|
172
185
|
else
|
173
|
-
puts "
|
186
|
+
puts "nginx_proxy disabled in config file".yellow
|
174
187
|
end
|
175
|
-
else
|
176
|
-
puts "nginx_proxy disabled in config file".yellow
|
177
188
|
end
|
178
189
|
|
179
|
-
if
|
180
|
-
|
181
|
-
|
182
|
-
|
190
|
+
if services.include?('dns')
|
191
|
+
if dnsmasq_enabled?(settings)
|
192
|
+
puts "dnsmasq enabled in config file".green if options[:verbose]
|
193
|
+
if Dory::Dnsmasq.start
|
194
|
+
puts "Successfully started dnsmasq".green
|
195
|
+
else
|
196
|
+
puts "Error starting dnsmasq".red
|
197
|
+
end
|
183
198
|
else
|
184
|
-
puts "
|
199
|
+
puts "dnsmasq disabled in config file".yellow
|
185
200
|
end
|
186
|
-
else
|
187
|
-
puts "dnsmasq disabled in config file".yellow
|
188
201
|
end
|
189
202
|
|
190
|
-
if
|
191
|
-
if
|
192
|
-
|
203
|
+
if services.include?('resolv')
|
204
|
+
if resolv_enabled?(settings)
|
205
|
+
if Dory::Resolv.configure
|
206
|
+
puts "Successfully configured local resolver".green
|
207
|
+
else
|
208
|
+
puts "Error configuring local resolver".red
|
209
|
+
end
|
210
|
+
puts "resolv enabled in config file".green if options[:verbose]
|
193
211
|
else
|
194
|
-
puts "
|
212
|
+
puts "resolv disabled in config file".yellow
|
195
213
|
end
|
196
|
-
puts "resolv enabled in config file".green if options[:verbose]
|
197
|
-
else
|
198
|
-
puts "resolv disabled in config file".yellow
|
199
214
|
end
|
200
215
|
end
|
201
216
|
|
@@ -228,52 +243,61 @@ class DoryBin < Thor
|
|
228
243
|
end
|
229
244
|
end
|
230
245
|
|
231
|
-
def exec_down(options)
|
246
|
+
def exec_down(options, services)
|
247
|
+
services = sanitize_services(services)
|
248
|
+
return unless services
|
249
|
+
|
232
250
|
puts "Reading settings file at '#{Dory::Config.filename}'".green if options[:verbose]
|
233
251
|
settings = Dory::Config.settings
|
234
252
|
|
235
|
-
if
|
236
|
-
if
|
237
|
-
|
253
|
+
if services.include?('resolv')
|
254
|
+
if Dory::Resolv.clean
|
255
|
+
if resolv_enabled?(settings)
|
256
|
+
puts "nameserver removed from resolv file".green
|
257
|
+
else
|
258
|
+
puts "Resolv disabled in config file".yellow
|
259
|
+
end
|
238
260
|
else
|
239
|
-
puts "
|
261
|
+
puts "Unable to remove nameserver from resolv file".red
|
240
262
|
end
|
241
|
-
else
|
242
|
-
puts "Unable to remove nameserver from resolv file".red
|
243
263
|
end
|
244
264
|
|
245
|
-
if
|
246
|
-
if
|
247
|
-
|
248
|
-
|
249
|
-
if
|
250
|
-
|
251
|
-
|
252
|
-
|
265
|
+
if services.include?('dns')
|
266
|
+
if Dory::Dnsmasq.stop
|
267
|
+
if dnsmasq_enabled?(settings)
|
268
|
+
puts "Dnsmasq container stopped".green
|
269
|
+
if options[:destroy]
|
270
|
+
if Dory::Dnsmasq.delete
|
271
|
+
puts "Dnsmasq container successfully deleted".green
|
272
|
+
else
|
273
|
+
puts "Dnsmasq container failed to delete".red
|
274
|
+
end
|
253
275
|
end
|
276
|
+
else
|
277
|
+
puts "dnsmasq disabled in config file".yellow
|
254
278
|
end
|
255
279
|
else
|
256
|
-
puts "
|
280
|
+
puts "Dnsmasq container failed to stop".red
|
257
281
|
end
|
258
|
-
else
|
259
|
-
puts "Dnsmasq container failed to stop".red
|
260
282
|
end
|
261
283
|
|
262
|
-
if
|
263
|
-
if
|
264
|
-
|
265
|
-
|
266
|
-
if
|
267
|
-
|
268
|
-
|
269
|
-
|
284
|
+
if services.include?('proxy')
|
285
|
+
if Dory::Proxy.stop
|
286
|
+
if nginx_proxy_enabled?(settings)
|
287
|
+
puts "Nginx proxy stopped".green
|
288
|
+
if options[:destroy]
|
289
|
+
if Dory::Proxy.delete
|
290
|
+
puts "Nginx proxy container successfully deleted".green
|
291
|
+
else
|
292
|
+
puts "Nginx proxy container failed to delete".red
|
293
|
+
end
|
270
294
|
end
|
295
|
+
else
|
296
|
+
puts "Nginx proxy disabled in config file".yellow
|
271
297
|
end
|
272
298
|
else
|
273
|
-
puts "Nginx proxy
|
299
|
+
puts "Nginx proxy failed to stop".red
|
274
300
|
end
|
275
|
-
else
|
276
|
-
puts "Nginx proxy failed to stop".red
|
277
301
|
end
|
278
302
|
end
|
279
303
|
|
@@ -300,6 +324,44 @@ class DoryBin < Thor
|
|
300
324
|
def resolv_disabled?(settings)
|
301
325
|
!resolv_enabled?(settings)
|
302
326
|
end
|
327
|
+
|
328
|
+
def valid_services
|
329
|
+
%w[proxy dns resolv]
|
330
|
+
end
|
331
|
+
|
332
|
+
def canonical_service(service)
|
333
|
+
{
|
334
|
+
'proxy' => 'proxy',
|
335
|
+
'nginx' => 'proxy',
|
336
|
+
'nginx_proxy' => 'proxy',
|
337
|
+
'nginx-proxy' => 'proxy',
|
338
|
+
'dns' => 'dns',
|
339
|
+
'dnsmasq' => 'dns',
|
340
|
+
'resolv' => 'resolv',
|
341
|
+
'resolve' => 'resolv'
|
342
|
+
}[service]
|
343
|
+
end
|
344
|
+
|
345
|
+
def valid_service?(service)
|
346
|
+
valid_services.include?(canonical_service(service))
|
347
|
+
end
|
348
|
+
|
349
|
+
def valid_services?(services)
|
350
|
+
services.all? do |service|
|
351
|
+
if valid_service?(service)
|
352
|
+
true
|
353
|
+
else
|
354
|
+
puts "'#{service}' is not valid. Must be one or more of these: #{valid_services.join(', ')}"
|
355
|
+
false
|
356
|
+
end
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
def sanitize_services(services)
|
361
|
+
return valid_services if !services || services.empty?
|
362
|
+
return false unless valid_services?(services)
|
363
|
+
services.map{|s| canonical_service(s) }
|
364
|
+
end
|
303
365
|
end
|
304
366
|
|
305
367
|
aliases = {
|
data/lib/dory/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Porter
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: colorize
|