git-contest 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZGQ2NTE5NDhhOWRkNzE0NzFmZjUzNzJkNjJlYWY1OGFiNzhkOThjNw==
4
+ OTU4MGU4ZDMzZDI2YTg0NDZkM2YwYjI4MzRiNzY0MjIyZTExMGMyMQ==
5
5
  data.tar.gz: !binary |-
6
- NGM5NDUwYzU4MjY4MDM0Mjg1ZDcxZmEzZWIyNzE1ZmUxZmFjNWFjYg==
6
+ OGE1NDk3ZTMxODExNWM0YzY1ZjEzNzViOWQ4YjhiNTljYjU4M2RjZQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NTBjYTRhYjdmMmQ1MDJiNzNjYmQwNTdjZThmYTczNmQ5Y2JkYTZiMmE3NzY3
10
- NjBmMmJmNzkxNzFkNDJjM2NmZTBlMTA0Mjg2Mzk0OTBmZWJmMGY3ZTMzYjAw
11
- ZjQyM2ExYzExNjYwZWMzNDhhMWYyZmMwZTViM2M5Y2QyMGY5MzU=
9
+ YmU5NGFlMDEwNTYzMTA4ZGZkM2Y1ZWUzOTkwNjc5YzdmMDlhMzU2ZTRjY2Jm
10
+ MmI3MzYyNmRhNDI0N2FmZDliNzEwNjMzODJiYzA0MDlkZjllMjM2YzcwNTE5
11
+ YzkzMjM0MDQzMmZmZDAxODk4MmU2ZTE1YTE2YWNiOWExNTg3ZDU=
12
12
  data.tar.gz: !binary |-
13
- MzhiOTBkOWI2OTQ5Y2Q0YmQ0Y2E1OGY3Mjk0NDU1M2QyYWM1YWE0YjQzMzg0
14
- ZTI2NGE1NTQ4MjQ4NTkwMjljYTM4NDE1YTg2ZTIyZjQ1MTU1MWViODI4NGY3
15
- NzI5ZmRkYjFmNTE4ZTUyMjBlMGYzMDY3NmYyZjQwYzA0MzJkOWU=
13
+ YjgxYzc2NDc3YjUyNjVjZGU0ZDYxZTI0ZThmODk0ZGQ1MTVhZWVlOWU1ODdm
14
+ YmIxZDZmZGIwODFiOGE0ZWY3MzY3Mzk1YzA3ZTA1MDdiYTAzYTM5ZDgyMTJl
15
+ YjEyMjdmNzQ3ZDMzNzk2OTAwMzQ2MDA3MmQ5YzI2MjM0OTRjMmM=
@@ -176,7 +176,6 @@ driver.on(
176
176
  puts " %s: %s" % ["submission id", "#{submission_info[:submission_id]}"]
177
177
  puts " %s: %s" % ["status", "#{submission_info[:status]}"]
178
178
  puts ""
179
- p submission_info
180
179
  if git_contest_is_initialized
181
180
  git_do "add #{get_git_add_target($config["submit_rules"]["add"] || ".")}"
182
181
  git_do "commit --allow-empty -m '#{submission_info[:result]}'"
@@ -39,6 +39,8 @@ module Contest
39
39
  return "1"
40
40
  when "cpp"
41
41
  return "3"
42
+ when "cpp11"
43
+ return "5"
42
44
  when "java"
43
45
  return "2"
44
46
  when "pascal"
@@ -91,6 +93,15 @@ module Contest
91
93
  get_commit_message(status)
92
94
  end
93
95
 
96
+ def is_wait_status(status)
97
+ case status
98
+ when "Sent to judge", "Running", "Compiling", "Linking", "Received", ""
99
+ true
100
+ else
101
+ false
102
+ end
103
+ end
104
+
94
105
  def get_status_wait(submission_id)
95
106
  submission_id = submission_id.to_s
96
107
  # wait result
@@ -98,7 +109,7 @@ module Contest
98
109
  sleep 10
99
110
  my_page = @client.get 'http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=9'
100
111
  status = get_submission_status(submission_id, my_page.body)
101
- return status unless status == 'Sent to judge' || status == ''
112
+ return status unless is_wait_status status
102
113
  trigger 'retry'
103
114
  end
104
115
  trigger 'timeout'
@@ -7,6 +7,6 @@
7
7
 
8
8
  module Git
9
9
  module Contest
10
- VERSION = "0.1.0"
10
+ VERSION = "0.1.1"
11
11
  end
12
12
  end
@@ -176,5 +176,42 @@ describe "T003: UvaOnlineJudge Driver" do
176
176
  @flag.should === true
177
177
  end
178
178
  end
179
+
180
+ context "A004: #is_wait_status" do
181
+ context "wait" do
182
+ it "Sent to judge" do
183
+ @driver.is_wait_status("Sent to judge").should be true
184
+ end
185
+ it "Running" do
186
+ @driver.is_wait_status("Running").should be true
187
+ end
188
+ it "Compiling" do
189
+ @driver.is_wait_status("Running").should be true
190
+ end
191
+ it "Linking" do
192
+ @driver.is_wait_status("Linking").should be true
193
+ end
194
+ it "Received" do
195
+ @driver.is_wait_status("Received").should be true
196
+ end
197
+ it "empty" do
198
+ @driver.is_wait_status("").should be true
199
+ end
200
+ end
201
+ context "no wait" do
202
+ it "Accepted" do
203
+ @driver.is_wait_status("Accepted").should be false
204
+ end
205
+ it "Compilation error" do
206
+ @driver.is_wait_status("Compilation error").should be false
207
+ end
208
+ it "Wrong answer" do
209
+ @driver.is_wait_status("Wrong answer").should be false
210
+ end
211
+ it "Runtime error" do
212
+ @driver.is_wait_status("Runtime error").should be false
213
+ end
214
+ end
215
+ end
179
216
  end
180
217
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: git-contest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hiroyuki Sano
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-01-19 00:00:00.000000000 Z
11
+ date: 2014-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize