learn-co 3.2.2 → 3.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/learn +10 -2
- data/lib/learn.rb +1 -0
- data/lib/learn/internet_connection.rb +13 -5
- data/lib/learn/options_sanitizer.rb +1 -1
- data/lib/learn/version.rb +1 -1
- 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: 1d4a3f8516ab46be85306ee6bc9a6001d0ef555c
|
4
|
+
data.tar.gz: 3147b7002e603ce89f80ab1882206d38ec1f883c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bed7b2a89906ca53bc39e0e4e867ebeb105f3791fa2f386eea348ab1caa25b2171ed68848f0ce12c7ec7b4541190849cfe3db06df04f53566cdc913bb724a488
|
7
|
+
data.tar.gz: 55b339b69fc0e6be65189886f611c96344a48bf5c62a6494083ff9a9050a3c9877bd08b81d1cbe0b1ac856ba18d820dcfcca011b176bbdbb369d018d13e47b9c
|
data/bin/learn
CHANGED
@@ -17,7 +17,16 @@ end
|
|
17
17
|
|
18
18
|
Learn::OptionsSanitizer.new(ARGV).sanitize!
|
19
19
|
|
20
|
-
|
20
|
+
# Legacy: leaving this in just in case we do decide to return to our previously
|
21
|
+
# extra-defensive auth checking
|
22
|
+
# if !(NON_PRE_CONFIG_COMMANDS.include?(ARGV[0]))
|
23
|
+
# system('learn-config') unless Learn::InternetConnection.no_internet_connection?
|
24
|
+
# end
|
25
|
+
|
26
|
+
netrc = LearnConfig::NetrcInteractor.new
|
27
|
+
token = netrc.read.password
|
28
|
+
|
29
|
+
if token.nil? || token == 'machine'
|
21
30
|
system('learn-config') unless Learn::InternetConnection.no_internet_connection?
|
22
31
|
end
|
23
32
|
|
@@ -26,4 +35,3 @@ if INTERNET_REQUIRED_COMMANDS.include?(ARGV[0])
|
|
26
35
|
end
|
27
36
|
|
28
37
|
Learn::CLI.start(ARGV)
|
29
|
-
|
data/lib/learn.rb
CHANGED
@@ -29,7 +29,7 @@ module Learn
|
|
29
29
|
test_connection
|
30
30
|
end
|
31
31
|
|
32
|
-
def test_connection
|
32
|
+
def test_connection(retries: 3)
|
33
33
|
begin
|
34
34
|
Timeout::timeout(5) do
|
35
35
|
resp = Net::HTTP.get(STATUS_URI)
|
@@ -42,13 +42,21 @@ module Learn
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
rescue Timeout::Error
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
if e.message.match(/getaddrinfo: nodename nor servname provided/)
|
45
|
+
if retries > 0
|
46
|
+
test_connection(retries: retries - 1)
|
47
|
+
else
|
49
48
|
self.connection = false
|
50
49
|
puts NO_INTERNET_MESSAGE if !silent
|
51
50
|
end
|
51
|
+
rescue SocketError => e
|
52
|
+
if e.message.match(/getaddrinfo: nodename nor servname provided/)
|
53
|
+
if retries > 0
|
54
|
+
test_connection(retries: retries - 1)
|
55
|
+
else
|
56
|
+
self.connection = false
|
57
|
+
puts NO_INTERNET_MESSAGE if !silent
|
58
|
+
end
|
59
|
+
end
|
52
60
|
rescue OpenSSL::SSL::SSLError
|
53
61
|
self.connection = false
|
54
62
|
puts "It looks like your SSL certificates aren't quite right."
|
data/lib/learn/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: learn-co
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.2.
|
4
|
+
version: 3.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Flatiron School
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|