Class: CommitLive::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/commit-live/cli.rb

Instance Method Summary collapse

Instance Method Details

#helloObject



12
13
14
# File 'lib/commit-live/cli.rb', line 12

def hello()
	puts "Hello World!"
end

#open(*puzzle_name) ⇒ Object



40
41
42
43
44
# File 'lib/commit-live/cli.rb', line 40

def open(*puzzle_name)
	# Fork and Clone User's current lesson
	lab_name = CommitLive::Puzzle::Parser.new(puzzle_name.join(' ')).parse!
	CommitLive::Open.new().openALesson(lab_name)
end

#resetObject



35
36
37
# File 'lib/commit-live/cli.rb', line 35

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

#setup(retries: 5) ⇒ Object



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

def setup(retries: 5)
	# Check if token already present
	, password = CommitLive::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 = CommitLive::User.new()
	user.validate(password)
	user.setDefaultWorkspace
end

#submitObject



47
48
49
# File 'lib/commit-live/cli.rb', line 47

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

#testObject



52
53
54
55
# File 'lib/commit-live/cli.rb', line 52

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

#versionObject



58
59
60
# File 'lib/commit-live/cli.rb', line 58

def version
	puts CommitLive::Cli::VERSION
end