mumuki-gobstones-runner 2.10.0 → 2.13.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: abbf0ec6c1d486eadb06f71d4d479a520700c79376ab9d1e785a8fc658485624
4
- data.tar.gz: 60dc12c4d5e60614a94987ae2c725892cb6e06065aefd673952cf0f73880ce06
3
+ metadata.gz: 7ba04506c9ef79dfcf3e5c4a080e1f147c87134f939afe70aa5f54e515640c51
4
+ data.tar.gz: 4fa2cae67f9e144499c8acc8eff28b3af3a4176a47df91b49085b2f3a9901d34
5
5
  SHA512:
6
- metadata.gz: f253ffce6bfffc3aa0af02995cd3739df9a1ccb2122c6c7fbdb70883b3cb7da9ef6078372a1aa141fe62561491c929450fe2e9ba30fe7d8dad5561abc57f6c55
7
- data.tar.gz: d7227916c7b0e94173319e8753364ceec1818a07aa10f70e155735549872c6541cf7065235be16f0d43aece40df847c3a5ee1842e20c33fa205161fafa0b23d0
6
+ metadata.gz: fd96ca8f78913c83581b165f73cf2f31b84b307c0dd7db599c2852aa9c794c7593b851595dd91aeadb0cbe9f515d4f93ca76c18c80db1f6444ae89aa8e40b396
7
+ data.tar.gz: dd57c527fe5915e0f2218dd3b152e850cb6a6c9a256877d16ccd252da48d8603b665bbfe1b5a459d66c9ed9b45a49751264f22f20f76bbcbc39aa14db8bb4cb7
@@ -54,6 +54,8 @@ class Mumukit::Server::App < Sinatra::Base
54
54
 
55
55
  get '/assets/editor/editor.html' do
56
56
  cross_origin
57
+ content_type 'text/html'
58
+
57
59
  @game_framework_extra = Gobstones::CompilationMode::GameFramework.extra_code
58
60
  @game_framework_program = Gobstones::CompilationMode::GameFramework.program_code
59
61
  @game_framework_default = Gobstones::CompilationMode::GameFramework.default_code
