mumukit 2.29.0 → 2.30.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a827027f338d223865479f6fbd0bbc8ca7f36f52caf20f3402e08c749e0b3f7
4
- data.tar.gz: 5208a95b1fe08adc9864cd0ec0b1dcdd12e6e91fcaf701664a1b9a5a52e1c08c
3
+ metadata.gz: df2ef64cda006497e14e204c2471de45f79292d0c3225981d2129add8e572d75
4
+ data.tar.gz: 1a2972dfa692d18058e6aabe3b4970f85a4f84a5cdfd104b47f21cc38a106c98
5
5
  SHA512:
6
- metadata.gz: 4fdd7cead0cf6d3d21f1dd89a65a85097c7c0576151e97db14b8d82346559fe0e0c0d257d26811bece79fe3b6cc70aa8117b453cb30b65b74d712f42d56745b9
7
- data.tar.gz: 7d34da4a77324f5aaeedc0e3162b8e54902b423e14e7c0d830fbf51d76d956e73da28a3f650d260209f6462d0bc2e7a418e06bcd7bf5c371af1727cc03e91b14
6
+ metadata.gz: 8602bff1f4bb73dfed9ea113622c06ac19fc998be8ba2e23f21190f0bbe37a237eab855b81c687b9391592e3ec895e2788f392302cb7e2065be792a84bc7d1d5
7
+ data.tar.gz: cc2f4163866f0d736500af00b5165fbdec5e871a4dcc9c0b5de6fbbf8abc66d2749ef1b1d4090618b7ad6646aab402bdd8559c3fffd20f7d11b521299928bac2
data/lib/mumukit.rb CHANGED
@@ -63,6 +63,7 @@ require_relative 'mumukit/with_command_line'
63
63
  require_relative 'mumukit/hook'
64
64
  require_relative 'mumukit/runtime'
65
65
  require_relative 'mumukit/isolated_environment'
66
+ require_relative 'mumukit/error_pattern'
66
67
  require_relative 'mumukit/templates'
67
68
  require_relative 'mumukit/request_validation_error'
68
69
  require_relative 'mumukit/compilation_error'
@@ -0,0 +1,31 @@
1
+ module Mumukit
2
+ class ErrorPattern
3
+ def initialize(regexp)
4
+ @regexp = regexp
5
+ end
6
+
7
+ def matches?(result)
8
+ @regexp.matches? result
9
+ end
10
+
11
+ def sanitize(result)
12
+ result.gsub(@regexp, '').strip
13
+ end
14
+
15
+ def transform(result, status)
16
+ [sanitize(result), status]
17
+ end
18
+
19
+ class Errored < ErrorPattern
20
+ def transform(result, _status)
21
+ super(result, :errored)
22
+ end
23
+ end
24
+
25
+ class Failed < ErrorPattern
26
+ def transform(result, _status)
27
+ super(result, :failed)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -15,6 +15,7 @@ require_relative './templates/with_code_smells'
15
15
  require_relative './templates/with_cookie'
16
16
 
17
17
  require_relative './templates/file_hook'
18
+ require_relative './templates/with_error_patterns'
18
19
  require_relative './templates/multi_file_hook'
19
20
  require_relative './templates/try_hook'
20
21
  require_relative './templates/expectations_hook'
@@ -74,5 +74,9 @@ module Mumukit
74
74
  define_method(:mashup_fields) { args }
75
75
  end
76
76
  end
77
+
78
+ def self.with_error_patterns
79
+ include Mumukit::Templates::WithErrorPatterns
80
+ end
77
81
  end
78
82
  end
@@ -0,0 +1,12 @@
1
+ module Mumukit::Templates
2
+ module WithErrorPatterns
3
+ def post_process_file(_file, result, status)
4
+ error_patterns.each { |it| return it.transform(result, status) if it.matches? result } if status.failed?
5
+ super
6
+ end
7
+
8
+ def error_patterns
9
+ []
10
+ end
11
+ end
12
+ end
@@ -1,3 +1,3 @@
1
1
  module Mumukit
2
- VERSION = '2.29.0'
2
+ VERSION = '2.30.0'
3
3
  end
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.29.0
4
+ version: 2.30.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: 2019-01-22 00:00:00.000000000 Z
11
+ date: 2019-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -279,6 +279,7 @@ files:
279
279
  - lib/mumukit/defaults/default_validation_hook.rb
280
280
  - lib/mumukit/defaults/default_version_hook.rb
281
281
  - lib/mumukit/env.rb
282
+ - lib/mumukit/error_pattern.rb
282
283
  - lib/mumukit/explainer.rb
283
284
  - lib/mumukit/hook.rb
284
285
  - lib/mumukit/isolated_environment.rb
@@ -311,6 +312,7 @@ files:
311
312
  - lib/mumukit/templates/with_code_smells.rb
312
313
  - lib/mumukit/templates/with_cookie.rb
313
314
  - lib/mumukit/templates/with_embedded_environment.rb
315
+ - lib/mumukit/templates/with_error_patterns.rb
314
316
  - lib/mumukit/templates/with_isolated_environment.rb
315
317
  - lib/mumukit/templates/with_line_number_offset.rb
316
318
  - lib/mumukit/templates/with_mashup_file_content.rb