mumuki-java-runner 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/expectations_hook.rb +11 -0
- data/lib/feedback_hook.rb +58 -0
- data/lib/java_runner.rb +5 -0
- data/lib/locales/en.yml +5 -0
- data/lib/locales/es.yml +5 -0
- data/lib/version.rb +1 -1
- metadata +8 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb6f56fb668bf395fa18377baae1206f11ad7576
|
4
|
+
data.tar.gz: cad91894bc082f9919f538b8609c1a7ed6dfec91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 918bcabdcbcc2568ccc22aec4674919e3093a8c285d4c342ce144b3be68c70c445930f662ef5dcf42f3ad1f806d850ae2f12e7ef97b5345f1c383c3b9c72bf00
|
7
|
+
data.tar.gz: d4bcec43802f5d4b1880cec12e676e724a5cef6d67b11457131316938757b6f8f3e018847669429c96ceb078fbf4f0a6bbee325967edd9f739cbf903176417fd
|
@@ -0,0 +1,58 @@
|
|
1
|
+
class JavaFeedbackHook < Mumukit::Hook
|
2
|
+
def run!(request, results)
|
3
|
+
content = request.content
|
4
|
+
test_results = results.test_results[0]
|
5
|
+
|
6
|
+
JavaExplainer.new.explain(content, test_results) if test_results.is_a? String
|
7
|
+
end
|
8
|
+
|
9
|
+
class JavaExplainer < Mumukit::Explainer
|
10
|
+
|
11
|
+
def explain_missing_semicolon(_, result)
|
12
|
+
missing_character result, ';'
|
13
|
+
end
|
14
|
+
|
15
|
+
def explain_missing_parenthesis(_, result)
|
16
|
+
missing_character result, '\('
|
17
|
+
end
|
18
|
+
|
19
|
+
def explain_missing_bracket(_, result)
|
20
|
+
missing_character result, '\{'
|
21
|
+
end
|
22
|
+
|
23
|
+
def explain_cannot_find_symbol(_, result)
|
24
|
+
(/#{error} cannot find symbol#{near_regex}#{symbol_regex}#{location_regex}/.match result).try do |it|
|
25
|
+
{near: it[1], symbol: it[2].strip, location: it[3].strip}
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def start_regex(symbol=' ')
|
32
|
+
/.*[\t \n]*#{symbol}*(.*)/
|
33
|
+
end
|
34
|
+
|
35
|
+
def near_regex
|
36
|
+
/#{start_regex}\n[ \t]+\^/
|
37
|
+
end
|
38
|
+
|
39
|
+
def symbol_regex
|
40
|
+
start_regex 'symbol:'
|
41
|
+
end
|
42
|
+
|
43
|
+
def location_regex
|
44
|
+
start_regex 'location:'
|
45
|
+
end
|
46
|
+
|
47
|
+
def error
|
48
|
+
'[eE]rror:'
|
49
|
+
end
|
50
|
+
|
51
|
+
def missing_character(result, character)
|
52
|
+
(/#{error} '#{character}' expected#{near_regex}/.match result).try do |it|
|
53
|
+
{near: it[1]}
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
data/lib/java_runner.rb
CHANGED
@@ -1,10 +1,15 @@
|
|
1
1
|
require 'mumukit'
|
2
2
|
|
3
|
+
I18n.load_translations_path File.join(__dir__, 'locales', '*.yml')
|
4
|
+
|
3
5
|
Mumukit.runner_name = 'java'
|
4
6
|
Mumukit.configure do |config|
|
5
7
|
config.docker_image = 'mumuki/mumuki-junit-worker'
|
8
|
+
config.content_type = 'markdown'
|
6
9
|
end
|
7
10
|
|
8
11
|
require_relative './version'
|
9
12
|
require_relative './test_hook'
|
10
13
|
require_relative './metadata_hook'
|
14
|
+
require_relative './expectations_hook'
|
15
|
+
require_relative './feedback_hook'
|
data/lib/locales/en.yml
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
en:
|
2
|
+
missing_semicolon: "Missing ';' near `%{near}`"
|
3
|
+
missing_parenthesis: "Missing '(' near `%{near}`"
|
4
|
+
missing_bracket: "Missing { near `%{near}`. Maybe you misspelled a class or method declaration."
|
5
|
+
cannot_find_symbol: "Cannot find `%{symbol}` declaration in `%{location}`"
|
data/lib/locales/es.yml
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
es:
|
2
|
+
missing_semicolon: "Parece que falta un ';' cerca de `%{near}`"
|
3
|
+
missing_parenthesis: "Parece que falta un '(' cerca de `%{near}`"
|
4
|
+
missing_bracket: "Se esperaba una { cerca de `%{near}`. Fijate si tal vez, introdujiste un paréntesis de más o está mal escrita la declaración de clase o método."
|
5
|
+
cannot_find_symbol: "No se encontró la definición de `%{symbol}` en `%{location}`"
|
data/lib/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-java-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Franco Leonardo Bulgarelli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-07-
|
11
|
+
date: 2017-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mumukit
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '2.
|
19
|
+
version: '2.10'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '2.
|
26
|
+
version: '2.10'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,7 +101,11 @@ executables: []
|
|
101
101
|
extensions: []
|
102
102
|
extra_rdoc_files: []
|
103
103
|
files:
|
104
|
+
- lib/expectations_hook.rb
|
105
|
+
- lib/feedback_hook.rb
|
104
106
|
- lib/java_runner.rb
|
107
|
+
- lib/locales/en.yml
|
108
|
+
- lib/locales/es.yml
|
105
109
|
- lib/metadata_hook.rb
|
106
110
|
- lib/test_hook.rb
|
107
111
|
- lib/version.rb
|