mumukit 2.7.0 → 2.8.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
  SHA1:
3
- metadata.gz: 92b6f5f0aef129cae95f9c8cbdf2af0acf1e245f
4
- data.tar.gz: 3b9d1b1b3a787c38416ca9296d88a6ce01f6a061
3
+ metadata.gz: b1423fda205b081b91b0561d56e411b8939a3725
4
+ data.tar.gz: c86cfd9ad3ba565a0edb82f69aaaa54c65bf70bd
5
5
  SHA512:
6
- metadata.gz: 107002a3a1f6f82125d0dc2f15beb17c68f4e2d5ed8057a74158722dbceef7472c6cf19625d0193053614a4ed78aac24f0694f605b6b558134fdfc888c28bddf
7
- data.tar.gz: af81b4c924434799d566c27b6c0bf42ee757158501bbf6cc2c45a9b429a3d65ac708676650d95d40eba00c3478bba1fab0662665fccde85ba98939b9fb4df4ae
6
+ metadata.gz: 957d17aa5282ab203ee13d5a988ba736db8f9cda15592fc4f3be26fde2ed69fd2584040fc0e2ce3786ff2476ffe6feb226bb5a0624be379c2c25eed7aa276799
7
+ data.tar.gz: 1fd89515534bd0e4fd1a06204c03ffe8249f4816b5b779129ac8c253324e27def6a6b994bace145baf02aa20b69102c4fe28ff299f79b18dd61e040b8b9e3243
@@ -1,3 +1,4 @@
1
+
1
2
  class Mumukit::Runner
2
3
  attr_reader :name, :runtime
3
4
 
@@ -22,6 +23,23 @@ class Mumukit::Runner
22
23
  name.camelize
23
24
  end
24
25
 
26
+ def directives_pipeline
27
+ @pipeline ||= new_directives_pipeline
28
+ end
29
+
30
+ def new_directives_pipeline
31
+ if config.preprocessor_enabled
32
+ Mumukit::Directives::Pipeline.new(
33
+ [Mumukit::Directives::Sections.new,
34
+ Mumukit::Directives::Interpolations.new('test'),
35
+ Mumukit::Directives::Interpolations.new('extra'),
36
+ Mumukit::Directives::Flags.new],
37
+ config.comment_type)
38
+ else
39
+ Mumukit::Directives::NullPipeline
40
+ end
41
+ end
42
+
25
43
  def self.default_config
26
44
  @default_config
27
45
  end
@@ -87,20 +87,7 @@ class Mumukit::Server::TestServer
87
87
  end
88
88
 
89
89
  def preprocess(request)
90
- if Mumukit.config.preprocessor_enabled
91
- directives_pipeline.transform(request)
92
- else
93
- request
94
- end
95
- end
96
-
97
- def directives_pipeline
98
- @pipeline ||= Mumukit::Directives::Pipeline.new(
99
- [Mumukit::Directives::Sections.new,
100
- Mumukit::Directives::Interpolations.new('test'),
101
- Mumukit::Directives::Interpolations.new('extra'),
102
- Mumukit::Directives::Flags.new],
103
- Mumukit.config.comment_type)
90
+ Mumukit.directives_pipeline.transform(request)
104
91
  end
105
92
 
106
93
  def validate_request!(request)
@@ -22,6 +22,13 @@ module Mumukit
22
22
 
23
23
  required :run_file!, 'Wrong configuration. You must include an environment mixin'
24
24
 
25
+ def self.metatested(value=true)
26
+ if value
27
+ include Mumukit::Templates::WithMetatest
28
+ include Mumukit::Templates::WithMetatestResults
29
+ end
30
+ end
31
+
25
32
  def self.structured(value=true)
26
33
  if value
27
34
  include Mumukit::Templates::WithStructuredResults
