Class: AtcoderTools::CLI
- Inherits:
-
Thor
- Object
- Thor
- AtcoderTools::CLI
- Defined in:
- lib/atcoder_tools/cli.rb
Instance Method Summary collapse
- #create(contest_name) ⇒ Object
- #delete(contest_name) ⇒ Object
- #start ⇒ Object
- #submit(contest_name, task_name) ⇒ Object
Instance Method Details
#create(contest_name) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/atcoder_tools/cli.rb', line 11 def create(contest_name) contest = Contest.new(contest_name) contest.create! puts 'successfully created' end |
#delete(contest_name) ⇒ Object
47 48 49 50 51 |
# File 'lib/atcoder_tools/cli.rb', line 47 def delete(contest_name) FileUtils.rm_rf(contest_name) FileUtils.rm_rf(".atcoder/#{contest_name}") puts 'successfully deleted' end |
#start ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/atcoder_tools/cli.rb', line 19 def start # system('bundle exec guard -d --guardfile .atcoder/Guardfile') listener = Listen.to('.', ignore: /.atcoder\/.*/) do |modified, added, removed| # puts "modified absolute path: #{modified}" # puts "added absolute path: #{added}" # puts "removed absolute path: #{removed}" if modified[0] contest_name ,task_name = modified[0].split('/')[-2..-1] task_name = task_name[..-4] # .rb抜き出し puts("#{contest_name}/#{task_name}.rb was changed") contest = Contest.new(contest_name) # thor と名前空間がかぶっているため task = ::Task.new(contest, task_name) task.run end end listener.start # not blocking sleep end |
#submit(contest_name, task_name) ⇒ Object
42 43 44 |
# File 'lib/atcoder_tools/cli.rb', line 42 def submit(contest_name, task_name) puts("まだ実装してないよ!") end |