learn-co 3.2.2 → 3.2.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a8a0eddf4971b3abd590149c8b88a443f97978be
4
- data.tar.gz: 52c4470e260735547775dd206da0f8d09857cf84
3
+ metadata.gz: 1d4a3f8516ab46be85306ee6bc9a6001d0ef555c
4
+ data.tar.gz: 3147b7002e603ce89f80ab1882206d38ec1f883c
5
5
  SHA512:
6
- metadata.gz: ded29eefc0083987059b25666cca7d0dacb0d6e107f88396807b0fa3e946a93172a6f6e659222e046a4af62c957f8f82f8a77001b7eb9276273e11719012fcb4
7
- data.tar.gz: 080a7a94b16e347aa3be0d011993c9b78c1415bd22b8542312cd6900c8ff4caf9222ffcb789b0d263ee7686b3babc124e7ff8eb3dfe0bb3873d0d4669a8946fa
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
- if !(NON_PRE_CONFIG_COMMANDS.include?(ARGV[0]))
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
-
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'learn_config'
2
3
 
3
4
  require 'learn/version'
4
5
  require 'learn/internet_connection'
@@ -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
- self.connection = false
46
- puts NO_INTERNET_MESSAGE if !silent
47
- rescue SocketError => e
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."
@@ -21,7 +21,7 @@ module Learn
21
21
  'next',
22
22
  'doctor',
23
23
  'new',
24
- 'status',
24
+ 'status',
25
25
  'lint',
26
26
  'hello',
27
27
  'save'
@@ -1,3 +1,3 @@
1
1
  module Learn
2
- VERSION = '3.2.2'
2
+ VERSION = '3.2.3'
3
3
  end
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.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-28 00:00:00.000000000 Z
11
+ date: 2015-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler