Skip to content

Commit 7160403

Browse files
Merge pull request #5 from kapillamba4/add-ruby
Add support for ruby
2 parents 4e29998 + fc21e0b commit 7160403

File tree

12 files changed

+53
-0
lines changed

12 files changed

+53
-0
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,6 @@ Currently we have following images -
2525
- [nodejs6](containers/nodejs6)
2626
- [nodejs](containers/nodejs8)
2727
- [py2](containers/py2)
28+
- [py3](containers/py3)
29+
- [ruby](containers/ruby)
2830

containers/ruby/Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM alpine:3.6
2+
3+
RUN apk add --no-cache ruby="2.4.4-r0" bash
4+
5+
COPY ./compile.sh /bin/compile.sh
6+
COPY ./run.sh /bin/run.sh
7+
8+
RUN chmod 777 /bin/compile.sh; \
9+
chmod 777 /bin/run.sh

containers/ruby/compile.sh

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#!/usr/bin/env bash

containers/ruby/run.sh

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
ruby script.rb < run.stdin 1> run.stdout 2> run.stderr

test.sh

+4
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@
2828
bash tests/py3/test_worker.sh
2929
}
3030

31+
@test "test ruby" {
32+
bash tests/ruby/test_worker.sh
33+
}
34+

tests/ruby/run.stdin

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
World

tests/ruby/runbox/run.stderr

Whitespace-only changes.

tests/ruby/runbox/run.stdin

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
World

tests/ruby/runbox/run.stdout

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Hello World

tests/ruby/runbox/script.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
puts "Hello " + gets.to_s

tests/ruby/script.rb

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
puts "Hello " + gets.to_s

tests/ruby/test_worker.sh

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env bash
2+
pushd $(dirname "$0")
3+
DIR=$(pwd)
4+
RUNBOX="${DIR}/runbox"
5+
6+
echo $RUNBOX
7+
# Remove RUNBOX
8+
rm -rf $RUNBOX
9+
10+
# Create runbox
11+
mkdir -p $RUNBOX
12+
13+
# Copy source to runbox
14+
cp $DIR/script.rb $RUNBOX/script.rb
15+
cp $DIR/run.stdin $RUNBOX/run.stdin
16+
17+
# Test Compile
18+
docker run \
19+
--cpus="0.5" \
20+
--memory="20m" \
21+
--ulimit nofile=64:64 \
22+
--rm \
23+
--read-only \
24+
-v "$RUNBOX":/usr/src/runbox \
25+
-w /usr/src/runbox codingblocks/judge-worker-ruby \
26+
bash -c "/bin/compile.sh && /bin/run.sh"
27+
28+
29+
# Delete runbox
30+
#rm -rf $RUNBOX

0 commit comments

Comments
 (0)