omegaup 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/lib/omega/cli.rb +19 -15
- data/lib/omega/cli/contest.rb +10 -0
- data/lib/omega/contest.rb +12 -5
- data/lib/omega/contest_run.rb +2 -0
- data/lib/omega/scoreboard.rb +1 -2
- data/lib/omega/version.rb +1 -1
- data/omega.gemspec +4 -0
- metadata +58 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de5fc0741a09e56d1c27cb5af631d3b966d7e2141e412174ec1975dbf8c87cf9
|
4
|
+
data.tar.gz: a70008f5e26bc8927b00fa925188c2e76e3a8497835021731dd0d54d02d8506c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f970627e3fcf17db767d1dd7613f4e566b879a644bbb589815614cae11496afd1bff06664a0bb6b1f91c1fecb0bda023b9c8ea0d6daf3d665c132f780792e9f
|
7
|
+
data.tar.gz: dae56c4d719e2af83459fee4510a73dce522f272540e1f43b98b7cc40378fd4532f205f4f621c97f74e704bcb01f0d884c4de610e46336cb3af90bfa05568a5c
|
data/.rubocop.yml
CHANGED
data/lib/omega/cli.rb
CHANGED
@@ -19,30 +19,32 @@ module Omega
|
|
19
19
|
help
|
20
20
|
].freeze
|
21
21
|
|
22
|
-
|
23
|
-
puts %(
|
22
|
+
GENERAL_DOC = %(
|
24
23
|
OmegaUp CLI. Developed by OMIJal https://github.com/omijal/omegaup-cli.
|
25
24
|
Tool for interacting with omegaup from CLI and available throug ruby gems.
|
26
25
|
Commands:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
26
|
+
- register-users Add a user or a bunch of users to the a contest.
|
27
|
+
- user Generates a dump of the user data in yml format.
|
28
|
+
- scoreboard Gets contest scoreboard with users and score.
|
29
|
+
- clarifications Gets contest clarifications.
|
30
|
+
- sources Downloads all code sources into path
|
32
31
|
Parametes:
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
32
|
+
--contest Contest name
|
33
|
+
--user Username or email
|
34
|
+
--user-file A file path containing a list of user one per line without
|
35
|
+
header
|
36
|
+
--open Filter to only open clarifications
|
37
|
+
--path Path to store results
|
39
38
|
Setup:
|
40
39
|
You need to add two env variables with your omegaup credentials.
|
41
40
|
OMEGAUP_URL *Optional* This is intended for development purpose, it will target
|
42
|
-
|
41
|
+
to https://omegaup.com by default.
|
43
42
|
OMEGAUP_USER *Required* Your OmegaUp Username or Email
|
44
43
|
OMEGAUP_PASS *Required* Your OmegaUp Password
|
45
|
-
|
44
|
+
)
|
45
|
+
|
46
|
+
def print_help
|
47
|
+
puts GENERAL_DOC
|
46
48
|
end
|
47
49
|
|
48
50
|
def initialize(_)
|
@@ -53,6 +55,7 @@ OMEGAUP_PASS *Required* Your OmegaUp Password
|
|
53
55
|
Optimist.options do
|
54
56
|
opt :contest, 'Contest ShortName or identifier', type: :string
|
55
57
|
opt :user, 'Username or email', type: :string
|
58
|
+
opt :from, 'Another constest that allows to clone users from another contest', type: :string
|
56
59
|
opt :user_file, 'A file containing the users list one per line and without header', type: :string
|
57
60
|
end
|
58
61
|
when 'user'
|
@@ -107,6 +110,7 @@ OMEGAUP_PASS *Required* Your OmegaUp Password
|
|
107
110
|
when 'register-users'
|
108
111
|
register_user(@cmd_opts[:contest], @cmd_opts[:user]) if @cmd_opts[:user]
|
109
112
|
register_users(@cmd_opts[:contest], @cmd_opts[:user_file]) if @cmd_opts[:user_file]
|
113
|
+
copy_users(@cmd_opts[:contest], @cmd_opts[:from]) if @cmd_opts[:from]
|
110
114
|
when 'user'
|
111
115
|
user_data(@cmd_opts[:user])
|
112
116
|
when 'scoreboard'
|
data/lib/omega/cli/contest.rb
CHANGED
@@ -24,6 +24,16 @@ module Omega
|
|
24
24
|
puts "Failed users: \n- #{failed.join("\n- ")}"
|
25
25
|
end
|
26
26
|
|
27
|
+
def copy_users(contest, from)
|
28
|
+
target = omega.contest(contest)
|
29
|
+
source = omega.contest(from)
|
30
|
+
source.users.each do |user|
|
31
|
+
target.add_user(user)
|
32
|
+
rescue StandardError => e
|
33
|
+
puts "Error adding #{user}: #{e.message}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
27
37
|
def user_data(user)
|
28
38
|
puts omega.user(user).full_data.to_yaml
|
29
39
|
end
|
data/lib/omega/contest.rb
CHANGED
@@ -39,6 +39,10 @@ module Omega
|
|
39
39
|
@client.clarifications(data[:alias])
|
40
40
|
end
|
41
41
|
|
42
|
+
def users
|
43
|
+
scoreboard.users
|
44
|
+
end
|
45
|
+
|
42
46
|
def observe(score_notifier, clar_noritifer)
|
43
47
|
last = current = scoreboard
|
44
48
|
sleep(5)
|
@@ -47,8 +51,8 @@ module Omega
|
|
47
51
|
clarifications.select { |clar| clar[:answer].nil? || clar[:answer].empty? }
|
48
52
|
.each { |clar| clar_noritifer.call(clar) }
|
49
53
|
sleep(300)
|
50
|
-
rescue StandardError =>
|
51
|
-
puts
|
54
|
+
rescue StandardError => e
|
55
|
+
puts e.message
|
52
56
|
sleep(3000)
|
53
57
|
end
|
54
58
|
end
|
@@ -62,14 +66,17 @@ module Omega
|
|
62
66
|
current_problem = current_score.score_for(name)
|
63
67
|
last_points = problem[:points]
|
64
68
|
current_points = current_problem[:points]
|
65
|
-
|
69
|
+
if current_points != last_points
|
70
|
+
score_notifier.call(data[:alias], score.username, name, current_points, last_points,
|
71
|
+
data[:alias])
|
72
|
+
end
|
66
73
|
end
|
67
74
|
end
|
68
75
|
# puts '-' * 60
|
69
76
|
last = current
|
70
77
|
sleep(15)
|
71
|
-
rescue StandardError =>
|
72
|
-
puts
|
78
|
+
rescue StandardError => e
|
79
|
+
puts e.message
|
73
80
|
sleep(3000)
|
74
81
|
end
|
75
82
|
end
|
data/lib/omega/contest_run.rb
CHANGED
data/lib/omega/scoreboard.rb
CHANGED
data/lib/omega/version.rb
CHANGED
data/omega.gemspec
CHANGED
@@ -26,5 +26,9 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency 'httparty'
|
27
27
|
spec.add_development_dependency 'minitest', '~> 5'
|
28
28
|
spec.add_development_dependency 'optimist'
|
29
|
+
spec.add_development_dependency 'rack-minitest'
|
30
|
+
spec.add_development_dependency 'webmock'
|
31
|
+
spec.add_development_dependency 'mocha'
|
32
|
+
spec.add_development_dependency 'simplecov'
|
29
33
|
spec.add_development_dependency 'rake', '~> 10.0'
|
30
34
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omegaup
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gilberto Vargas
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: amazing_print
|
@@ -66,6 +66,62 @@ dependencies:
|
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rack-minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: webmock
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: mocha
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: simplecov
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
69
125
|
- !ruby/object:Gem::Dependency
|
70
126
|
name: rake
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|