Class: Greyatom::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/greyatom/cli.rb

Instance Method Summary collapse

Instance Method Details

#helloObject



11
12
13
# File 'lib/greyatom/cli.rb', line 11

def hello()
  puts "Hello World!"
end

#openObject



39
40
41
42
# File 'lib/greyatom/cli.rb', line 39

def open()
  # Fork and Clone User's current lesson
  Greyatom::Open.new().openALesson
end

#resetObject



34
35
36
# File 'lib/greyatom/cli.rb', line 34

def reset()
  Greyatom::User.new().confirmAndReset
end

#setup(retries: 5) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/greyatom/cli.rb', line 16

def setup(retries: 5)
  # Check if token already present
  , password = Greyatom::NetrcInteractor.new().read
  if .nil? || password.nil?
    print 'Enter your github token here and press [ENTER]: '
    password = STDIN.gets.chomp
    if password.empty?
      puts "No token provided."
      exit
    end
  end
  # Check if token is valid
  user = Greyatom::User.new()
  user.validate(password)
  user.setDefaultWorkspace
end

#submitObject



45
46
47
# File 'lib/greyatom/cli.rb', line 45

def submit()
  Greyatom::Submit.new().run
end

#testObject



50
51
52
53
# File 'lib/greyatom/cli.rb', line 50

def test()
  puts 'Testing...'
  Greyatom::Test.new().run
end

#versionObject



56
57
58
# File 'lib/greyatom/cli.rb', line 56

def version
  puts Greyatom::Cli::VERSION
end