dory 0.5.1 → 0.5.2

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 +51 -0
  3. data/lib/dory/version.rb +2 -2
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c9a8eb4e309988a08bc4418c313cc5fcd942fef
4
- data.tar.gz: ea5da1d8d1541824b3566669565c614414e27ad3
3
+ metadata.gz: ed649cb5289752a049537d2bd38fae7e7834a84f
4
+ data.tar.gz: 941c32d3efd7be78416cbacc0b1033aa34331acb
5
5
  SHA512:
6
- metadata.gz: af839401db81b131b4bdd0a7f45d401f3cb796240dc8b256647f8073386dfc84093ab403d1d1adc31a5cb451e0ae67e6417c13b2beb19bb989ca959d4c683c3b
7
- data.tar.gz: eb51a6604b6539d11c164113557718ac2f028b636f283ee8293477416a3f4d88bbe038db5884bcf8bc070664614a0a1bfa26c053564313bdbc74608d57c066bc
6
+ metadata.gz: 4ea2d8ad43bae5f5235fe962b5ce64afa64267603915c65942f3938937e584448b0e4f4449bda8fe48a21a5b11690c722aea8b3bce4f90ccc8c6092305b75333
7
+ data.tar.gz: 7a2e0d0475f4b98762e4434bf2c661ae025472c8c4b83cb75107f0e39b860c810f00e1c7c1a93bef7fea975c5745d929a3c02091c9c22ae6b07d87bd95b03165
data/bin/dory CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'thor'
4
4
  require 'yaml'
5
+ require 'json'
5
6
 
6
7
  require 'dory'
7
8
 
@@ -126,6 +127,18 @@ class DoryBin < Thor
126
127
  exec_pull(services, options)
127
128
  end
128
129
 
130
+ desc 'ip', 'Grab the IPv4 address of a running dory service'
131
+ long_desc <<-LONGDESC
132
+ For the nginx proxy and dnsmasq containers, this command
133
+ grabs the IP address of the container. You could get this
134
+ info from `docker inspect` but this is more convenient.
135
+
136
+ > $ dory ip [proxy] [dns]
137
+ LONGDESC
138
+ def ip(service = nil)
139
+ exec_ip(service, options)
140
+ end
141
+
129
142
  private
130
143
 
131
144
  def exec_pull(services, _options)
@@ -162,6 +175,44 @@ class DoryBin < Thor
162
175
  end
163
176
  end
164
177
 
178
+ def exec_ip(service, _options)
179
+ s = sanitize_service(service)
180
+ mod = if s == 'proxy'
181
+ Dory::Proxy
182
+ elsif s == 'dns'
183
+ Dory::Dnsmasq
184
+ else
185
+ nil
186
+ end
187
+ if mod
188
+ unless mod.running?
189
+ puts "Service '#{service}' is not running. Starting...".green
190
+ if mod.start
191
+ puts "Service '#{service}' successfully started.".green
192
+ else
193
+ puts "Error starting service '#{service}'".red
194
+ end
195
+ end
196
+ if mod.running?
197
+ inspect = Dory::Sh.run_command("docker inspect #{mod.container_name}")
198
+ if inspect.success?
199
+ begin
200
+ puts JSON.parse(inspect.stdout).first['NetworkSettings']['IPAddress']
201
+ rescue StandardError => e
202
+ puts "Error parsing JSON from container #{mod.container_name}:".red
203
+ puts e.message.red
204
+ end
205
+ else
206
+ puts "Error inspecting docker container #{mod.container_name}!".red
207
+ end
208
+ else
209
+ puts "Service '#{service}' is not running. Cannot get IP address".red
210
+ end
211
+ else
212
+ puts "Can only get IP address for 'proxy' or 'dns'".red
213
+ end
214
+ end
215
+
165
216
  def exec_attach(service, _options)
166
217
  s = sanitize_service(service)
167
218
  mod = if s == 'proxy'
@@ -1,4 +1,4 @@
1
1
  module Dory
2
- VERSION = '0.5.1'
3
- DATE = '2016-02-15'
2
+ VERSION = '0.5.2'
3
+ DATE = '2016-03-22'
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.5.1
4
+ version: 0.5.2
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-02-15 00:00:00.000000000 Z
11
+ date: 2016-03-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colorize
@@ -183,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  version: '0'
184
184
  requirements: []
185
185
  rubyforge_project:
186
- rubygems_version: 2.2.5
186
+ rubygems_version: 2.5.2
187
187
  signing_key:
188
188
  specification_version: 4
189
189
  summary: Your development proxy for Docker