Class: CommitLive::CLI
- Inherits:
-
Thor
- Object
- Thor
- CommitLive::CLI
- Defined in:
- lib/commit-live/cli.rb
Instance Method Summary collapse
- #hello ⇒ Object
- #open(track_slug) ⇒ Object
- #reset ⇒ Object
- #setup(retries: 5) ⇒ Object
- #submit(track_slug) ⇒ Object
- #test(track_slug) ⇒ Object
- #version ⇒ Object
Instance Method Details
#hello ⇒ Object
12 13 14 |
# File 'lib/commit-live/cli.rb', line 12 def hello() puts "Hello World!" end |
#open(track_slug) ⇒ Object
46 47 48 |
# File 'lib/commit-live/cli.rb', line 46 def open(track_slug) CommitLive::Open.new().openALesson(track_slug) end |
#reset ⇒ Object
41 42 43 |
# File 'lib/commit-live/cli.rb', line 41 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 33 34 35 36 37 38 |
# File 'lib/commit-live/cli.rb', line 17 def setup(retries: 5) # Check if token already present login, password = CommitLive::NetrcInteractor.new().read if login.nil? || password.nil? print 'Enter User-ID here and press [ENTER]: ' login = STDIN.gets.chomp if login.empty? puts "No User-ID provided." exit end print 'Enter Access 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(login, password) user.setDefaultWorkspace end |
#submit(track_slug) ⇒ Object
51 52 53 |
# File 'lib/commit-live/cli.rb', line 51 def submit(track_slug) CommitLive::Submit.new().run(track_slug) end |
#test(track_slug) ⇒ Object
56 57 58 |
# File 'lib/commit-live/cli.rb', line 56 def test(track_slug) CommitLive::Test.new(track_slug).run end |
#version ⇒ Object
61 62 63 |
# File 'lib/commit-live/cli.rb', line 61 def version puts CommitLive::Cli::VERSION end |