@@ -0,0 +1,210 @@
1
+ class GobstonesFeedbackHook < Mumukit::Hook
2
+ def run!(request, results)
3
+ content = request.content
4
+ test_results = results.test_results[0]
5
+
6
+ GobstonesExplainer.new.explain(content, test_results) if test_results.is_a? String
7
+ end
8
+
9
+ class GobstonesExplainer < Mumukit::Explainer
10
+ def explain_program_has_a_name(submission, result)
11
+ if identifier_instead_of_brace? result
12
+ (submission.match malformed_program_header_with_name).try do |it|
13
+ { name: it[1] }
14
+ end
15
+ end
16
+ end
17
+
18
+ def explain_program_has_no_opening_curly_brace(submission, result)
19
+ if identifier_instead_of_brace? result
20
+ /#{malformed_program_header_with_no_curly_braces}/ =~ submission
21
+ end
22
+ end
23
+
24
+ def explain_program_before_closing_structure_when_program(submission, result)
25
+ if program_instead_of_command?(result) && missing_brace_end?(submission) && function_or_procedure?(submission)
26
+ (submission.match program).try do |it|
27
+ { keyword: last_function_or_procedure(submission) }
28
+ end
29
+ end
30
+ end
31
+
32
+ def explain_program_before_closing_structure_when_no_program(submission, result)
33
+ if program_instead_of_command?(result) && missing_brace_end?(submission) && function_or_procedure?(submission)
34
+ if /#{program}/ =~ submission
35
+ nil
36
+ else
37
+ { keyword: last_function_or_procedure(submission) }
38
+ end
39
+ end
40
+ end
41
+
42
+ def explain_surplus_closing_brace(_, result)
43
+ if unbalanced_closing_braces? result
44
+ (error_line(result)).try do |it|
45
+ { line: it[1] }
46
+ end
47
+ end
48
+ end
49
+
50
+ def explain_upper_function_typo(submission, result)
51
+ if upper_identifier_instead_of_definition? result
52
+ /#{uppercase_function}/ =~ submission
53
+ end
54
+ end
55
+
56
+ def explain_upper_procedure_typo(submission, result)
57
+ if upper_identifier_instead_of_definition? result
58
+ /#{uppercase_procedure}/ =~ submission
59
+ end
60
+ end
61
+
62
+ def explain_upper_program_typo(submission, result)
63
+ if upper_identifier_instead_of_definition? result
64
+ /#{uppercase_program}/ =~ submission
65
+ end
66
+ end
67
+
68
+ def explain_missing_closing_brace_before_procedure(submission, result)
69
+ if procedure_instead_of_command?(result) && missing_brace_end?(submission)
70
+ (error_line(result)).try do |it|
71
+ { line: it[1] }
72
+ end
73
+ end
74
+ end
75
+
76
+ def explain_lower_builtin_procedure_typo(submission, result)
77
+ if open_paren_instead_of_assign?(result)
78
+ (submission.match lower_builtin_procedure).try do |it|
79
+ { lower: it[1][0...5], upper: it[1][0...5].capitalize }
80
+ end
81
+ end
82
+ end
83
+
84
+ def explain_upper_builtin_function_typo(submission, result)
85
+ if procedure_invocation_instead_of_expression?(result)
86
+ (submission.match upper_builtin_function).try do |it|
87
+ { upper: it[1], lower: it[1].camelize(:lower) }
88
+ end
89
+ end
90
+ end
91
+
92
+ def explain_color_typo(_, result)
93
+ if roja_not_defined?(result) || negra_not_defined?(result)
94
+ (result.match color_not_defined).try do |it|
95
+ { color: it[1], rectified_color: rectified_color(it[1]) }
96
+ end
97
+ end
98
+ end
99
+
100
+ private
101
+
102
+ def malformed_program_header_with_name
103
+ '.*program +([A-Za-z]\w*)'
104
+ end
105
+
106
+ def upper_identifier_instead_of_brace?(result)
107
+ identifier_instead_of_brace?(result, 'may')
108
+ end
109
+
110
+ def lower_identifier_instead_of_brace?(result)
111
+ identifier_instead_of_brace?(result, 'min')
112
+ end
113
+
114
+ def identifier_instead_of_brace?(result, capital='...')
115
+ result.match? /<pre>\[\d+:\d+\]: Se esperaba una llave izquierda \("{"\).\nSe encontró: un identificador con #{capital}úsculas.<\/pre>/
116
+ end
117
+
118
+ def malformed_program_header_with_no_curly_braces
119
+ '.*program *[\r\n]\s*[^{]\w+'
120
+ end
121
+
122
+ def program_instead_of_command?(result)
123
+ result.match? /<pre>\[\d+:\d+\]: Se esperaba un comando.\nSe encontró: la palabra clave "program".<\/pre>/
124
+ end
125
+
126
+ def missing_brace_end?(submission)
127
+ submission.count('{') > submission.count('}')
128
+ end
129
+
130
+ def function_or_procedure?(submission)
131
+ submission.match? function_or_procedure
132
+ end
133
+
134
+ def function_or_procedure
135
+ '(function)\s*\w+\s*\([\w\d\s,]*\)\s*{|(procedure)\s*\w+\s*\([\w\d\s,]*\)\s*{'
136
+ end
137
+
138
+ def last_function_or_procedure(submission)
139
+ submission.scan(/#{function_or_procedure}/).last.compact.first
140
+ end
141
+
142
+ def program
143
+ 'program\s*{'
144
+ end
145
+
146
+ def unbalanced_closing_braces?(result)
147
+ result.match? /<pre>\[\d+:\d+\]: Se encontró un "}" pero no había una llave abierta "{".<\/pre>/
148
+ end
149
+
150
+ def error_line(result)
151
+ result.match /<pre>\[(\d+):\d+\]:/
152
+ end
153
+
154
+ def upper_identifier_instead_of_definition?(result)
155
+ result.match? /<pre>\[\d+:\d+\]: Se esperaba una definición \(de programa, función, procedimiento, o tipo\).\nSe encontró: un identificador con mayúsculas.<\/pre>/
156
+ end
157
+
158
+ def uppercase_function
159
+ 'Function\s'
160
+ end
161
+
162
+ def uppercase_procedure
163
+ 'Procedure\s'
164
+ end
165
+
166
+ def uppercase_program
167
+ 'Program[\s{]*'
168
+ end
169
+
170
+ def procedure_instead_of_command?(result)
171
+ result.match? /<pre>\[\d+:\d+\]: Se esperaba un comando.\nSe encontró: la palabra clave "procedure".<\/pre>/
172
+ end
173
+
174
+ def open_paren_instead_of_assign?(result)
175
+ result.match? /<pre>\[\d+:\d+\]: Se esperaba un operador de asignación \(":="\).\nSe encontró: un paréntesis izquierdo \("\("\).<\/pre>/
176
+ end
177
+
178
+ def lower_builtin_procedure
179
+ '(mover[\s(]|poner[\s(]|sacar[\s(])'
180
+ end
181
+
182
+ def procedure_invocation_instead_of_expression?(result)
183
+ result.match? /<pre>\[\d+:\d+\]: Se esperaba una expresión.\nSe encontró: una invocación a un procedimiento.<\/pre>/
184
+ end
185
+
186
+ def upper_builtin_function
187
+ '(PuedeMover|NroBolitas|HayBolitas)'
188
+ end
189
+
190
+ def roja_not_defined?(result)
191
+ color_not_defined? result, 'Roja'
192
+ end
193
+
194
+ def negra_not_defined?(result)
195
+ color_not_defined? result, 'Negra'
196
+ end
197
+
198
+ def color_not_defined?(result, color)
199
+ result.match?(color_not_defined(color))
200
+ end
201
+
202
+ def color_not_defined(color='\w+')
203
+ /<pre>\[\d+:\d+\]: El constructor "(#{color})" no está definido.<\/pre>/
204
+ end
205
+
206
+ def rectified_color(color)
207
+ color.chop + "o"
208
+ end
209
+ end
210
+ end
@@ -21,9 +21,10 @@ require_relative './render/html_renderer'
21
21
 
22
22
  require_relative './multiple_executions_runner'
23
23
 
24
+ require_relative './checker'
25
+ require_relative './expectations_hook'
26
+ require_relative './feedback_hook'
24
27
  require_relative './metadata_hook'
25
28
  require_relative './precompile_hook'
26
29
  require_relative './test_hook'
27
30
  require_relative './version_hook'
28
- require_relative './expectations_hook'
29
- require_relative './checker'
@@ -12,7 +12,19 @@ en:
12
12
  code_wrong_argument_type: 'wrong arguments type'
13
13
  code_unassigned_variable: 'unassigned variable'
14
14
  code_wrong_arguments_quantity: 'wrong arguments quantity'
15
+ color_typo: 'It seems you wrote <code>%{color}</code>. Did you mean <code>%{rectified_color}</code>?'
15
16
  expected_board: 'Expected final board'
16
17
  final_board: 'Final board'
17
18
  initial_board: 'Initial board'
19
+ lower_builtin_procedure_typo: 'Looks lie you wrote <code>%{lower}</code> in lowercase. Remember procedures such as <code>%{upper}()</code> should start in uppercase!'
20
+ missing_closing_brace_before_procedure: "Looks like you're missing a <code>}</code> before a <code>procedure</code>. Maybe it's on line <strong>%{line}</strong> or near it?"
18
21
  no_program_found: 'No program definition was found'
22
+ program_before_closing_structure_when_no_program: "Looks like you're missing a <code>}</code> to close the last <code>%{keyword}</code>."
23
+ program_before_closing_structure_when_program: "Looks like you're missing a <code>}</code> to close the last <code>%{keyword}</code> before <code>program</code>."
24
+ program_has_a_name: "Looks like you named your <code>program</code> <code>%{name}</code>, but <code>program</code>s shouldn't be named."
25
+ program_has_no_opening_curly_brace: "Looks like a <code>{</code> is missing on <code>program</code>. Remember the content in <code>program</code> should be between curly braces."
26
+ surplus_closing_brace: "The amount of <code>{</code> and <code>}</code> doesn't match. Maybe there's an extra <code>}</code> on line <strong>%{line}</strong> or near it?"
27
+ upper_builtin_function_typo: 'Looks like you wrote <code>%{upper}</code> starting in uppercase. Remember functions such as <code>%{lower}</code> should start in lowercase!'
28
+ upper_function_typo: 'Looks like you wrote <code>Function</code> instead of <code>function</code>. Remember it should start in lowercase!'
29
+ upper_procedure_typo: 'Looks like you wrote <code>Procedure</code> instead of <code>procedure</code>. Remember it should start in lowercase!'
30
+ upper_program_typo: 'Looks like you wrote <code>Program</code> instead of <code>program</code>. Remember it should start in lowercase!'
@@ -12,7 +12,19 @@ es:
12
12
  code_wrong_argument_type: 'problema de tipos en los argumentos'
13
13
  code_unassigned_variable: 'variable no asignada'
14
14
  code_wrong_arguments_quantity: 'cantidad errónea de argumentos'
15
+ color_typo: 'Parece que escribiste <code>%{color}</code>. ¿Quisiste referirte al color <code>%{rectified_color}</code>?'
15
16
  expected_board: 'Tablero final esperado'
16
17
  final_board: 'Tablero final'
17
18
  initial_board: 'Tablero inicial'
19
+ lower_builtin_procedure_typo: 'Parece que escribiste <code>%{lower}</code> en minúsculas. ¡Recordá que los procedimientos como <code>%{upper}()</code> deben comenzar en mayúsculas!'
20
+ missing_closing_brace_before_procedure: 'Parece que te falta una <code>}</code> antes de un <code>procedure</code>. ¿Puede que sea en la línea <strong>%{line}</strong> o cerca de ella?'
18
21
  no_program_found: 'No se encontró ninguna definición de programa'
22
+ program_before_closing_structure_when_no_program: 'Parece que te falta una <code>}</code> que cierre el último <code>%{keyword}</code>.'
23
+ program_before_closing_structure_when_program: 'Parece que te falta una <code>}</code> que cierre el <code>%{keyword}</code> antes de <code>program</code>.'
24
+ program_has_a_name: 'Parece que llamaste <code>%{name}</code> a <code>program</code>, pero los <code>program</code> no llevan nombre.'
25
+ program_has_no_opening_curly_brace: 'Parece que a <code>program</code> le falta <code>{</code>. Recordá que el contenido de <code>program</code> va entre llaves.'
26
+ surplus_closing_brace: 'La cantidad de <code>{</code> y <code>}</code> no coincide. ¿Puede que sobre una <code>}</code> en la línea <strong>%{line}</strong> o cerca de ella?'
27
+ upper_builtin_function_typo: 'Parece que escribiste <code>%{upper}</code> comenzando en mayúsculas. ¡Recordá que las funciones como <code>%{lower}</code> deben comenzar en minúsculas!'
28
+ upper_function_typo: 'Parece que escribiste <code>Function</code> en lugar de <code>function</code>. ¡Recordá que debe comenzar en minúsculas!'
29
+ upper_procedure_typo: 'Parece que escribiste <code>Procedure</code> en lugar de <code>procedure</code>. ¡Recordá que debe comenzar en minúsculas!'
30
+ upper_program_typo: 'Parece que escribiste <code>Program</code> en lugar de <code>program</code>. ¡Recordá que debe comenzar en minúsculas!'
@@ -12,7 +12,19 @@ pt:
12
12
  code_wrong_argument_type: 'problema de tipos nos argumentos'
13
13
  code_unassigned_variable: 'variável não atribuída'
14
14
  code_wrong_arguments_quantity: 'quantidade errada de argumentos'
15
+ color_typo: 'Parece que você escreveu <code>%{color}</code>. Você quis se referir à cor <code>%{rectified_color}</code>?'
15
16
  expected_board: 'Tabuleiro final esperado'
16
17
  final_board: 'Tabuleiro final'
17
18
  initial_board: 'Tabuleiro inicial'
19
+ lower_builtin_procedure_typo: 'Parece que você escreveu <code>%{lower}</code> em letras minúsculas. Lembre-se de que procedimentos como <code>%{upper}()</code> devem começar em maiúsculas!'
20
+ missing_closing_brace_before_procedure: 'Parece que está faltando um <code>}</code> antes de um <code>procedure</code>. Pode ser na linha <strong>%{line}</strong> ou perto dela?'
18
21
  no_program_found: 'Nenhuma definição de programa foi encontrada'
22
+ program_before_closing_structure_when_no_program: 'Parece que está faltando um <code>}</code> que fecha a última <code>%{keyword}</code>.'
23
+ program_before_closing_structure_when_program: 'Parece que está faltando um <code>}</code> que fecha o <code>%{keyword}</code> antes do <code>program</code>.'
24
+ program_has_a_name: 'Parece que você chamou <code>%{name}</code> para <code>program</code>, mas <code>program</code>as não têm nomes.'
25
+ program_has_no_opening_curly_brace: 'Parece que a <code>program</code> está faltando <code>{</code>. Lembre-se de que o conteúdo do <code>program</code> está entre colchetes.'
26
+ surplus_closing_brace: 'A quantidade de <code>{</code> e <code>}</code> não corresponde. Pode ser sobre um <code>}</code> na linha <strong>%{line}</strong> ou próximo a ela?'
27
+ upper_builtin_function_typo: 'Parece que você digitou <code>%{upper}</code> começando com letras maiúsculas. Lembre-se de que funções como <code>%{lower}</code> devem começar em minúsculas!'
28
+ upper_function_typo: 'Parece que você escreveu <code>Function</code> em vez de <code>function</code>. Lembre-se de começar em letras minúsculas!'
29
+ upper_procedure_typo: 'Parece que você escreveu <code>Procedure</code> em vez de <code>procedure</code>. Lembre-se de começar em letras minúsculas!'
30
+ upper_program_typo: 'Parece que você escreveu <code>Program</code> em vez de <code>program</code>. Lembre-se de começar em letras minúsculas!'
@@ -133,3 +133,7 @@
133
133
  border: 1px solid #6D6E70 !important;
134
134
  border-radius: 4px;
135
135
  }
