mumuki-gobstones-runner 2.4.2 → 2.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/lib/assets_server.rb +33 -4
  3. data/lib/checker.rb +2 -2
  4. data/lib/game_framework/default.gbs.erb +3 -0
  5. data/lib/game_framework/default.xml.erb +3 -0
  6. data/lib/game_framework/extra.gbs.erb +84 -0
  7. data/lib/game_framework/program.gbs.erb +5 -0
  8. data/lib/game_framework/program.xml.erb +17 -0
  9. data/lib/gobstones.rb +1 -0
  10. data/lib/gobstones/batch.rb +4 -2
  11. data/lib/gobstones/batch_parser.rb +5 -1
  12. data/lib/gobstones/compilation_mode.rb +60 -0
  13. data/lib/gobstones_runner.rb +3 -1
  14. data/lib/metadata_hook.rb +2 -1
  15. data/lib/public/full-kindergarten-toolbox.xml +5 -0
  16. data/lib/public/local-media/bool-false.svg +24 -0
  17. data/lib/public/local-media/bool-true.svg +17 -0
  18. data/lib/public/local-media/clean.png +0 -0
  19. data/lib/public/local-media/color-azul.svg +44 -0
  20. data/lib/public/local-media/color-negro.svg +44 -0
  21. data/lib/public/local-media/color-rojo.svg +44 -0
  22. data/lib/public/local-media/color-verde.svg +44 -0
  23. data/lib/public/local-media/direccion-este.svg +38 -0
  24. data/lib/public/local-media/direccion-norte.svg +38 -0
  25. data/lib/public/local-media/direccion-oeste.svg +38 -0
  26. data/lib/public/local-media/direccion-sur.svg +38 -0
  27. data/lib/public/local-media/hand.png +0 -0
  28. data/lib/public/local-media/main-procedure.png +0 -0
  29. data/lib/public/local-media/minus.png +0 -0
  30. data/lib/public/local-media/plus.png +0 -0
  31. data/lib/public/local-media/program.png +0 -0
  32. data/lib/public/local-media/repeticion-simple.png +0 -0
  33. data/lib/public/media/1x1.gif +0 -0
  34. data/lib/public/media/ShiftDown.png +0 -0
  35. data/lib/public/media/ShiftLeft.png +0 -0
  36. data/lib/public/media/ShiftRight.png +0 -0
  37. data/lib/public/media/ShiftUp.png +0 -0
  38. data/lib/public/media/click.mp3 +0 -0
  39. data/lib/public/media/click.ogg +0 -0
  40. data/lib/public/media/click.wav +0 -0
  41. data/lib/public/media/delete.mp3 +0 -0
  42. data/lib/public/media/delete.ogg +0 -0
  43. data/lib/public/media/delete.wav +0 -0
  44. data/lib/public/media/disconnect.mp3 +0 -0
  45. data/lib/public/media/disconnect.ogg +0 -0
  46. data/lib/public/media/disconnect.wav +0 -0
  47. data/lib/public/media/quote0.png +0 -0
  48. data/lib/public/media/quote1.png +0 -0
  49. data/lib/public/media/sprites.png +0 -0
  50. data/lib/public/media/sprites.svg +74 -0
  51. data/lib/public/minimal-kindergarten-toolbox.xml +2 -0
  52. data/lib/render/boards.html.erb +5 -6
  53. data/lib/render/editor/editor.css +9 -0
  54. data/lib/render/editor/{editor.html → editor.html.erb} +143 -120
  55. data/lib/render/html_renderer.rb +2 -2
  56. data/lib/render/layout/layout.html +109 -0
  57. data/lib/render/with_renderer.rb +6 -3
  58. data/lib/version_hook.rb +1 -1
  59. metadata +101 -37
@@ -49,7 +49,7 @@ module Gobstones
49
49
 
50
50
  def render_error_check_error_failed_another_reason(result)
51
51
  bind_result error: :check_error_failed_another_reason,
52
- expected_code: I18n.t("code_#{result[:expected_code]}"),
52
+ expected_code: result[:expected_code],
53
53
  reason: prepare_reason(result[:reason])
54
54
  end
55
55
 
@@ -77,7 +77,7 @@ module Gobstones
77
77
  def visible_board(result, board_types)
78
78
  board = result[board_types]
79
79
 
80
- if board == 'boom'
80
+ if board.like? :boom
81
81
  HtmlBoard.new(result[:initial], boom: true)
82
82
  else
