Sha256: c12835372123004cbf325de97700bc31fde3ba5b98444ec7db42ee005838a99a

Contents?: true

Size: 1.1 KB

Versions: 27

Compression:

Stored size: 1.1 KB

Contents

#!/usr/bin/env ruby

require 'learn'

NON_PRE_CONFIG_COMMANDS = [
  'reset', 'whoami', 'directory', 'help', 'version', '--version', '-v', 'doctor', 'new', 'hello', 'lint', 'save'
]

INTERNET_REQUIRED_COMMANDS = [
  'whoami', 'doctor', 'directory', 'reset', 'hello'
]

LEARN_CONFIG_COMMANDS = ['reset', 'whoami', 'directory']

if ['-v', '--version'].include?(ARGV.first)
  puts Learn::VERSION
  exit
end

Learn::OptionsSanitizer.new(ARGV).sanitize!

# Legacy: leaving this in just in case we do decide to return to our previously
#         extra-defensive auth checking
# if !(NON_PRE_CONFIG_COMMANDS.include?(ARGV[0]))
  # system('learn-config') unless Learn::InternetConnection.no_internet_connection?
# end

netrc = Learn::NetrcInteractor.new
netrc.read
token = netrc.password

if !LEARN_CONFIG_COMMANDS.include?(ARGV[0]) && (token.nil? || token == 'machine' || !File.exist?(File.expand_path('~/.learn-config')))
  system('learn-config') unless Learn::InternetConnection.no_internet_connection?
end

if INTERNET_REQUIRED_COMMANDS.include?(ARGV[0])
  Learn::InternetConnection.test_connection
end

Learn::CLI.start(ARGV)

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
learn-co-3.3.0.pre bin/learn
learn-co-3.2.20 bin/learn
learn-co-3.2.19 bin/learn
learn-co-3.2.18 bin/learn
learn-co-3.2.17 bin/learn
learn-co-3.2.16 bin/learn
learn-co-3.2.15 bin/learn