class LearnLab::CLI
Command-line interface.
Public Instance Methods
config()
click to toggle source
# 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
test()
click to toggle source
rubocop:disable Metrics/MethodLength
# 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
Private Instance Methods
chunk(string, size)
click to toggle source
# File lib/learn_lab/cli.rb, line 53 def chunk(string, size) string.scan(/.{1,#{size}}/) end