mumuki-gobstones-runner 2.1.3 → 2.2.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: f82526f4a5824f6c8d3006f7539bff0bcd77300fe2d51c1c5d7244902a406225
4
- data.tar.gz: d2dea8e130b4f881ba830f15b90493b56de9e8be4901f49278d81922c63ad6af
3
+ metadata.gz: 91e8c6260caa533e79054eb0523b7a50ef314c39cbe095aa522985e7e76f8607
4
+ data.tar.gz: f9b0337db874c710c5339f0454ac98c181961d8f3aa8be40a49b5c7a362235d6
5
5
  SHA512:
6
- metadata.gz: c0c1e8bef4c879972db7bf589634f33b58c649f5a3b3beacc4d061f864b01e849a1f3db2a71f81349e413df1fcf269610c15d13bcd5337b5150851c6d33a08dd
7
- data.tar.gz: cf1eec4fbbe28c8456adfc681506d8daf9d671d5a9faa0957878462b1ea0202fe84275ba95b0bb74214f55fad523168a10984f7e5f3ad42fe6dee8ec1e6942f5
6
+ metadata.gz: 8a8fcda16da5e7e2325bd5dec995855bcdc1a8096d2cce7124f9e2f6641ea358c8fd0899e0d20dbdf4a6fdb103e21e64f3a74a2b3007d2e895ae273f89a647fa
7
+ data.tar.gz: f63dca544118647d5fb28a12bd5e4af9a89a335ab71b2984b6132409ce3b26b7254a92b0ebde10a4e44527b6ac7ebf2763309a67b7866ccc7eab34f3e73a80c7
@@ -1,18 +1,15 @@
1
1
  class GobstonesExpectationsHook < Mumukit::Templates::MulangExpectationsHook
2
2
  include_smells true
3
3
 
4
- def language
5
- 'Mulang'
6
- end
7
-
4
+ # no need to implement `language` and `compile_content`
5
+ # since we are completly overriding `mulang_code`
8
6
  def mulang_code(request)
9
- output, status = request.result
10
- Mulang::Code.new(mulang_language, extract_ast(output))
7
+ Mulang::Code.external extract_ast(request)
11
8
  end
12
9
 
13
10
  def compile_expectations(request)
14
11
  super(request).tap do |expectations|
15
- request.batch.options[:subject].try do |subject|
12
+ request.precompiled_batch.options[:subject].try do |subject|
16
13
  expectations[:ast] << { binding: '*', inspection: "Declares:=#{subject}" }
17
14
  end
18
15
  end
@@ -24,12 +21,19 @@ class GobstonesExpectationsHook < Mumukit::Templates::MulangExpectationsHook
24
21
 
25
22
  private
26
23
 
27
- def extract_ast(precompiled_output)
24
+ def extract_ast(request)
25
+ precompiled_output, _ = request.precompiled_result
26
+
28
27
  if precompiled_output.is_a?(String)
29
- logger.warn(precompiled_output)
30
- {tag: :None} # this happens when gobstones cli miserably fails on parsing the submission or the extra code
28
+ # gobstones cli miserably failed on parsing the submission or the extra code
29
+ logger.warn("Unprocessable GobstonesCLI output:\n\n#{precompiled_output}")
30
+ {tag: :None}
31
+ elsif (ast = precompiled_output.first.dig(:result, :mulangAst)).blank?
32
+ # gobstones cli could not produce a valid ast
33
+ logger.warn("GobstonesCLI produced an empty AST:\n\n#{precompiled_output}")
34
+ {tag: :None}
31
35
  else
32
- precompiled_output.first[:result][:mulangAst]
36
+ ast
33
37
  end
34
38
  end
35
39
  end
@@ -31,8 +31,8 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
31
31
  @locale = request[:locale]
32
32
  file = super request
33
33
 
34
- struct request.to_h.merge batch: @batch,
35
- result: run!(file)
34
+ struct request.to_h.merge precompiled_batch: @batch,
35
+ precompiled_result: run!(file)
36
36
  end
37
37
 
38
38
  def add_missing_headers!(request)
@@ -1,13 +1,13 @@
1
1
  class GobstonesTestHook < Mumukit::Defaults::TestHook
2
2
  def run!(request)
3
- output, status = request.result
3
+ output, status = request.precompiled_result
4
4
 
5
- if request.batch.options[:interactive]
5
+ if request.precompiled_batch.options[:interactive]
6
6
  ['', :passed]
7
7
  elsif status == :passed
8
- request.batch.run_tests! output
8
+ request.precompiled_batch.run_tests! output
9
9
  else
10
- request.result
10
+ request.precompiled_result
11
11
  end
12
12
  end
13
13
  end
@@ -1,3 +1,3 @@
1
1
  module GobstonesVersionHook
2
- VERSION = '2.1.3'
2
+ VERSION = '2.2.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-gobstones-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-23 00:00:00.000000000 Z
11
+ date: 2019-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit