mumuki-gobstones-runner 1.10.1 → 1.10.2

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: 484ea53637cf6bfc666f5d15fbd1b3e244bfd7035c6b7d3fbce7529977b1640d
4
- data.tar.gz: 562e301290aff2f265e659c0e0f941596bda18d5991025e2b03c6b731b92698e
3
+ metadata.gz: a25c116e5577d9a6ec6bd39ea1c385f5f6cbfbd11348aa5d5a3c4370536d6c99
4
+ data.tar.gz: 2b7b816e3347a90bdcd49d5273d7eb3d53e5e6a0f101b591951cf8d21a038cea
5
5
  SHA512:
6
- metadata.gz: 8735d5544a16ed4ef1920b32922970906355e10099fd270df8c5b2aa30836aeeb96d39a5af4bf3b7171f0583f028dd25f1bd56fb42eed8605fbe2b1b95e8ae69
7
- data.tar.gz: 02015b374dfe27bc2b136d0194c44de7f63aeab5cc7dbe491c28f5172e43a5a95506e9c31d490f6fd2209debeac4c8c4a0ba9e99041fd1696d786d2a6e98a133
6
+ metadata.gz: ccb9d74307dd8e4e7a0a92ccfd984ddf5c8815f4ff1e6cbf0c05fa952fc48a21216c1d6dabccfd300f592fe4a9f6f6ca3c6d144e9e9382fbd7e6aa7dcfdf00df
7
+ data.tar.gz: 7d0909dd929f4812c02e45c761d70f3d5a2422bc47da3203335422817557355b5907bfeb3eaea93e4e67e03b31147c05e2cf3d0726a148a0304c48acc95901ee
@@ -1,6 +1,8 @@
1
1
  class GobstonesPrecompileHook < Mumukit::Templates::FileHook
2
2
  attr_accessor :batch
3
3
 
4
+ DEFAULT_TIMEOUT = 2
5
+
4
6
  structured true
5
7
  isolated true
6
8
 
@@ -17,7 +19,11 @@ class GobstonesPrecompileHook < Mumukit::Templates::FileHook
17
19
  end
18
20
 
19
21
  def timeout_argument
20
- "--timeout #{(Mumukit.config.command_time_limit - 1) * 1000}"
22
+ "--timeout " + timeout.to_s
23
+ end
24
+
25
+ def timeout
26
+ (ENV['MUMUKI_GOBSTONES_TIMEOUT'] || DEFAULT_TIMEOUT).to_i * 1000
21
27
  end
22
28
 
23
29
  def compile(request)
@@ -48,7 +48,6 @@
48
48
  },
49
49
 
50
50
  attached: function () {
51
-
52
51
  const setBlocklySounds = () => {
53
52
  Blockly.WorkspaceAudio.prototype.preload = () => {
54
53
  for (var soundName in this.SOUNDS_) {
@@ -110,13 +109,13 @@
110
109
  const updateFields = () => {
111
110
  const blockly = this.getBlockly();
112
111
 
113
- const editorValue = $("#mu-custom-editor-value")[0];
112
+ const editorValue = this.getEditorValue();
114
113
  if (editorValue) {
115
114
  editorValue.value = blockly.workspaceXml;
116
115
  }
117
116
 
118
117
  if (this.teacherMode) {
119
- const editorExtra = $("#mu-custom-editor-extra")[0];
118
+ const editorExtra = this.getEditorExtra();
120
119
  if (editorExtra) {
121
120
  editorExtra.value = blockly.workspaceXml;
122
121
  }
@@ -207,18 +206,34 @@
207
206
  },
208
207
 
209
208
  getStudentXml: function () {
210
- return $("#mu-custom-editor-value")[0].value || "";
209
+ return this.getEditorValue().value || "";
211
210
  },
212
211
 
213
212
  getTeacherCode: function () {
214
- const teacherXml = $("#mu-custom-editor-extra")[0];
213
+ const teacherXml = this.getEditorExtra();
215
214
  if (!teacherXml || !teacherXml.value) return;
216
215
  this.$.blocklyTmp.workspaceXml = teacherXml.value;
217
216
  return this.$.blocklyTmp.generateCode();
218
217
  },
219
218
 
219
+ getEditorValue: function() {
220
+ return $("#mu-custom-editor-value")[0];
221
+ },
222
+
223
+ getEditorDefaultValue: function() {
224
+ return $("#mu-custom-editor-default-value")[0];
225
+ },
226
+
227
+ getEditorExtra: function() {
228
+ return $("#mu-custom-editor-extra")[0];
229
+ },
230
+
231
+ getEditorTest: function() {
232
+ return $("#mu-custom-editor-test")[0];
233
+ },
234
+
220
235
  _setInitialXml: function (blockly) {
221
- const editorDefaultContent = $("#mu-custom-editor-default-value")[0];
236
+ const editorDefaultContent = this.getEditorDefaultValue();
222
237
  if (editorDefaultContent && editorDefaultContent.value) {
223
238
  blockly.initialXml = editorDefaultContent.value;
224
239
  } else {
@@ -228,7 +243,7 @@
228
243
 
229
244
  _initializeWorkspace: function(blockly, callback) {
230
245
  postpone(() => {
231
- const value = $("#mu-custom-editor-value")[0].value;
246
+ const value = this.getEditorValue().value;
232
247
 
233
248
  blockly.workspaceXml = value || (
234
249
  this.teacherMode
@@ -504,6 +519,17 @@
504
519
  },
505
520
 
506
521
  _showError: function (region, error) {
522
+ const expectsTimeout = /expect_endless_while *: *true/.test(
523
+ this._getEditor().getEditorTest().value
524
+ );
525
+
526
+ const isExpectedTimeout = (
527
+ error.reason && error.reason.code === "timeout" &&
528
+ expectsTimeout
529
+ );
530
+
531
+ if (isExpectedTimeout) return;
532
+
507
533
  this._getBlockly().showBlockError(region, error.message);
508
534
  },
509
535
 
@@ -1,3 +1,3 @@
1
1
  module GobstonesVersionHook
2
- VERSION = '1.10.1'
2
+ VERSION = '1.10.2'
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: 1.10.1
4
+ version: 1.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-25 00:00:00.000000000 Z
11
+ date: 2018-10-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mumukit