sh19910711 / git-contest

Git extension for the online judges
https://rubygems.org/gems/git-contest
MIT License
11 stars 5 forks source link

Separate contest driver from git-contest as another project #31

Open sh19910711 opened 10 years ago

sh19910711 commented 10 years ago

I am thinking about divide contest drivers into separate projects from git-contest.

New architecture image is below: New Architecture Image

The Driver Base provides inner-DSL on Ruby to write driver class more clearly. Here is a pseudo code for driver:

# some_online_judge_driver.rb
driver :some_online_judge do
  name "Some Online Judge"
  short_name "SOJ"
  desc "submit to SOJ [http://url/to/soj]"

  option :user_id
  option :user_password

  # fire `before_submit` event
  submit do
    # code to submit solution

    # fire `before_login` event
    login do
      # code to auth
    end
    # fire `after_login` event

    # fire `before_send` event
    send do
      # code to send solution
    end
    # fire `after_send` event

    # fire `before_wait` event
    wait do
      # code to wait submission status
    end
    # fire `after_wait` event

    # fire `before_no_wait` event
    no_wait do
      # code to no-wait submission status
    end
    # fire `after_no_wait` event

    # return submission status
  end
  # fire `after_submit` event
end

It is used as below:

require 'some_online_judge_driver'

soj = SomeOnlineJudge.new

# set option
soj.option[:user_id] = "your id"
soj.option[:user_password] = ""

# listen driver event
soj.on :before_login do
  puts "log: before login"
end
soj.on :after_login do
  puts "log: after login"
end

# submit solution
res = soj.submit(
  :source => "path/to/file.cpp"
)

puts "status: #{res}"
sh19910711 commented 10 years ago

The basic idea is as above. I will implement and proceed this project from now on. Could you give me a hand in implementation of inner-DSL please?

cc: @osund

osund commented 10 years ago

@sh19910711 Seems like a good idea. Sure, I can try to help but I don't have much Ruby experience, so I don't think I will be able to help much when it comes to creating a DSL in Ruby. Do you mean I should help you reimplementing the drivers in the DSL or implement the DSL itself (or both)?

sh19910711 commented 10 years ago

@osund Good :)

Do you mean I should help you reimplementing the drivers in the DSL or implement the DSL itself (or both)?

Yes, I mean both, but the first thing we should implement the DSL. It is fine if you do just the ones you understand.

The method of communication is by this thread, ok? I will contact you later when it is ready.

sh19910711 commented 9 years ago

Hi, I wrote a poster about git-contest and this project (contest-driver) for "RubyWorld Conference 2014" [1]. Here is a URL of the poster: http://docs.yomogimochi.com/ruby-wc/1414904336-git-contest.pdf

The implementation of contest-driver will be late, because I'm working on another project.

[1] http://www.rubyworld-conf.org/en/

osund commented 9 years ago

Okay, nice poster!