smalruby-editor 0.2.1-x86-mingw32 → 0.2.2-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of smalruby-editor might be problematic. Click here for more details.

Files changed (106) hide show
  1. checksums.yaml +4 -4
  2. data/LEGAL +4 -3
  3. data/app/assets/javascripts/blocks/character.js.coffee.erb +7 -3
  4. data/app/assets/javascripts/blocks/events.js.coffee.erb +7 -10
  5. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +119 -31
  6. data/app/assets/javascripts/blocks/motion.js.coffee.erb +16 -20
  7. data/app/assets/javascripts/blocks/operators.js.coffee.erb +1 -1
  8. data/app/assets/javascripts/blocks/pen.js.coffee.erb +2 -1
  9. data/app/assets/javascripts/blocks/ruby.js.coffee.erb +3 -3
  10. data/app/assets/javascripts/blocks/sensing.js.coffee.erb +8 -8
  11. data/app/assets/javascripts/blocks/sound.js.coffee.erb +3 -1
  12. data/app/assets/javascripts/fix_blockly.js.erb +105 -0
  13. data/app/assets/javascripts/generators/ruby.js.coffee.erb +3 -0
  14. data/app/assets/javascripts/msg/en_us.js +67 -17
  15. data/app/assets/javascripts/msg/ja.js +151 -95
  16. data/app/assets/javascripts/{smalruby.js.coffee → smalruby.js.coffee.erb} +35 -16
  17. data/app/assets/javascripts/views/character_selector_view.js.coffee +2 -2
  18. data/app/assets/javascripts/views/{load_modal_view.js.coffee → load_modal_view.js.coffee.erb} +8 -2
  19. data/app/assets/javascripts/views/main_menu_view.js.coffee.erb +33 -48
  20. data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +43 -0
  21. data/app/assets/stylesheets/application.css +3 -1
  22. data/app/assets/stylesheets/toolbox.css.scss.erb +2 -56
  23. data/app/assets/stylesheets/toolbox_default.css.scss.erb +34 -0
  24. data/app/assets/stylesheets/toolbox_smalrubot_s1.css.scss.erb +31 -0
  25. data/app/assets/stylesheets/toolbox_smalrubot_v3.css.scss.erb +32 -0
  26. data/app/controllers/application_controller.rb +5 -0
  27. data/app/controllers/source_codes_controller.rb +6 -3
  28. data/app/helpers/application_helper.rb +12 -0
  29. data/app/helpers/editor_helper.rb +25 -0
  30. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action.rb +13 -0
  31. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action_with_sec.rb +14 -0
  32. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_ir_photoreflector_value.rb +29 -0
  33. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_led_turn_on_or_off.rb +22 -0
  34. data/app/views/editor/_block_tab.html.haml +7 -6
  35. data/app/views/editor/_reset_modal.html.haml +4 -4
  36. data/app/views/editor/_signin_modal.html.haml +8 -9
  37. data/app/views/editor/_toolbox_default.html.haml +504 -0
  38. data/app/views/editor/_toolbox_smalrubot_s1.html.haml +171 -0
  39. data/app/views/editor/_toolbox_smalrubot_v3.html.haml +177 -0
  40. data/app/views/editor/index.html.haml +12 -2
  41. data/app/views/layouts/application.html.erb +1 -0
  42. data/config/environments/production.rb +1 -0
  43. data/config/locales/en.yml +19 -16
  44. data/config/locales/ja.yml +28 -25
  45. data/demos/hardware_led.rb.xml +79 -79
  46. data/lib/smalruby_editor/config.rb +22 -0
  47. data/lib/smalruby_editor/version.rb +1 -1
  48. data/lib/smalruby_editor.rb +58 -0
  49. data/public/assets/application-71c4890fe0ea2e896fc0acff41cdb0ad.js +39 -0
  50. data/public/assets/application-71c4890fe0ea2e896fc0acff41cdb0ad.js.gz +0 -0
  51. data/public/assets/{application-d5358d75a2c4e570c749b333c59b55ab.css → application-c196e243630d74071981a16041bf391d.css} +1 -1
  52. data/public/assets/application-c196e243630d74071981a16041bf391d.css.gz +0 -0
  53. data/public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js +1 -0
  54. data/public/assets/blockly/msg/js/en_us-d5e1938b2d57c1df954f4411b9165d10.js.gz +0 -0
  55. data/public/assets/blockly/msg/js/ja-9f676d46458a2802b8f5a797c90ae8a4.js +1 -0
  56. data/public/assets/blockly/msg/js/ja-9f676d46458a2802b8f5a797c90ae8a4.js.gz +0 -0
  57. data/public/assets/manifest-f3d29c6d66b959abe4294a899733e4f0.json +1 -0
  58. data/public/assets/msg/en_us-213fb4a57884078038725a2991776f47.js +1 -0
  59. data/public/assets/msg/en_us-213fb4a57884078038725a2991776f47.js.gz +0 -0
  60. data/public/assets/msg/ja-aeface7456b479021e977a0387204036.js +1 -0
  61. data/public/assets/msg/ja-aeface7456b479021e977a0387204036.js.gz +0 -0
  62. data/public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css +1 -0
  63. data/public/assets/toolbox_default-e023d3f7a2cc7cc1f54a1224577b3c26.css.gz +0 -0
  64. data/public/assets/toolbox_smalrubot_s1-18d28dc4b99723b60a3f538b742027df.css +1 -0
  65. data/public/assets/toolbox_smalrubot_s1-18d28dc4b99723b60a3f538b742027df.css.gz +0 -0
  66. data/public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css +1 -0
  67. data/public/assets/toolbox_smalrubot_v3-9af26ff13d4496890c4a391f65f95bcd.css.gz +0 -0
  68. data/public/blockly/media/anon.jpeg +0 -0
  69. data/public/blockly/media/handclosed.cur +0 -0
  70. data/public/blockly/media/handdelete.cur +0 -0
  71. data/public/blockly/media/progress.gif +0 -0
  72. data/public/blockly/media/sprites.png +0 -0
  73. data/smalruby-editor.gemspec +2 -1
  74. data/spec/acceptance/base.feature +3 -3
  75. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action.feature +107 -0
  76. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_action_with_sec.feature +151 -0
  77. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_ir_photoreflector_value.feature +100 -0
  78. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +73 -0
  79. data/spec/acceptance/ruby_mode/translate.feature +6 -6
  80. data/spec/acceptance/standalone/save.feature +3 -3
  81. data/spec/acceptance/standalone/signin.feature +1 -2
  82. data/spec/lib/smalruby_editor_spec.rb +21 -11
  83. data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_s1_spec.rb +279 -0
  84. data/vendor/assets/javascripts/blockly/blockly_compressed.js +995 -668
  85. data/vendor/assets/javascripts/blockly/blocks_compressed.js +138 -114
  86. data/vendor/assets/javascripts/blockly/msg/js/en_us.js +6 -6
  87. data/vendor/assets/javascripts/blockly/msg/js/ja.js +42 -28
  88. metadata +66 -25
  89. data/app/assets/javascripts/fix_blockly.js +0 -128
  90. data/app/assets/javascripts/views/signin_modal_view.js.coffee +0 -33
  91. data/app/views/editor/_toolbox.html.haml +0 -496
  92. data/public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js +0 -35
  93. data/public/assets/application-b305a6ea9e7c045a8e170bbf6fb09dd1.js.gz +0 -0
  94. data/public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css.gz +0 -0
  95. data/public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js +0 -1
  96. data/public/assets/blockly/msg/js/en_us-6f7333af29688596ef863fa36a22cb41.js.gz +0 -0
  97. data/public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js +0 -1
  98. data/public/assets/blockly/msg/js/ja-d2cbf808bda8180571bc5f39141a98fe.js.gz +0 -0
  99. data/public/assets/manifest-b1b843b1334b3b973824ab66b1f7a077.json +0 -1
  100. data/public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js +0 -1
  101. data/public/assets/msg/en_us-c6f8f0084f38560bf933b742ede64a52.js.gz +0 -0
  102. data/public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js +0 -1
  103. data/public/assets/msg/ja-3703e6ceebd04ae1f08b0e871800539d.js.gz +0 -0
  104. data/public/blockly/media/trashbody.png +0 -0
  105. data/public/blockly/media/trashlid.png +0 -0
  106. data/public/blockly/media/tree.png +0 -0
@@ -26,20 +26,30 @@ describe SmalrubyEditor do
26
26
  end
27
27
 
28
28
  describe 'configディレクトリ' do
29
- let(:path) { @home_dir.join('config', 'database.yml') }
29
+ describe 'config.yml' do
30
+ let(:path) { @home_dir.join('config', 'config.yml') }
30
31
 
31
- it 'database.ymlを作成する' do
32
- expect(path).to be_exist
32
+ it 'config.ymlを作成する' do
33
+ expect(path).to be_exist
34
+ end
33
35
  end
34
36
 
35
- it 'database.ymlの内容が正しい' do
36
- expect(path.read).to eq(<<-EOS.strip_heredoc)
37
- standalone:
38
- adapter: sqlite3
39
- database: #{@home_dir.join('db', 'standalone.sqlite3')}
40
- pool: 5
41
- timeout: 5000
42
- EOS
37
+ describe 'database.yml' do
38
+ let(:path) { @home_dir.join('config', 'database.yml') }
39
+
40
+ it 'database.ymlを作成する' do
41
+ expect(path).to be_exist
42
+ end
43
+
44
+ it 'database.ymlの内容が正しい' do
45
+ expect(path.read).to eq(<<-EOS.strip_heredoc)
46
+ standalone:
47
+ adapter: sqlite3
48
+ database: #{@home_dir.join('db', 'standalone.sqlite3')}
49
+ pool: 5
50
+ timeout: 5000
51
+ EOS
52
+ end
43
53
  end