@@ -0,0 +1,14 @@
1
+ module Mumukit::Templates::WithMetatest
2
+ def metatest
3
+ Mumukit::Metatest::Framework.new checker: metatest_checker,
4
+ runner: metatest_runner
5
+ end
6
+
7
+ def metatest_runner
8
+ Mumukit::Metatest::IdentityRunner.new
9
+ end
10
+
11
+ def run_metatest!(target, examples)
12
+ metatest.test target, examples
13
+ end
14
+ end
@@ -0,0 +1,31 @@
1
+ module Mumukit::Templates::WithMetatestResults
2
+ def compile_file_content(request)
3
+ @examples = compile_metatest_examples(request)
4
+ compile_metatest_file_content(request)
5
+ end
6
+
7
+ def compile_metatest_examples(request)
8
+ YAML.load(request.test).deep_symbolize_keys[:examples]
9
+ end
10
+
11
+ def post_process_file(file, result, status)
12
+ if status == :passed
13
+ run_metatest! to_metatest_compilation(result), @examples
14
+ else
15
+ post_process_unsuccessful_result(file, result, status)
16
+ end
17
+ rescue JSON::ParserError
18
+ [result, :errored]
19
+ end
20
+
21
+ def post_process_unsuccessful_result(_file, result, status)
22
+ [result, status]
23
+ end
24
+
25
+ def to_metatest_compilation(result)
26
+ JSON.pretty_parse(result).deep_symbolize_keys
27
+ end
28
+ end
29
+
30
+
31
+
@@ -3,13 +3,17 @@ module Mumukit::Templates::WithStructuredResults
3
3
  if [:passed, :failed].include? status
4
4
  [to_structured_result(result)]
5
5
  else
6
- [result, status]
6
+ post_process_unstructured_result(file, result, status)
7
7
  end
8
8
  rescue JSON::ParserError
9
9
  [result, :errored]
10
10
  end
11
11
 
12
+ def post_process_unstructured_result(_file, result, status)
13
+ [result, status]
14
+ end
15
+
12
16
  def to_structured_result(result)
13
17
  JSON.pretty_parse(result)
14
18
  end
15
- end
19
+ end
@@ -5,6 +5,8 @@ end
5
5
 
6
6
  require_relative './templates/file_hook'
7
7
  require_relative './templates/with_structured_results'
8
+ require_relative './templates/with_metatest'
9
+ require_relative './templates/with_metatest_results'
8
10
  require_relative './templates/with_mashup_file_content'
9
11
  require_relative './templates/with_embedded_environment'
10
12
  require_relative './templates/with_isolated_environment'
@@ -1,3 +1,3 @@
1
1
  module Mumukit
2
- VERSION = '2.7.0'
2
+ VERSION = '2.8.0'
3
3
  end
data/lib/mumukit.rb CHANGED
@@ -27,7 +27,7 @@ module Mumukit
27
27
  end
28
28
 
29
29
  class << self
30
- delegate :prefix, :config, :configure, :runtime, :configure_runtime, to: :current_runner
30
+ delegate :prefix, :config, :configure, :runtime, :configure_runtime, :directives_pipeline, to: :current_runner
31
31
  end
32
32
  end
33
33
 
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.7.0
4
+ version: 2.8.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: 2016-12-05 00:00:00.000000000 Z
11
+ date: 2017-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - "~>"
186
186
  - !ruby/object:Gem::Version
187
- version: '0.1'
187
+ version: '0.2'
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - "~>"
193
193
  - !ruby/object:Gem::Version
194
- version: '0.1'
194
+ version: '0.2'
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: mumukit-content-type
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -254,6 +254,8 @@ files:
254
254
  - lib/mumukit/templates/with_embedded_environment.rb
255
255
  - lib/mumukit/templates/with_isolated_environment.rb
256
256
  - lib/mumukit/templates/with_mashup_file_content.rb
257
+ - lib/mumukit/templates/with_metatest.rb
258
+ - lib/mumukit/templates/with_metatest_results.rb
257
259
  - lib/mumukit/templates/with_structured_results.rb
258
260
  - lib/mumukit/version.rb
259
261
  - lib/mumukit/with_command_line.rb