Class: LearnLab::CLI
- Inherits:
-
Thor
- Object
- Thor
- LearnLab::CLI
- Defined in:
- lib/learn_lab/cli.rb
Overview
Command-line interface.
Instance Method Summary collapse
- #config ⇒ Object
-
#test ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength.
Instance Method Details
permalink #config ⇒ Object
[View source]
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/learn_lab/cli.rb', line 35 def config configuration = Configuration.open email = configuration.email || '<not set>' question = "Enter the email you use to log into Canvas\n" \ "(your current email is '#{email}'):" prompt = Prompt.new # TODO: What kind of email validation do we want here? configuration.email = prompt.ask(question) { |value| !value.empty? } configuration.save! puts 'Configuration saved!' end |
permalink #test ⇒ Object
rubocop:disable Metrics/AbcSize rubocop:disable Metrics/MethodLength
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/learn_lab/cli.rb', line 14 def test configuration = Configuration.open unless configuration.valid? puts 'Please run `learn-lab config` first' exit 0 end repo = VCS.new(LearnLab.file_system.pwd) results = LearnLab::Test::Runner.new(repo).run exit 0 unless results[:failure_count].zero? token = Token.new(configuration.email, repo.remote_url) puts "Your token is:\n\n" puts chunk(token.encoded, 30) end |