mumukit 2.8.0 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/locales/en.yml +1 -0
- data/lib/locales/es.yml +1 -0
- data/lib/mumukit.rb +1 -0
- data/lib/mumukit/compilation_error.rb +4 -0
- data/lib/mumukit/server/test_server.rb +2 -0
- data/lib/mumukit/templates.rb +1 -0
- data/lib/mumukit/templates/file_hook.rb +21 -1
- data/lib/mumukit/templates/with_line_number_offset.rb +19 -0
- data/lib/mumukit/version.rb +1 -1
- data/lib/mumukit/with_tempfile.rb +3 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 21c46d72fc20503bd751e4ef3b798b006d6d2857
|
4
|
+
data.tar.gz: 7ea814106ca4d802e729eb2a0131c11051be45b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb397d1d351c9958717d5e604a1a9cf5099ad40ca55ce574cb668fde10ba4b788639a35648bbeb7a5a66ebfc39b6a7b511113780d8fc0982d5a66a31fb72a165
|
7
|
+
data.tar.gz: 86d56d7eb5d463deae54fe44268856dd149fc86437fd7464a6e79e14862beddc56309c55e3ef2dc3dca30102fc9b73da2a3696083da925a01b47a58402d70397
|
data/lib/locales/en.yml
CHANGED
data/lib/locales/es.yml
CHANGED
data/lib/mumukit.rb
CHANGED
@@ -57,6 +57,7 @@ require_relative 'mumukit/runtime'
|
|
57
57
|
require_relative 'mumukit/isolated_environment'
|
58
58
|
require_relative 'mumukit/templates'
|
59
59
|
require_relative 'mumukit/request_validation_error'
|
60
|
+
require_relative 'mumukit/compilation_error'
|
60
61
|
require_relative 'mumukit/defaults'
|
61
62
|
require_relative 'mumukit/metatest'
|
62
63
|
require_relative 'mumukit/explainer'
|
data/lib/mumukit/templates.rb
CHANGED
@@ -10,6 +10,7 @@ require_relative './templates/with_metatest_results'
|
|
10
10
|
require_relative './templates/with_mashup_file_content'
|
11
11
|
require_relative './templates/with_embedded_environment'
|
12
12
|
require_relative './templates/with_isolated_environment'
|
13
|
+
require_relative './templates/with_line_number_offset'
|
13
14
|
require_relative './templates/mulang_expectations_hook'
|
14
15
|
require_relative './templates/with_code_smells'
|
15
16
|
require_relative './templates/with_cookie'
|
@@ -2,17 +2,24 @@ module Mumukit
|
|
2
2
|
class Templates::FileHook < Mumukit::Hook
|
3
3
|
include Mumukit::WithTempfile
|
4
4
|
|
5
|
+
attr_accessor :request
|
6
|
+
|
5
7
|
def compile(request)
|
8
|
+
self.request = request
|
6
9
|
write_tempfile! compile_file_content(request)
|
7
10
|
end
|
8
11
|
|
9
12
|
def run!(file)
|
10
13
|
result, status = run_file!(file)
|
11
|
-
post_process_file(file, result
|
14
|
+
post_process_file(file, cleanup_raw_result(result), status)
|
12
15
|
ensure
|
13
16
|
file.unlink
|
14
17
|
end
|
15
18
|
|
19
|
+
def cleanup_raw_result(result)
|
20
|
+
mask_tempfile_references(result.force_encoding('UTF-8'), masked_tempfile_path)
|
21
|
+
end
|
22
|
+
|
16
23
|
def post_process_file(file, result, status)
|
17
24
|
[result, status]
|
18
25
|
end
|
@@ -22,6 +29,19 @@ module Mumukit
|
|
22
29
|
|
23
30
|
required :run_file!, 'Wrong configuration. You must include an environment mixin'
|
24
31
|
|
32
|
+
def masked_tempfile_path
|
33
|
+
@masked_tempfile_path ||= "#{t 'mumukit.masked_tempfile_basename'}#{tempfile_extension}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.line_number_offset(offset, options={})
|
37
|
+
include Mumukit::Templates::WithLineNumberOffset
|
38
|
+
|
39
|
+
define_method(:line_number_offset) do
|
40
|
+
extra_offset = options[:include_extra] && request.extra ? request.extra.lines.length : 0
|
41
|
+
offset + extra_offset
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
25
45
|
def self.metatested(value=true)
|
26
46
|
if value
|
27
47
|
include Mumukit::Templates::WithMetatest
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Mumukit::Templates::WithLineNumberOffset
|
2
|
+
def cleanup_raw_result(result)
|
3
|
+
super(result).gsub(line_number_reference_regexp) do
|
4
|
+
rebuild_line_number_reference correct_line_number($1.to_i)
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
def line_number_reference_regexp
|
9
|
+
/#{masked_tempfile_path}\:(\d+)/m
|
10
|
+
end
|
11
|
+
|
12
|
+
def rebuild_line_number_reference(new_line_number)
|
13
|
+
"#{masked_tempfile_path}:#{new_line_number}"
|
14
|
+
end
|
15
|
+
|
16
|
+
def correct_line_number(number)
|
17
|
+
number - line_number_offset
|
18
|
+
end
|
19
|
+
end
|
data/lib/mumukit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumukit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.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-
|
11
|
+
date: 2017-07-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- lib/locales/en.yml
|
218
218
|
- lib/locales/es.yml
|
219
219
|
- lib/mumukit.rb
|
220
|
+
- lib/mumukit/compilation_error.rb
|
220
221
|
- lib/mumukit/cookie.rb
|
221
222
|
- lib/mumukit/defaults.rb
|
222
223
|
- lib/mumukit/defaults/default_expectations_hook.rb
|
@@ -253,6 +254,7 @@ files:
|
|
253
254
|
- lib/mumukit/templates/with_cookie.rb
|
254
255
|
- lib/mumukit/templates/with_embedded_environment.rb
|
255
256
|
- lib/mumukit/templates/with_isolated_environment.rb
|
257
|
+
- lib/mumukit/templates/with_line_number_offset.rb
|
256
258
|
- lib/mumukit/templates/with_mashup_file_content.rb
|
257
259
|
- lib/mumukit/templates/with_metatest.rb
|
258
260
|
- lib/mumukit/templates/with_metatest_results.rb
|
@@ -282,7 +284,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
282
284
|
version: '0'
|
283
285
|
requirements: []
|
284
286
|
rubyforge_project:
|
285
|
-
rubygems_version: 2.
|
287
|
+
rubygems_version: 2.6.12
|
286
288
|
signing_key:
|
287
289
|
specification_version: 4
|
288
290
|
summary: Mumuki Test Server Development Kit
|