83
83
  HtmlBoard.new(board)
@@ -0,0 +1,109 @@
1
+ <dom-module id="gs-attire">
2
+ <script>
3
+ Polymer({
4
+ is: 'gs-attire',
5
+ properties: {
6
+ attireUrl: Object,
7
+ observer: '_attireChanged'
8
+ },
9
+
10
+ attached: function () {
11
+ this._setAttire();
12
+ },
13
+ _attireChanged: function () {
14
+ this._setAttire();
15
+ },
16
+ _setAttire: function () {
17
+ $.getJSON(this.attireUrl, function (attire) {
18
+ GobstonesBoard && GobstonesBoard.setDefaultAttire(attire);
19
+ });
20
+ }
21
+ });
22
+ </script>
23
+ </dom-module>
24
+
25
+ <dom-module id="gs-attire-toggle-button">
26
+ <style>
27
+ :host-context(.mu-kids-states) .button {
28
+ position: absolute;
29
+ cursor: pointer;
30
+ top: -2px;
31
+ right: 0;
32
+ -ms-transform-origin: right center;
33
+ -webkit-transform-origin: right center;
34
+ transform-origin: right center;
35
+ }
36
+
37
+ :host-context(.boards-container) .button {
38
+ cursor: pointer;
39
+ margin-top: -8px;
40
+ }
41
+ </style>
42
+
43
+ <template>
44
+ <template is="dom-if" if="{{shouldDisplay}}">
45
+ <div class="button" on-click="_onButtonClick">
46
+ <template is="dom-if" if="{{isEnabled}}">
47
+ <img src="./attires_enabled.svg">
48
+ </template>
49
+ <template is="dom-if" if="{{!isEnabled}}">
50
+ <img src="./attires_disabled.svg">
51
+ </template>
52
+ </div>
53
+ </template>
54
+ </template>
55
+
56
+ <script>
57
+ Polymer({
58
+ is: 'gs-attire-toggle-button',
59
+ properties: {
60
+ isEnabled: {
61
+ type: Boolean,
62
+ value: true
63
+ }
64
+ },
65
+
66
+ ready: function () {
67
+ this._updateVisibility();
68
+ document.addEventListener('board-attire-changed', this._updateVisibility.bind(this));
69
+ this._relocateButton();
70
+ },
71
+
72
+ _updateVisibility: function () {
73
+ this.boards = $(this).parents(".mu-kids-states, .boards-container").find("gs-board");
74
+ this.shouldDisplay = this.boards.toArray().some(board => board.attire);
75
+ },
76
+
77
+ _onButtonClick: function () {
78
+ this.isEnabled = !this.isEnabled;
79
+
80
+ this.boards.each((__, board) => {
81
+ if (board.attire) board.set("attire.enabled", this.isEnabled);
82
+ board.updateStyles();
83
+ });
84
+ },
85
+
86
+ _getEditor: function () {
87
+ return $("mu-gobstones-custom-editor")[0];
88
+ },
89
+
90
+ _relocateButton: function () {
91
+ const $container = $('.mu-kids-gbs-board-initial');
92
+ if(!$container.length || this._getEditor().interactiveMode) return;
93
+ const $header = $('.mu-initial-state-header');
94
+ const headerWidth = $header.width() || $container.width();
95
+ const $attireToggle = $container.find('.button.gs-attire-toggle-button');
96
+ if(!$attireToggle.length) return setTimeout(() => this._relocateButton());
97
+ const margin = 4; // Leave a margin between text and image
98
+ const maxSize = 65.75; // Original width
99
+ mumuki.resize(() => {
100
+ $attireToggle.css('transform', 'scale(1)');
101
+ let buttonSize = (($container.width() - headerWidth) / 2) - margin;
102
+ let scaleX = Math.min(buttonSize, maxSize) / $attireToggle.width();
103
+ $attireToggle.css('transform', `scale(${scaleX})`);
104
+ });
105
+ },
106
+ });
107
+ </script>
108
+ </dom-module>
109
+
@@ -8,9 +8,12 @@ module Gobstones
8
8
  reason: result[:finalBoardError]
9
9
  end
10
10
 
11
- def render_error_output(_output, error)
12
- report = error.parse_as_json
13
- renderer.send "render_error_#{report[:status]}", report[:result]
11
+ def build_error_output(builder, example, _, error)
12
+ error.details.deep_symbolize_keys!
13
+
14
+ builder.result = renderer.send "render_error_#{error.message}", error.details
15
+ builder.summary_type = error.message
16
+ builder.summary_message = I18n.t error.message, error.details
14
17
  end
15
18
 
16
19
  private
@@ -1,3 +1,3 @@
1
1
  module GobstonesVersionHook
2
- VERSION = '2.4.2'
2
+ VERSION = '2.8.0'
3
3
  end
metadata CHANGED
@@ -1,155 +1,175 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mumuki-gobstones-runner
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.8.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-09-10 00:00:00.000000000 Z
11
+ date: 2020-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: mumukit
14
+ name: gobstones-board
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '2.33'
19
+ version: '1.19'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '2.33'
26
+ version: '1.19'
27
27
  - !ruby/object:Gem::Dependency
28
- name: sinatra-cross_origin
28
+ name: gobstones-code-runner
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.4'
33
+ version: '0.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.4'
40
+ version: '0.6'
41
41
  - !ruby/object:Gem::Dependency
42
- name: gobstones-board
42
+ name: mumuki-gobstones-blockly
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.18'
47
+ version: 0.38.1
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.18'
54
+ version: 0.38.1
55
55
  - !ruby/object:Gem::Dependency
56
- name: gobstones-blockly
56
+ name: mumukit
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 0.24.0
61
+ version: '2.36'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 0.24.0
68
+ version: '2.36'
69
69
  - !ruby/object:Gem::Dependency
70
- name: gobstones-code-runner
70
+ name: nokogiri
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '0.6'
75
+ version: '1.10'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '0.6'
82
+ version: '1.10'
83
83
  - !ruby/object:Gem::Dependency
84
- name: bundler
84
+ name: sinatra-cross_origin
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '0.4'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '0.4'
97
+ - !ruby/object:Gem::Dependency
98
+ name: bundler
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
103
  version: '1.7'
104
+ - - "<"
105
+ - !ruby/object:Gem::Version
106
+ version: '3'
90
107
  type: :development
91
108
  prerelease: false
92
109
  version_requirements: !ruby/object:Gem::Requirement
93
110
  requirements:
94
- - - "~>"
111
+ - - ">="
95
112
  - !ruby/object:Gem::Version
96
113
  version: '1.7'
114
+ - - "<"
115
+ - !ruby/object:Gem::Version
116
+ version: '3'
97
117
  - !ruby/object:Gem::Dependency
98
- name: rake
118
+ name: codeclimate-test-reporter
99
119
  requirement: !ruby/object:Gem::Requirement
100
120
  requirements:
101
- - - "~>"
121
+ - - ">="
102
122
  - !ruby/object:Gem::Version
103
- version: '10.0'
123
+ version: '0'
104
124
  type: :development
105
125
  prerelease: false
106
126
  version_requirements: !ruby/object:Gem::Requirement
107
127
  requirements:
108
- - - "~>"
128
+ - - ">="
109
129
  - !ruby/object:Gem::Version
110
- version: '10.0'
130
+ version: '0'
111
131
  - !ruby/object:Gem::Dependency
112
- name: rspec
132
+ name: mumukit-bridge
113
133
  requirement: !ruby/object:Gem::Requirement
114
134
  requirements:
115
135
  - - "~>"
116
136
  - !ruby/object:Gem::Version
117
- version: '3.4'
137
+ version: '4.1'
118
138
  type: :development
119
139
  prerelease: false
120
140
  version_requirements: !ruby/object:Gem::Requirement
121
141
  requirements:
122
142
  - - "~>"
123
143
  - !ruby/object:Gem::Version
124
- version: '3.4'
144
+ version: '4.1'
125
145
  - !ruby/object:Gem::Dependency
126
- name: codeclimate-test-reporter
146
+ name: rake
127
147
  requirement: !ruby/object:Gem::Requirement
128
148
  requirements:
129
- - - ">="
149
+ - - "~>"
130
150
  - !ruby/object:Gem::Version
131
- version: '0'
151
+ version: '10.0'
132
152
  type: :development
133
153
  prerelease: false
134
154
  version_requirements: !ruby/object:Gem::Requirement
135
155
  requirements:
136
- - - ">="
156
+ - - "~>"
137
157
  - !ruby/object:Gem::Version
138
- version: '0'
158
+ version: '10.0'
139
159
  - !ruby/object:Gem::Dependency
140
- name: mumukit-bridge
160
+ name: rspec
141
161
  requirement: !ruby/object:Gem::Requirement