136
+
137
+ .mu-kids-exercise.mu-kindergarten .blocklyBubbleCanvas {
138
+ display: none;
139
+ }
@@ -9,6 +9,11 @@
9
9
  Blockly.FieldImage.prototype.setValue = function(a) {
10
10
  if (a && a.startsWith("undefined")) {
11
11
  console.debug(`Ignoring unavailable image ${a}`);
12
+ } else if (a) {
13
+ const absoluteUrl = a
14
+ .replace("../media/", "../local-media/")
15
+ .replace("../local-media/", "<%= @assets_url %>/local-media/");
16
+ this.__setValue__(absoluteUrl);
12
17
  } else {
13
18
  this.__setValue__(a);
14
19
  }
@@ -211,10 +216,7 @@
211
216
  this._setBlocklyDisplayMode();
212
217
  this._setBlocklySounds();
213
218
  this._setBlocklyColors();
214
-
215
- if (!this.readOnly) {
216
- this._relocateTrashOnResize();
217
- }
219
+ this._relocateTrashOnResize();
218
220
 
219
221
  // Removing "/" from the block id character set to avoid syntax errors
220
222
  Blockly.utils.genUid.soup_ = Blockly.utils.genUid.soup_.replace("/", "");
@@ -228,11 +230,16 @@
228
230
  },
229
231
 
230
232
  _relocateTrashOnResize() {
233
+ if (this.readOnly) {
234
+ console.debug("No trash relocate on resize required");
235
+ return;
236
+ }
237
+
231
238
  $('.mu-kids-context, .mu-kids-results').on('hidden.bs.modal shown.bs.modal', () => {
232
239
  this._relocateTrash();
233
240
  });
234
241
 
235
- $(window).resize(() => this._relocateTrash());
242
+ $(window).resize(() => setTimeout(this._relocateTrash));
236
243
  },
237
244
 
238
245
 
@@ -241,6 +248,8 @@
241
248
  *
242
249
  * Blockly's workspace is destroyed when toolbox changes, so initialization
243
250
  * is performed here
251
+
252
+ * @see _initializeBlocklyWorkspace
244
253
  */
245
254
  _initializeCustomToolboxBlocklyWorkspace(toolboxXml) {
246
255
  this._getBlockly().toolbox = { defaultToolbox: toolboxXml };
@@ -253,6 +262,8 @@
253
262
  * Blockly's workspace is destroyed when toolbox changes,
254
263
  * so this method will initialize it only if a there is a custom toolbox
255
264
  * that will be called later.
265
+ *
266
+ * @see _initializeBlocklyWorkspace
256
267
  */
257
268
  _initializeNonCustomToolboxBlocklyWorkspace() {
258
269
  if (!this.hasCustomToolbox()) {
@@ -260,11 +271,20 @@
260
271
  }
261
272
  },
262
273
 
274
+ /**
275
+ * Performs actual workspace (re)creation,
276
+ * which sets initial xml, user solution, trash position
277
+ * and appropriate callbacks.
278
+ *
279
+ * This method is the actual culmination of the blockly initialization
280
+ * process
281
+ */
263
282
  _initializeBlocklyWorkspace() {
264
283
  console.debug('Initializing Blockly Workspace');
265
284
 
266
285
  this._setInitialXml();
267
286
  this._initializeWorkspace();
287
+ this._relocateTrash();
268
288
  this._subscribeToWorkspace(() => this._updateSolution());
269
289
 
270
290
  if (this.hasInteractiveProgram()) {
@@ -275,19 +295,32 @@
275
295
  },
276
296
 
277
297
  _relocateTrash() {
278
- const width = $('#blocklyDiv').width() - 68;
279
- const height = $('#blocklyDiv').height() - 210;
280
- $('.blocklyTrash').css("transform", `translate(${width}px, ${height}px)`);
281
- $('.blocklyTrash').css("display", "unset");
298
+ if (this.readOnly) {
299
+ console.debug("No trash relocate required");
300
+ return;
301
+ }
302
+
303
+ const $blocklyTrash = $('.blocklyTrash');
304
+ const $blocklyDiv = $('#blocklyDiv');
305
+ const width = $blocklyDiv.width() - 68;
306
+ const height = $blocklyDiv.height() - 210;
307
+ $blocklyTrash.css("transform", `translate(${width}px, ${height}px)`);
308
+ $blocklyTrash.css("display", "unset");
282
309
  },
283
310
 
284
311
  _updateSolution() {
312
+ console.debug("Updating solution");
285
313
  const blockly = this._getBlockly();
286
-
314
+ let changed;
287
315
  if (this.teacherMode) {
288
- this._setExtraCode(blockly.workspaceXml);
316
+ changed = this._setExtraCode(blockly.workspaceXml);
289
317
  } else {
290
- this._setStudentSolution(blockly.workspaceXml);
318
+ changed = this._setStudentSolution(blockly.workspaceXml);
319
+ }
320
+
321
+ if (!changed) {
322
+ console.debug("No solution update required")
323
+ return;
291
324
  }
292
325
 
293
326
  // TODO: this hack enables Angular two-way binding for Bibliotheca. Should be replaced with Mumuki events system
@@ -380,22 +413,44 @@
380
413
  return;
381
414
  }
382
415
 
383
- const blockly = this._getBlockly();
416
+ console.debug("Set teacher actions");
384
417
  const actions = new Parser().getActionsFromSource(teacherCode);
385
- blockly.primitiveProcedures = this._withDefaultIcons(actions, 'procedureDeclarations');
386
- blockly.primitiveFunctions = this._withDefaultIcons(actions, 'functionDeclarations');
418
+
419
+ this._setPrimitiveProcedures(this._withDefaultIcons(actions, 'procedureDeclarations'));
420
+ this._setPrimitiveFunctions(this._withDefaultIcons(actions, 'functionDeclarations'));
387
421
  },
388
422
 
389
423
  _setGameActions() {
424
+ if (!this._isGame()) {
425
+ return;
426
+ }
427
+
428
+ console.debug("Set game actions");
390
429
  const blockly = this._getBlockly();
391
- if (this._isGame()) {
392
- blockly.primitiveProcedures = blockly.primitiveProcedures || [];
393
- blockly.primitiveProcedures = blockly.primitiveProcedures.concat([
394
- this._gamePrimitive('ShiftUp'),
395
- this._gamePrimitive('ShiftDown'),
396
- this._gamePrimitive('ShiftLeft'),
397
- this._gamePrimitive('ShiftRight')
398
- ]);
430
+
431
+ this._setPrimitiveProcedures((blockly.primitiveProcedures || []).concat([
432
+ this._gamePrimitive('ShiftUp'),
433
+ this._gamePrimitive('ShiftDown'),
434
+ this._gamePrimitive('ShiftLeft'),
435
+ this._gamePrimitive('ShiftRight')
436
+ ]));
437
+ },
438
+
439
+ _setPrimitiveProcedures(procedures) {
440
+ this._setBlocklyActions("primitiveProcedures", procedures);
441
+ },
442
+
443
+ _setPrimitiveFunctions(functions) {
444
+ this._setBlocklyActions("primitiveFunctions", functions);
445
+ },
446
+
447
+ _setBlocklyActions(key, actions) {
448
+ try {
449
+ this._getBlockly()[key] = actions
450
+ } catch (e) {
451
+ if (this._getBlockly()[key] !== actions) {
452
+ throw e;
453
+ }
399
454
  }
400
455
  },
401
456
 
@@ -416,8 +471,12 @@
416
471
  * to user content in laboratory, and default content in bibliotheca
417
472
  */
418
473
  _setStudentSolution(code) {
419
- console.debug(`Setting student ${code}`)
420
- this._getStudentEditor().value = code;
474
+ if (this._getStudentEditor().value !== code) {
475
+ console.debug(`Setting student ${code}`)
476
+ this._getStudentEditor().value = code;
477
+ return true;
478
+ }
479
+ return false;
421
480
  },
422
481
 
423
482
  _getDefaultCode() {
@@ -429,8 +488,12 @@
429
488
  },
430
489
 
431
490
  _setExtraCode(code) {
432
- console.debug(`Setting extra ${code}`)
433
- this._getEditorExtra().value = code;
491
+ if (this._getEditorExtra().value !== code) {
492
+ console.debug(`Setting extra ${code}`)
493
+ this._getEditorExtra().value = code;
494
+ return true;
495
+ }
496
+ return false;
434
497
  },
435
498
 
436
499
  _getEditorExtra: function() {
@@ -16,6 +16,7 @@
16
16
  _setAttire: function () {
17
17
  $.getJSON(this.attireUrl, function (attire) {
18
18
  GobstonesBoard && GobstonesBoard.setDefaultAttire(attire);
19
+ attire.rules.forEach((rule) => $.get(rule.image));
19
20
  });
20
21
  }
21
22
  });
@@ -1,3 +1,3 @@
1
1
  module GobstonesVersionHook
2
- VERSION = '2.10.0'
2
+ VERSION = '2.13.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-gobstones-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.10.0
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rodrigo Alfonso
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2020-11-06 00:00:00.000000000 Z
12
+ date: 2020-12-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gobstones-board
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.36'
62
+ version: '2.37'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.36'
69
+ version: '2.37'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: nokogiri
72
72
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +183,7 @@ files:
183
183
  - lib/checker.rb
184
184
  - lib/expectations_hook.rb
185
185
  - lib/extensions/string.rb
186
+ - lib/feedback_hook.rb
186
187
  - lib/game_framework/default.gbs.erb
187
188
  - lib/game_framework/default.xml.erb
188
189
  - lib/game_framework/extra.gbs.erb
@@ -275,7 +276,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
275
276
  - !ruby/object:Gem::Version
276
277
  version: '0'
277
278
  requirements: []
278
- rubygems_version: 3.0.8
279
+ rubygems_version: 3.0.6
279
280
  signing_key:
280
281
  specification_version: 4
281
282
  summary: Gobstones Runner for Mumuki