dory 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/dory +45 -0
  3. data/lib/dory/version.rb +2 -2
  4. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53c6457eeee8b8c77ee2373629fec053be1a38af
4
- data.tar.gz: c58d1b2cc83521c5c708b7e3acaa6039fb201687
3
+ metadata.gz: 9fac20130cea7a196f113155900f525eba858463
4
+ data.tar.gz: 4f327801e90236e7b2ac714a56d122b89a102f49
5
5
  SHA512:
6
- metadata.gz: 0f9ce5a80dcc586ff1e274537ad6b92aa8ca8b70280d64ee16e03111dcd7bfed107b87c6ca25e1db75a2f623ac91ccb5af7687c48923cbcf55a9670adbea6265
7
- data.tar.gz: 49bb7575f2d686660a5b0d9affa7d05e1c1b312097bf6a1ab3013674ce5ba1761bda705148e040a2913c2854a9b4b6ae724ddbf9e3f80722200814f950925632
6
+ metadata.gz: e1ccedc5f0042d52b5c1202a4c60a024136e3ab727a84f64cc3063f540131558aeb3d85bc0644c4664c958ae90bf1bd35165e48b7d69201103fd968e46a61aa2
7
+ data.tar.gz: f852455efc767b44713bc4567d197dc7559a4e7f11c74f26479426c9c6530498b3ee003a4f860424d7836e6eed3e9a38c34be2a4273cd4b5cab30d74712fff30
data/bin/dory CHANGED
@@ -90,6 +90,8 @@ class DoryBin < Thor
90
90
  Writes a dory config file to #{Dory::Config.filename}
91
91
  containing the default settings. This can then be configured
92
92
  as preferred.
93
+
94
+ > $ dory config-file [--upgrade] [--force]
93
95
  LONGDESC
94
96
  option :upgrade, type: :boolean, aliases: 'u', default: false
95
97
  option :force, type: :boolean, aliases: 'f', default: false
@@ -97,8 +99,45 @@ class DoryBin < Thor
97
99
  exec_config_file(options)
98
100
  end
99
101
 
102
+ desc 'attach', 'Attach to the output of a docker service container'
103
+ long_desc <<-LONGDESC
104
+ For the nginx proxy and dnsmasq containers, this command
105
+ provides a pass-through to the underlying docker attach command.
106
+ It is simply more convenient than looking up the docker
107
+ container name and using the equivalent 'docker attach'
108
+
109
+ > $ dory attach [proxy] [dns]
110
+ LONGDESC
111
+ def attach(service)
112
+ exec_attach(service, options)
113
+ end
114
+
100
115
  private
101
116
 
117
+ def exec_attach(service, _options)
118
+ s = sanitize_service(service)
119
+ mod = if s == 'proxy'
120
+ Dory::Proxy
121
+ elsif s == 'dns'
122
+ Dory::Dnsmasq
123
+ else
124
+ nil
125
+ end
126
+ if mod
127
+ if mod.running?
128
+ puts "Note that if you Ctrl + C after attaching,".yellow
129
+ puts "the service will need to be restarted.".yellow
130
+ puts "Service '#{service}' is running.".green
131
+ puts "Attaching to docker container '#{mod.container_name}'...".green
132
+ exec("docker attach #{mod.container_name}")
133
+ else
134
+ puts "Service '#{service}' is not running. Cannot attach".red
135
+ end
136
+ else
137
+ puts "Can only attach to 'proxy' or 'dns'".red
138
+ end
139
+ end
140
+
102
141
  def exec_upgrade(_options)
103
142
  puts "Checking if dory has updates available...".green
104
143
  new_version = Dory::Upgrade.new_version
@@ -357,6 +396,12 @@ class DoryBin < Thor
357
396
  end
358
397
  end
359
398
 
399
+ def sanitize_service(service)
400
+ return false if service.nil? || service.empty?
401
+ return false unless valid_service?(service)
402
+ canonical_service(service)
403
+ end
404
+
360
405
  def sanitize_services(services)
361
406
  return valid_services if !services || services.empty?
362
407
  return false unless valid_services?(services)
@@ -1,4 +1,4 @@
1
1
  module Dory
2
- VERSION = '0.3.3'
3
- DATE = '2016-07-10'
2
+ VERSION = '0.3.4'
3
+ DATE = '2016-07-26'
4
4
  end
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.3.3
4
+ version: 0.3.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-07-10 00:00:00.000000000 Z
11
+ date: 2016-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -174,3 +174,4 @@ specification_version: 4
174
174
  summary: slackbot_frd provides a dirt-simple framework for implementing one or more
175
175
  slack bots
176
176
  test_files: []
177
+ has_rdoc: