mumuki-gobstones-runner 2.11.0 → 2.14.1

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: 1636b8a5a322c4a74f84a725e8df8fa0118e38362b3732a70e76deba7b87e620
4
- data.tar.gz: 41d818b4cb24ce921ed45f0c539437ac0395ddc4152e2f5a4ebf3e2a19168b07
3
+ metadata.gz: 16b0e7c565a14d86f588746885e896e9bd00157e4d54bde3cf66462ed1a91e24
4
+ data.tar.gz: a9f2db6e60708af307cab7e26360662bc4cfeade97960bc7fd2297b9ca8ea2e1
5
5
  SHA512:
6
- metadata.gz: bb2ac8c37f98b4239de66fdc9f4b73982a013769add4d71172561e7d399774038647690468193a2dee19d2c8cf886582538f4bfc13479057a3837918affec4d0
7
- data.tar.gz: aba3b7d54384b3c44587219236ccfb4d3720560d63f5d7ac8193bc95604e4ec1ddd3de32544c8fcbaf0d3f396d19c62b3c9b6576b036e27f17d7d207d155b827
6
+ metadata.gz: a83db717ca0f2c78f1222cde2a809a8b78c878f6cabb0428ce4ea38cfbda2e1b92fff01cc11596509522792c7c41f56c971ab80c7c7c9de6139432d1d9d5cd82
7
+ data.tar.gz: 591f2e6414c5aac0c8ff4779b9a1eaaa9e3516447f941bbd6f12e87066e7f84d097139dead5a3c1c5aa86122aa478761a55e873dcbdb2039ab1b0e2c616c69a9
@@ -17,10 +17,10 @@ class Mumukit::Server::App < Sinatra::Base
17
17
  get_local_asset "#{asset_type}/#{name}.svg", "lib/public/#{name}.svg", 'image/svg+xml'
18
18
  end
19
19
 
20
- def self.get_media_assets(folder)
20
+ def self.get_media_assets(folder, content_type = nil)
21
21
  Dir.glob(File.join(__dir__,"../lib/public/#{folder}/*")).each do |path|
22
22
  relative_media_asset_path = "#{folder}/#{File.basename path}"
23
- get_local_asset relative_media_asset_path, "lib/public/#{relative_media_asset_path}"
23
+ get_local_asset relative_media_asset_path, "lib/public/#{relative_media_asset_path}", content_type
24
24
  end
25
25
  end
26
26
 
@@ -38,9 +38,13 @@ class Mumukit::Server::App < Sinatra::Base
38
38
  get_local_asset 'editor/editor.css', 'lib/render/editor/editor.css', 'text/css'
39
39
  get_local_asset 'editor/hammer.min.js', 'lib/render/editor/hammer.min.js', 'application/javascript'
40
40
  get_local_asset 'boom.png', 'lib/public/boom.png', 'image/png'
41
+
42
+ # Depracated, prefer toolbox path
41
43
  get_local_asset 'full-kindergarten-toolbox.xml', 'lib/public/full-kindergarten-toolbox.xml', 'text/plain'
42
44
  get_local_asset 'minimal-kindergarten-toolbox.xml', 'lib/public/minimal-kindergarten-toolbox.xml', 'text/plain'
43
45
 
46
+ get_media_assets 'toolbox', 'text/plain'
47
+
44
48
  get_media_assets 'media'
45
49
  get_media_assets 'local-media'
46
50
 
@@ -65,7 +65,7 @@ class GobstonesFeedbackHook < Mumukit::Hook
65
65
  end
66
66
  end
67
67
 
68
- def explain_missing_closing_brace_after_procedure(submission, result)
68
+ def explain_missing_closing_brace_before_procedure(submission, result)
69
69
  if procedure_instead_of_command?(result) && missing_brace_end?(submission)
70
70
  (error_line(result)).try do |it|
71
71
  { line: it[1] }
@@ -62,6 +62,26 @@ procedure ShiftDown() {
62
62
  ShiftTo(Sur)
63
63
  }
64
64
 
