Class: GreenDay::Cli

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

Instance Method Summary collapse

Instance Method Details

#loginObject



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/green_day/cli.rb', line 13

def 
  print 'username:'
  username = $stdin.gets(chomp: true)
  print 'password:'
  password = $stdin.noecho { |stdin| stdin.gets(chomp: true) }.tap { puts }

  AtcoderClient.(username, password)
  puts(
    "Successfully created #{AtcoderClient::COOKIE_FILE_NAME}"
    .colorize(:green)
  )
end

#new(contest_name) ⇒ Object



27
28
29
30
31
32
33
# File 'lib/green_day/cli.rb', line 27

def new(contest_name)
  contest = Contest.new(contest_name)
  FileUtils.makedirs("#{contest.name}/spec")

  TaskSourceToFileWorker.run_threads(contest.task_sources).each(&:join)
  puts "Successfully created #{contest.name} directory".colorize(:green)
end