judge_system 1.6.2 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/judge_system.gemspec +2 -1
- data/lib/compile_systems/c_system.rb +9 -2
- data/lib/compile_systems/cpp_system.rb +9 -2
- data/lib/compile_systems/go_system.rb +9 -2
- data/lib/compile_systems/py_system.rb +9 -2
- data/lib/compile_systems/rb_system.rb +9 -2
- data/lib/compile_systems/swift_system.rb +9 -2
- data/lib/judge_system.rb +1 -1
- data/lib/judge_system/version.rb +1 -1
- data/lib/zlib_input.rb +9 -6
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b660aa3bec0dbf79d34e989d520db2ac8e054297
|
4
|
+
data.tar.gz: e89140416835964c8c316542e7f024b0533a5684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e74f4e301741e5f9ffbc887f57afdaef066458526b811b0c86419ed87cdcc8e1728db0fef161820a6d806566fcc3a8a726bd86d962142f6dc383a4df2ab05043
|
7
|
+
data.tar.gz: 4e055ca45616f1278bc6eb54c539381c7ece5a495b9f79ac672524c96d48b338665b1f4572eb9b16ac9b56a35961b1747d7e0a5d069c2b104e0e5752c7d69a6f
|
data/README.md
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
[![wercker status](https://app.wercker.com/status/0964573b38729ce98909559e3779cca5/
|
1
|
+
[![wercker status](https://app.wercker.com/status/0964573b38729ce98909559e3779cca5/m/master "wercker status")](https://app.wercker.com/project/byKey/0964573b38729ce98909559e3779cca5)
|
2
2
|
# JudgeSystem
|
3
3
|
|
4
4
|
Judge_system is a compile and judge system for online judge.
|
5
5
|
This system work on [melpon/wandbox](https://github.com/melpon/wandbox).
|
6
6
|
That means you don't have to concern about dangerous codes if you use judge_system.
|
7
7
|
Judge_system returns four results ('AC', 'WA', 'RE', 'TLE').
|
8
|
-
Now, it can compile c, c++, ruby, go, python3.
|
8
|
+
Now, it can compile c, c++, ruby, go, python3, swift.
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
@@ -31,7 +31,7 @@ require 'judge_system'
|
|
31
31
|
JudgeSystem.judge_result lang: (string text), code: (string text), answer: (string text), stdin: (string text), time: (num sec)
|
32
32
|
|
33
33
|
#Lang is the extension of languages (example: c is 'c', c++ is 'cpp', ruby is 'rb', go is 'go', python3 is 'py').
|
34
|
-
#You can't use more than
|
34
|
+
#You can't use more than 6M byte code and input.
|
35
35
|
|
36
36
|
```
|
37
37
|
|
data/judge_system.gemspec
CHANGED
@@ -27,7 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.bindir = "exe"
|
28
28
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
29
29
|
spec.require_paths = ["lib"]
|
30
|
-
|
30
|
+
spec.add_development_dependency "rbzip2"
|
31
|
+
spec.add_development_dependency "ffi"
|
31
32
|
spec.add_development_dependency "bundler", "~> 1.13"
|
32
33
|
spec.add_development_dependency "rake", "~> 10.0"
|
33
34
|
spec.add_development_dependency "rspec", "~> 3.0"
|
@@ -1,6 +1,13 @@
|
|
1
|
-
require 'zlib'
|
2
1
|
require 'base64'
|
3
|
-
|
2
|
+
|
3
|
+
File.open("stdin.txt.bz2", "wb") do |file|
|
4
|
+
file.write Base64.decode64 $stdin.read
|
5
|
+
file.close
|
6
|
+
end
|
7
|
+
|
8
|
+
system("bunzip2 stdin.txt.bz2")
|
9
|
+
|
10
|
+
stdin = File.open("stdin.txt").read.split("\n<$><*><$>\n")
|
4
11
|
code = stdin[0]
|
5
12
|
input = stdin[1]
|
6
13
|
time = stdin[2]
|
@@ -1,6 +1,13 @@
|
|
1
|
-
require 'zlib'
|
2
1
|
require 'base64'
|
3
|
-
|
2
|
+
|
3
|
+
File.open("stdin.txt.bz2", "wb") do |file|
|
4
|
+
file.write Base64.decode64 $stdin.read
|
5
|
+
file.close
|
6
|
+
end
|
7
|
+
|
8
|
+
system("bunzip2 stdin.txt.bz2")
|
9
|
+
|
10
|
+
stdin = File.open("stdin.txt").read.split("\n<$><*><$>\n")
|
4
11
|
code = stdin[0]
|
5
12
|
input = stdin[1]
|
6
13
|
time = stdin[2]
|
@@ -1,6 +1,13 @@
|
|
1
|
-
require 'zlib'
|
2
1
|
require 'base64'
|
3
|
-
|
2
|
+
|
3
|
+
File.open("stdin.txt.bz2", "wb") do |file|
|
4
|
+
file.write Base64.decode64 $stdin.read
|
5
|
+
file.close
|
6
|
+
end
|
7
|
+
|
8
|
+
system("bunzip2 stdin.txt.bz2")
|
9
|
+
|
10
|
+
stdin = File.open("stdin.txt").read.split("\n<$><*><$>\n")
|
4
11
|
code = stdin[0]
|
5
12
|
input = stdin[1]
|
6
13
|
time = stdin[2]
|
@@ -1,6 +1,13 @@
|
|
1
|
-
require 'zlib'
|
2
1
|
require 'base64'
|
3
|
-
|
2
|
+
|
3
|
+
File.open("stdin.txt.bz2", "wb") do |file|
|
4
|
+
file.write Base64.decode64 $stdin.read
|
5
|
+
file.close
|
6
|
+
end
|
7
|
+
|
8
|
+
system("bunzip2 stdin.txt.bz2")
|
9
|
+
|
10
|
+
stdin = File.open("stdin.txt").read.split("\n<$><*><$>\n")
|
4
11
|
code = stdin[0]
|
5
12
|
input = stdin[1]
|
6
13
|
time = stdin[2]
|
@@ -1,6 +1,13 @@
|
|
1
|
-
require 'zlib'
|
2
1
|
require 'base64'
|
3
|
-
|
2
|
+
|
3
|
+
File.open("stdin.txt.bz2", "wb") do |file|
|
4
|
+
file.write Base64.decode64 $stdin.read
|
5
|
+
file.close
|
6
|
+
end
|
7
|
+
|
8
|
+
system("bunzip2 stdin.txt.bz2")
|
9
|
+
|
10
|
+
stdin = File.open("stdin.txt").read.split("\n<$><*><$>\n")
|
4
11
|
code = stdin[0]
|
5
12
|
input = stdin[1]
|
6
13
|
time = stdin[2]
|
@@ -1,6 +1,13 @@
|
|
1
|
-
require 'zlib'
|
2
1
|
require 'base64'
|
3
|
-
|
2
|
+
|
3
|
+
File.open("stdin.txt.bz2", "wb") do |file|
|
4
|
+
file.write Base64.decode64 $stdin.read
|
5
|
+
file.close
|
6
|
+
end
|
7
|
+
|
8
|
+
system("bunzip2 stdin.txt.bz2")
|
9
|
+
|
10
|
+
stdin = File.open("stdin.txt").read.split("\n<$><*><$>\n")
|
4
11
|
code = stdin[0]
|
5
12
|
input = stdin[1]
|
6
13
|
time = stdin[2]
|
data/lib/judge_system.rb
CHANGED
@@ -30,7 +30,7 @@ module JudgeSystem
|
|
30
30
|
sys = File.open("#{path}/compile_systems/#{lang}_system.rb", "r").read
|
31
31
|
data = nil
|
32
32
|
spliter = "\n<$><*><$>\n"
|
33
|
-
stdin =
|
33
|
+
stdin = BZip2Input.compress(code + spliter + input + spliter + ("%f" % time))
|
34
34
|
begin
|
35
35
|
data = compile( compiler: "ruby-head", code: sys, stdin: stdin )
|
36
36
|
rescue
|
data/lib/judge_system/version.rb
CHANGED
data/lib/zlib_input.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
-
require '
|
1
|
+
require 'rbzip2'
|
2
2
|
require 'base64'
|
3
|
-
module
|
4
|
-
def
|
5
|
-
|
6
|
-
|
3
|
+
module BZip2Input
|
4
|
+
def compress input
|
5
|
+
string = StringIO.new
|
6
|
+
bz2 = RBzip2::FFI::Compressor.new string
|
7
|
+
bz2.write input
|
8
|
+
bz2.close
|
9
|
+
Base64.encode64(string.string)
|
7
10
|
end
|
8
|
-
module_function :
|
11
|
+
module_function :compress
|
9
12
|
end
|
metadata
CHANGED
@@ -1,15 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: judge_system
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- getty104
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rbzip2
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: ffi
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
13
41
|
- !ruby/object:Gem::Dependency
|
14
42
|
name: bundler
|
15
43
|
requirement: !ruby/object:Gem::Requirement
|