65
+ function one() {
66
+ return (1);
67
+ }
68
+
69
+ function two() {
70
+ return (2);
71
+ }
72
+
73
+ function three() {
74
+ return (3);
75
+ }
76
+
77
+ function four() {
78
+ return (4);
79
+ }
80
+
81
+ function five() {
82
+ return (5);
83
+ }
84
+
65
85
  procedure ShiftTo(dir) {
66
86
  if (puedeMover(dir)) {
67
87
  Sacar(Rojo)
@@ -12,12 +12,12 @@ 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 %{color}. Maybe you meant %{rectified_color}?'
15
+ color_typo: 'It seems you wrote <code>%{color}</code>. Did you mean <code>%{rectified_color}</code>?'
16
16
  expected_board: 'Expected final board'
17
17
  final_board: 'Final board'
18
18
  initial_board: 'Initial board'
19
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_after_procedure: "Looks like you're missing a <code>}</code> to close a <code>procedure</code>. Maybe it's on line <strong>%{line}</strong> or near it?"
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?"
21
21
  no_program_found: 'No program definition was found'
22
22
  program_before_closing_structure_when_no_program: "Looks like you're missing a <code>}</code> to close the last <code>%{keyword}</code>."
23
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>."
@@ -12,12 +12,12 @@ 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 %{color}. ¿Quisiste referirte al color %{rectified_color}?'
15
+ color_typo: 'Parece que escribiste <code>%{color}</code>. ¿Quisiste referirte al color <code>%{rectified_color}</code>?'
16
16
  expected_board: 'Tablero final esperado'
17
17
  final_board: 'Tablero final'
18
18
  initial_board: 'Tablero inicial'
19
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_after_procedure: 'Parece que te falta una <code>}</code> que cierre un <code>procedure</code>. ¿Puede que sea en la línea <strong>%{line}</strong> o cerca de ella?'
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?'
21
21
  no_program_found: 'No se encontró ninguna definición de programa'
22
22
  program_before_closing_structure_when_no_program: 'Parece que te falta una <code>}</code> que cierre el último <code>%{keyword}</code>.'
23
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>.'
@@ -12,12 +12,12 @@ 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 %{color}. Você quis se referir à cor %{rectified_color}?'
15
+ color_typo: 'Parece que você escreveu <code>%{color}</code>. Você quis se referir à cor <code>%{rectified_color}</code>?'
16
16
  expected_board: 'Tabuleiro final esperado'
17
17
  final_board: 'Tabuleiro final'
18
18
  initial_board: 'Tabuleiro inicial'
19
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_after_procedure: 'Parece que está faltando um <code>}</code> que fecha um <code>procedure</code>. Pode ser na linha <strong>%{line}</strong> ou perto dela?'
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?'
21
21
  no_program_found: 'Nenhuma definição de programa foi encontrada'
22
22
  program_before_closing_structure_when_no_program: 'Parece que está faltando um <code>}</code> que fecha a última <code>%{keyword}</code>.'
23
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>.'
Binary file
Binary file
Binary file
Binary file
@@ -1,2 +1 @@
1
1
  <category name="Procedimientos primitivos"></category>
2
- <category name="Funciones primitivas"></category>
@@ -0,0 +1,6 @@
1
+ <category name="Bloques de Gobstones">
2
+ <block type="RepeticionSimple"></block>
3
+ <block type="two"></block>
4
+ <block type="three"></block>
5
+ </category>
6
+ <category name="Procedimientos primitivos"></category>
@@ -0,0 +1,7 @@
1
+ <category name="Bloques de Gobstones">
2
+ <block type="RepeticionSimple"></block>
3
+ <block type="two"></block>
4
+ <block type="three"></block>
5
+ <block type="four"></block>
6
+ </category>
7
+ <category name="Procedimientos primitivos"></category>
@@ -0,0 +1,8 @@
1
+ <category name="Bloques de Gobstones">
2
+ <block type="RepeticionSimple"></block>
3
+ <block type="two"></block>
4
+ <block type="three"></block>
5
+ <block type="four"></block>
6
+ <block type="five"></block>
7
+ </category>
8
+ <category name="Procedimientos primitivos"></category>
@@ -0,0 +1,5 @@
1
+ <category name="Bloques de Gobstones">
2
+ <block type="RepeticionSimple"></block>
3
+ </category>
4
+ <category name="Funciones primitivas"></category>
5
+ <category name="Procedimientos primitivos"></category>
@@ -0,0 +1 @@
1
+ <category name="Procedimientos primitivos"></category>
@@ -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
+ }
@@ -216,10 +216,7 @@
216
216
  this._setBlocklyDisplayMode();
217
217
  this._setBlocklySounds();
218
218
  this._setBlocklyColors();
219
-
220
- if (!this.readOnly) {
221
- this._relocateTrashOnResize();
222
- }
219
+ this._relocateTrashOnResize();
223
220
 
224
221
  // Removing "/" from the block id character set to avoid syntax errors
225
222
  Blockly.utils.genUid.soup_ = Blockly.utils.genUid.soup_.replace("/", "");
@@ -233,11 +230,16 @@
233
230
  },
234
231
 
235
232
  _relocateTrashOnResize() {
233
+ if (this.readOnly) {
234
+ console.debug("No trash relocate on resize required");
235
+ return;
236
+ }
237
+
236
238
  $('.mu-kids-context, .mu-kids-results').on('hidden.bs.modal shown.bs.modal', () => {
237
239
  this._relocateTrash();
238
240
  });
239
241
 
240
- $(window).resize(() => this._relocateTrash());
242
+ $(window).resize(() => setTimeout(this._relocateTrash));
241
243
  },
242
244
 
243
245
 
@@ -246,6 +248,8 @@
246
248
  *
247
249
  * Blockly's workspace is destroyed when toolbox changes, so initialization
248
250
  * is performed here
251
+
252
+ * @see _initializeBlocklyWorkspace
249
253
  */
250
254
  _initializeCustomToolboxBlocklyWorkspace(toolboxXml) {
251
255
  this._getBlockly().toolbox = { defaultToolbox: toolboxXml };
@@ -258,6 +262,8 @@
258
262
  * Blockly's workspace is destroyed when toolbox changes,
259
263
  * so this method will initialize it only if a there is a custom toolbox
260
264
  * that will be called later.
265
+ *
266
+ * @see _initializeBlocklyWorkspace
261
267
  */
262
268
  _initializeNonCustomToolboxBlocklyWorkspace() {
263
269
  if (!this.hasCustomToolbox()) {
@@ -265,11 +271,20 @@
265
271
  }
266
272
  },
267
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
+ */
268
282
  _initializeBlocklyWorkspace() {
269
283
  console.debug('Initializing Blockly Workspace');
270
284
 
271
285
  this._setInitialXml();
272
286
  this._initializeWorkspace();
287
+ this._relocateTrash();
273
288
  this._subscribeToWorkspace(() => this._updateSolution());
274
289
 
275
290
  if (this.hasInteractiveProgram()) {
@@ -280,10 +295,17 @@
280
295
  },
281
296
 
282
297
  _relocateTrash() {
283
- const width = $('#blocklyDiv').width() - 68;
284
- const height = $('#blocklyDiv').height() - 210;
285
- $('.blocklyTrash').css("transform", `translate(${width}px, ${height}px)`);
286
- $('.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");
287
309
  },
288
310
 
289
311
  _updateSolution() {
@@ -406,11 +428,14 @@
406
428
  console.debug("Set game actions");
407
429
  const blockly = this._getBlockly();
408
430
 
409
- this._setPrimitiveProcedures((blockly.primitiveProcedures || []).concat([
410
- this._gamePrimitive('ShiftUp'),
411
- this._gamePrimitive('ShiftDown'),
412
- this._gamePrimitive('ShiftLeft'),
413
- this._gamePrimitive('ShiftRight')
431
+ this._setPrimitiveProcedures(
432
+ this._gamePrimitivesFor(blockly.primitiveProcedures, [
433
+ 'ShiftUp', 'ShiftDown', 'ShiftLeft', 'ShiftRight'
434
+ ]));
435
+
436
+ this._setPrimitiveFunctions(
437
+ this._gamePrimitivesFor(blockly.primitiveFunctions, [
438
+ 'one', 'two', 'three', 'four', 'five'
414
439
  ]));
415
440
  },
416
441
 
@@ -436,6 +461,10 @@
436
461
  return { alias: 'procedureDeclaration', name, attributes: {block_icon: `<%= @assets_url %>/media/${name}.png`} };
437
462
  },
438
463
 
464
+ _gamePrimitivesFor(base, names) {
465
+ return (base || []).concat(names.map(it => this._gamePrimitive(it)));
466
+ },
467
+
439
468
  _getBlockly() {
440
469
  return this.$.blocklyElement;
441
470
  },
@@ -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.11.0'
2
+ VERSION = '2.14.1'
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.11.0
4
+ version: 2.14.1
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-10 00:00:00.000000000 Z
12
+ date: 2021-01-05 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: gobstones-board
@@ -240,12 +240,22 @@ files:
240
240
  - lib/public/media/disconnect.mp3
241
241
  - lib/public/media/disconnect.ogg
242
242
  - lib/public/media/disconnect.wav
243
+ - lib/public/media/five.png
244
+ - lib/public/media/four.png
245
+ - lib/public/media/one.png
243
246
  - lib/public/media/quote0.png
244
247
  - lib/public/media/quote1.png
245
248
  - lib/public/media/sprites.png
246
249
  - lib/public/media/sprites.svg
250
+ - lib/public/media/three.png
251
+ - lib/public/media/two.png
247
252
  - lib/public/minimal-kindergarten-toolbox.xml
248
253
  - lib/public/red.svg
254
+ - lib/public/toolbox/kindergarten-2-to-3.xml
255
+ - lib/public/toolbox/kindergarten-2-to-4.xml
256
+ - lib/public/toolbox/kindergarten-2-to-5.xml
257
+ - lib/public/toolbox/kindergarten-full.xml
258
+ - lib/public/toolbox/kindergarten-minimal.xml
249
259
  - lib/render/boards.html.erb
250
260
  - lib/render/editor/editor.css
251
261
  - lib/render/editor/editor.html.erb
@@ -276,7 +286,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
286
  - !ruby/object:Gem::Version
277
287
  version: '0'
278
288
  requirements: []
279
- rubygems_version: 3.0.8
289
+ rubygems_version: 3.0.3
280
290
  signing_key:
281
291
  specification_version: 4
282
292
  summary: Gobstones Runner for Mumuki