142
162
  requirements:
143
163
  - - "~>"
144
164
  - !ruby/object:Gem::Version
145
- version: '3.0'
165
+ version: '3.4'
146
166
  type: :development
147
167
  prerelease: false
148
168
  version_requirements: !ruby/object:Gem::Requirement
149
169
  requirements:
150
170
  - - "~>"
151
171
  - !ruby/object:Gem::Version
152
- version: '3.0'
172
+ version: '3.4'
153
173
  description:
154
174
  email:
155
175
  - rodri042@gmail.com
@@ -161,9 +181,15 @@ files:
161
181
  - lib/checker.rb
162
182
  - lib/expectations_hook.rb
163
183
  - lib/extensions/string.rb
184
+ - lib/game_framework/default.gbs.erb
185
+ - lib/game_framework/default.xml.erb
186
+ - lib/game_framework/extra.gbs.erb
187
+ - lib/game_framework/program.gbs.erb
188
+ - lib/game_framework/program.xml.erb
164
189
  - lib/gobstones.rb
165
190
  - lib/gobstones/batch.rb
166
191
  - lib/gobstones/batch_parser.rb
192
+ - lib/gobstones/compilation_mode.rb
167
193
  - lib/gobstones/error_builder.rb
168
194
  - lib/gobstones/example_code_builder.rb
169
195
  - lib/gobstones_runner.rb
@@ -178,15 +204,53 @@ files:
178
204
  - lib/public/black.svg
179
205
  - lib/public/blue.svg
180
206
  - lib/public/boom.png
207
+ - lib/public/full-kindergarten-toolbox.xml
181
208
  - lib/public/green.svg
209
+ - lib/public/local-media/bool-false.svg
210
+ - lib/public/local-media/bool-true.svg
211
+ - lib/public/local-media/clean.png
212
+ - lib/public/local-media/color-azul.svg
213
+ - lib/public/local-media/color-negro.svg
214
+ - lib/public/local-media/color-rojo.svg
215
+ - lib/public/local-media/color-verde.svg
216
+ - lib/public/local-media/direccion-este.svg
217
+ - lib/public/local-media/direccion-norte.svg
218
+ - lib/public/local-media/direccion-oeste.svg
219
+ - lib/public/local-media/direccion-sur.svg
220
+ - lib/public/local-media/hand.png
221
+ - lib/public/local-media/main-procedure.png
222
+ - lib/public/local-media/minus.png
223
+ - lib/public/local-media/plus.png
224
+ - lib/public/local-media/program.png
225
+ - lib/public/local-media/repeticion-simple.png
226
+ - lib/public/media/1x1.gif
227
+ - lib/public/media/ShiftDown.png
228
+ - lib/public/media/ShiftLeft.png
229
+ - lib/public/media/ShiftRight.png
230
+ - lib/public/media/ShiftUp.png
231
+ - lib/public/media/click.mp3
232
+ - lib/public/media/click.ogg
233
+ - lib/public/media/click.wav
234
+ - lib/public/media/delete.mp3
235
+ - lib/public/media/delete.ogg
236
+ - lib/public/media/delete.wav
237
+ - lib/public/media/disconnect.mp3
238
+ - lib/public/media/disconnect.ogg
239
+ - lib/public/media/disconnect.wav
240
+ - lib/public/media/quote0.png
241
+ - lib/public/media/quote1.png
242
+ - lib/public/media/sprites.png
243
+ - lib/public/media/sprites.svg
244
+ - lib/public/minimal-kindergarten-toolbox.xml
182
245
  - lib/public/red.svg
183
246
  - lib/render/boards.html.erb
184
247
  - lib/render/editor/editor.css
185
- - lib/render/editor/editor.html
248
+ - lib/render/editor/editor.html.erb
186
249
  - lib/render/editor/editor.js
187
250
  - lib/render/editor/hammer.min.js
188
251
  - lib/render/html_board.rb
189
252
  - lib/render/html_renderer.rb
253
+ - lib/render/layout/layout.html
190
254
  - lib/render/with_renderer.rb
191
255
  - lib/test_hook.rb
192
256
  - lib/version_hook.rb
@@ -209,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
273
  - !ruby/object:Gem::Version
210
274
  version: '0'
211
275
  requirements: []
212
- rubygems_version: 3.0.6
276
+ rubygems_version: 3.0.8
213
277
  signing_key:
214
278
  specification_version: 4
215
279
  summary: Gobstones Runner for Mumuki