44
54
  end
45
55
  end
@@ -0,0 +1,279 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'spec_helper'
3
+ require_relative 'shared/block_examples'
4
+
5
+ # rubocop:disable EmptyLines, LineLength
6
+
7
+ describe RubyToBlock::Block, 'Smalrubot S1 blocks', to_blocks: true do
8
+ parts = <<-EOS
9
+ require "smalruby"
10
+
11
+ init_hardware
12
+ car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
13
+
14
+ car1.on(:start) do
15
+ smalrubot_s1.forward
16
+ smalrubot_s1.backward
17
+ smalrubot_s1.turn_left
18
+ smalrubot_s1.turn_right
19
+ smalrubot_s1.stop
20
+
21
+ smalrubot_s1.forward(sec: 0.5)
22
+ smalrubot_s1.backward(sec: 0.4)
23
+ smalrubot_s1.turn_left(sec: 0.3)
24
+ smalrubot_s1.turn_right(sec: 0.2)
25
+ smalrubot_s1.stop(sec: 0.1)
26
+
27
+ p(smalrubot_s1.left_ir_photoreflector_value)
28
+ p(smalrubot_s1.right_ir_photoreflector_value)
29
+
30
+ smalrubot_s1.turn_on_white_led
31
+ smalrubot_s1.turn_off_blue_led
32
+ end
33
+ car1.smalrubot_s1.forward
34
+ car1.smalrubot_s1.backward
35
+ car1.smalrubot_s1.turn_left
36
+ car1.smalrubot_s1.turn_right
37
+ car1.smalrubot_s1.stop
38
+
39
+ car1.smalrubot_s1.forward(sec: 0.5)
40
+ car1.smalrubot_s1.backward(sec: 0.4)
41
+ car1.smalrubot_s1.turn_left(sec: 0.3)
42
+ car1.smalrubot_s1.turn_right(sec: 0.2)
43
+ car1.smalrubot_s1.stop(sec: 0.1)
44
+
45
+ p(car1.smalrubot_s1.left_ir_photoreflector_value)
46
+ p(car1.smalrubot_s1.right_ir_photoreflector_value)
47
+
48
+ car1.smalrubot_s1.turn_on_white_led
49
+ car1.smalrubot_s1.turn_off_blue_led
50
+ EOS
51
+ describe compact_source_code(parts) do
52
+ _parts = parts
53
+ let(:data) { _parts }
54
+
55
+ it '結果が正しいこと' do
56
+ should eq_block_xml(<<-XML)
57
+ <character name="car1" x="0" y="0" angle="0" costumes="car1.png" />
58
+ <block type="hardware_init_hardware" />
59
+ <block type="character_new">
60
+ <field name="NAME">car1</field>
61
+ <statement name="DO">
62
+ <block type="events_on_start">
63
+ <statement name="DO">
64
+ <block type="hardware_smalrubot_s1_action" inline="true">
65
+ <field name="ACTION">forward</field>
66
+ <next>
67
+ <block type="hardware_smalrubot_s1_action" inline="true">
68
+ <field name="ACTION">backward</field>
69
+ <next>
70
+ <block type="hardware_smalrubot_s1_action" inline="true">
71
+ <field name="ACTION">turn_left</field>
72
+ <next>
73
+ <block type="hardware_smalrubot_s1_action" inline="true">
74
+ <field name="ACTION">turn_right</field>
75
+ <next>
76
+ <block type="hardware_smalrubot_s1_action" inline="true">
77
+ <field name="ACTION">stop</field>
78
+ <next>
79
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
80
+ <field name="ACTION">forward</field>
81
+ <value name="SEC">
82
+ <block type="math_number">
83
+ <field name="NUM">0.5</field>
84
+ </block>
85
+ </value>
86
+ <next>
87
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
88
+ <field name="ACTION">backward</field>
89
+ <value name="SEC">
90
+ <block type="math_number">
91
+ <field name="NUM">0.4</field>
92
+ </block>
93
+ </value>
94
+ <next>
95
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
96
+ <field name="ACTION">turn_left</field>
97
+ <value name="SEC">
98
+ <block type="math_number">
99
+ <field name="NUM">0.3</field>
100
+ </block>
101
+ </value>
102
+ <next>
103
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
104
+ <field name="ACTION">turn_right</field>
105
+ <value name="SEC">
106
+ <block type="math_number">
107
+ <field name="NUM">0.2</field>
108
+ </block>
109
+ </value>
110
+ <next>
111
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
112
+ <field name="ACTION">stop</field>
113
+ <value name="SEC">
114
+ <block type="math_number">
115
+ <field name="NUM">0.1</field>
116
+ </block>
117
+ </value>
118
+ <next>
119
+ <block type="ruby_p" inline="true">
120
+ <value name="ARG">
121
+ <block type="hardware_smalrubot_s1_ir_photoreflector_value">
122
+ <field name="LOR">left</field>
123
+ </block>
124
+ </value>
125
+ <next>
126
+ <block type="ruby_p" inline="true">
127
+ <value name="ARG">
128
+ <block type="hardware_smalrubot_s1_ir_photoreflector_value">
129
+ <field name="LOR">right</field>
130
+ </block>
131
+ </value>
132
+ <next>
133
+ <block type="hardware_smalrubot_s1_led_turn_on_or_off" inline="true">
134
+ <field name="COLOUR">white</field>
135
+ <field name="OOO">turn_on</field>
136
+ <next>
137
+ <block type="hardware_smalrubot_s1_led_turn_on_or_off" inline="true">
138
+ <field name="COLOUR">blue</field>
139
+ <field name="OOO">turn_off</field>
140
+ </block>
141
+ </next>
142
+ </block>
143
+ </next>
144
+ </block>
145
+ </next>
146
+ </block>
147
+ </next>
148
+ </block>
149
+ </next>
150
+ </block>
151
+ </next>
152
+ </block>
153
+ </next>
154
+ </block>
155
+ </next>
156
+ </block>
157
+ </next>
158
+ </block>
159
+ </next>
160
+ </block>
161
+ </next>
162
+ </block>
163
+ </next>
164
+ </block>
165
+ </next>
166
+ </block>
167
+ </statement>
168
+ <next>
169
+ <block type="hardware_smalrubot_s1_action" inline="true">
170
+ <field name="ACTION">forward</field>
171
+ <next>
172
+ <block type="hardware_smalrubot_s1_action" inline="true">
173
+ <field name="ACTION">backward</field>
174
+ <next>
175
+ <block type="hardware_smalrubot_s1_action" inline="true">
176
+ <field name="ACTION">turn_left</field>
177
+ <next>
178
+ <block type="hardware_smalrubot_s1_action" inline="true">
179
+ <field name="ACTION">turn_right</field>
180
+ <next>
181
+ <block type="hardware_smalrubot_s1_action" inline="true">
182
+ <field name="ACTION">stop</field>
183
+ <next>
184
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
185
+ <field name="ACTION">forward</field>
186
+ <value name="SEC">
187
+ <block type="math_number">
188
+ <field name="NUM">0.5</field>
189
+ </block>
190
+ </value>
191
+ <next>
192
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
193
+ <field name="ACTION">backward</field>
194
+ <value name="SEC">
195
+ <block type="math_number">
196
+ <field name="NUM">0.4</field>
197
+ </block>
198
+ </value>
199
+ <next>
200
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
201
+ <field name="ACTION">turn_left</field>
202
+ <value name="SEC">
203
+ <block type="math_number">
204
+ <field name="NUM">0.3</field>
205
+ </block>
206
+ </value>
207
+ <next>
208
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
209
+ <field name="ACTION">turn_right</field>
210
+ <value name="SEC">
211
+ <block type="math_number">
212
+ <field name="NUM">0.2</field>
213
+ </block>
214
+ </value>
215
+ <next>
216
+ <block type="hardware_smalrubot_s1_action_with_sec" inline="true">
217
+ <field name="ACTION">stop</field>
218
+ <value name="SEC">
219
+ <block type="math_number">
220
+ <field name="NUM">0.1</field>
221
+ </block>
222
+ </value>
223
+ <next>
224
+ <block type="ruby_p" inline="true">
225
+ <value name="ARG">
226
+ <block type="hardware_smalrubot_s1_ir_photoreflector_value">
227
+ <field name="LOR">left</field>
228
+ </block>
229
+ </value>
230
+ <next>
231
+ <block type="ruby_p" inline="true">
232
+ <value name="ARG">
233
+ <block type="hardware_smalrubot_s1_ir_photoreflector_value">
234
+ <field name="LOR">right</field>
235
+ </block>
236
+ </value>
237
+ <next>
238
+ <block type="hardware_smalrubot_s1_led_turn_on_or_off" inline="true">
239
+ <field name="COLOUR">white</field>
240
+ <field name="OOO">turn_on</field>
241
+ <next>
242
+ <block type="hardware_smalrubot_s1_led_turn_on_or_off" inline="true">
243
+ <field name="COLOUR">blue</field>
244
+ <field name="OOO">turn_off</field>
245
+ </block>
246
+ </next>
247
+ </block>
248
+ </next>
249
+ </block>
250
+ </next>
251
+ </block>
252
+ </next>
253
+ </block>
254
+ </next>
255
+ </block>
256
+ </next>
257
+ </block>
258
+ </next>
259
+ </block>
260
+ </next>
261
+ </block>
262
+ </next>
263
+ </block>
264
+ </next>
265
+ </block>
266
+ </next>
267
+ </block>
268
+ </next>
269
+ </block>
270
+ </next>
271
+ </block>
272
+ </next>
273
+ </block>
274
+ </statement>
275
+ </block>
276
+ XML
277
+ end
278
+ end
279
+ end