lux 1.0.8 → 1.0.9
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/CHANGELOG +7 -0
- data/lib/lux.rb +19 -17
- data/lib/lux/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b33a925f4741864c351ea1cd82d4ddaec70df75d
|
4
|
+
data.tar.gz: e6b6a2f15e7109c3a72238a782fcb5dd5b34883c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1cb51a17a4438e7c25b3151b28c350cb82f2c7aadb7ff3d44141b7f31d71ff26207538eccfdb047f9652f43a2fecef92530f2b5c041178eada76ac55c36fd06e
|
7
|
+
data.tar.gz: 5179c4addbd373575ad0efa637b273326fd46c1502bb02521479d8ca915c36c4dfe8ed056412d61942cf340230c427b7980a36e496c487c758ddd835a59ae053
|
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
lux (1.0.9)
|
2
|
+
|
3
|
+
* Use docker-api gem to determine Docker URL, not environment
|
4
|
+
* Return '127.0.0.1' as address if Unix socket (for Docker for Mac)
|
5
|
+
|
6
|
+
-- Nick Townsend <nick.townsend@mac.com> Tue, 27 Dec 2016 11:12:10 -0700
|
7
|
+
|
1
8
|
lux (1.0.8)
|
2
9
|
|
3
10
|
* Don't prompt to select image if only one matches
|
data/lib/lux.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'highline/import'
|
2
|
+
require 'docker'
|
2
3
|
require 'uri'
|
3
4
|
require 'socket'
|
4
5
|
require 'json'
|
@@ -10,29 +11,30 @@ module Lux
|
|
10
11
|
# Determine the IPv4 address of the current Docker host
|
11
12
|
# Used to avoid long reverse DNS lookups on .local names
|
12
13
|
# Returns an array of four items:
|
13
|
-
# - the IPv4 address as a string or
|
14
|
-
#
|
15
|
-
# - a string saying which variable was used, 'URL' or 'HOST'
|
14
|
+
# - the IPv4 address as a string or '127.0.0.1' if it was a Unix socket
|
15
|
+
# - Used to indicate ENV var, now empty
|
16
16
|
# - a URI object
|
17
17
|
# - a hash containing the Docker version information
|
18
18
|
# Note that DOCKER_URL is used by the docker-api client, but
|
19
19
|
# as Docker uses the misleading DOCKER_HOST we fallback to that.
|
20
20
|
#
|
21
21
|
def dockerip
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
22
|
+
uri = URI.parse(Docker.url)
|
23
|
+
case uri.scheme
|
24
|
+
when 'unix'
|
25
|
+
addr = '127.0.0.1'
|
26
|
+
info = Docker.version
|
27
|
+
when 'tcp'
|
28
|
+
Addrinfo.tcp(uri.host, uri.port).connect(timeout: 5) {|s|
|
29
|
+
addr = s.remote_address.ip_address
|
30
|
+
s.print "GET /version HTTP/1.0\r\nHost: localhost\r\n\r\n"
|
31
|
+
response, emptyline, body = s.read.partition(/(\r\n){2}/)
|
32
|
+
info = JSON.parse(body, symbolize_names: true)
|
33
|
+
} rescue nil
|
34
|
+
else
|
35
|
+
raise "Can't handle #{uri.scheme}"
|
36
|
+
end
|
37
|
+
return addr, '', uri, info
|
36
38
|
end
|
37
39
|
|
38
40
|
# Get the current list of images and make a guess at which one it is...
|
data/lib/lux/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Townsend
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-12-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -123,9 +123,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
123
123
|
version: '0'
|
124
124
|
requirements: []
|
125
125
|
rubyforge_project:
|
126
|
-
rubygems_version: 2.
|
126
|
+
rubygems_version: 2.5.2
|
127
127
|
signing_key:
|
128
128
|
specification_version: 4
|
129
129
|
summary: Handy utilities for working with Docker
|
130
130
|
test_files: []
|
131
|
-
has_rdoc:
|