smalruby-editor 0.1.23 → 0.1.24

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -1
  3. data/.rubocop.yml +4 -0
  4. data/.ruby-version +1 -1
  5. data/.travis.yml +1 -1
  6. data/Guardfile +45 -0
  7. data/app/assets/javascripts/application.js +0 -1
  8. data/app/assets/javascripts/msg/ja.js +1 -1
  9. data/app/assets/stylesheets/toolbox.css.scss.erb +1 -16
  10. data/app/controllers/source_codes_controller.rb +12 -7
  11. data/app/models/source_code.rb +34 -1
  12. data/app/views/editor/_toolbox.html.haml +155 -143
  13. data/app/views/editor/index.html.haml +4 -4
  14. data/app/views/layouts/application.html.erb +2 -2
  15. data/bin/bundle +1 -1
  16. data/bin/rails +5 -1
  17. data/bin/rake +5 -1
  18. data/bin/rspec +7 -0
  19. data/bin/spring +20 -0
  20. data/bin/teaspoon +7 -0
  21. data/lib/smalruby_editor/version.rb +3 -3
  22. data/public/assets/{application-92fb2e7b8dd198fbfae7f8451c891ba2.css → application-d5358d75a2c4e570c749b333c59b55ab.css} +1 -1
  23. data/public/assets/application-d5358d75a2c4e570c749b333c59b55ab.css.gz +0 -0
  24. data/public/assets/{application-e3cd434424f565fcebf7d7d13353536f.js → application-fda71a642d958ffbaf90185c471d6e51.js} +5 -5
  25. data/public/assets/application-fda71a642d958ffbaf90185c471d6e51.js.gz +0 -0
  26. data/public/assets/{manifest-6094ee90554fe1d9bb1a229d8daa16d7.json → manifest-1a9856df207640ec658271db34b30dbb.json} +1 -1
  27. data/public/assets/msg/{ja-8f29832e96564fb7a0c2280c4d4390b8.js → ja-4d22bd0341f464f9d1b9f373121bce6d.js} +1 -1
  28. data/public/assets/msg/ja-4d22bd0341f464f9d1b9f373121bce6d.js.gz +0 -0
  29. data/smalruby-editor.gemspec +0 -1
  30. data/spec/models/source_code_spec.rb +88 -1
  31. data/spec/spec_helper.rb +114 -137
  32. metadata +13 -23
  33. data/public/assets/application-92fb2e7b8dd198fbfae7f8451c891ba2.css.gz +0 -0
  34. data/public/assets/application-e3cd434424f565fcebf7d7d13353536f.js.gz +0 -0
  35. data/public/assets/msg/ja-8f29832e96564fb7a0c2280c4d4390b8.js.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b24256d1fe46a0a8c3ce28bd7ed20f60f77395a
4
- data.tar.gz: d6c8e1c8edce2ae53175e78abb804ad90077c563
3
+ metadata.gz: 4f7cc4d9a3e93cfb74cbb139e4e46429f3aa6011
4
+ data.tar.gz: f8837100d385ab0114a1596481b6500dd7852a30
5
5
  SHA512:
6
- metadata.gz: fd51308b9b000c171ae9efbf11f1e40ab28eda5875524650ccbf36ff0e615127c27987b87cd80cdff7fa5bb2d2cd01bec87a74cc39ef3b8eeed714ee431d414e
7
- data.tar.gz: d837a3ede7efa6ff6f87087326746bb18510e359da15786b0a4d70d50aac34009ba7a561365e99582112fc224898351296913fa4ddf9a559e015d7ff3a5bc568
6
+ metadata.gz: b352897a1eea4be81af8b3d72ff7e3d2697c02b2e619656a4ead5ab7943964672f5d0d753f401b88dd5fd5adfbafd0a3d82bc22ea4740bbc6dbd50a177d2451c
7
+ data.tar.gz: 806c1574f73523fecb2a83fba6288918084ac85ffa7688810a7c4f9d084f73620698f9380af6924e26507a7267bc60f01b0615e464fcf74931601b21e4f8b3e4
data/.rspec CHANGED
@@ -1,4 +1,3 @@
1
1
  --color
2
2
  --format documentation
3
- --drb
4
3
  -r turnip/rspec
data/.rubocop.yml CHANGED
@@ -30,3 +30,7 @@ MethodLength:
30
30
  # デフォルトの100は短すぎる。なんとなく250行とした。
31
31
  ClassLength:
32
32
  Max: 250
33
+
34
+ # LoadErrorなど、rescueブロックを空にすることはよくあるため。
35
+ HandleExceptions:
36
+ Enabled: false
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.1.4
1
+ 2.1.5
data/.travis.yml CHANGED
@@ -3,7 +3,7 @@ language: ruby
3
3
  cache: bundler
4
4
 
5
5
  rvm:
6
- - 2.1.4
6
+ - 2.1.5
7
7
 
8
8
  env:
9
9
  AUDIODEV=null
data/Guardfile ADDED
@@ -0,0 +1,45 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ ## Uncomment and set this to only include directories you want to watch
5
+ # directories %(app lib config test spec feature)
6
+
7
+ ## Uncomment to clear the screen before every task
8
+ # clearing :on
9
+
10
+ group :red_green_refactor, halt_on_fail: true do
11
+ guard :rubocop, all_on_start: false do
12
+ watch(%r{.+\.rb$})
13
+ watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
14
+ end
15
+
16
+ guard :rspec, cmd: 'bundle exec bin/rspec' do
17
+ watch(%r{^spec/.+_spec\.rb$})
18
+ watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
19
+ watch('spec/spec_helper.rb') { "spec" }
20
+
21
+ # Rails example
22
+ watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
23
+ watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
24
+ watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
25
+ watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
26
+ watch('config/routes.rb') { "spec/routing" }
27
+ watch('app/controllers/application_controller.rb') { "spec/controllers" }
28
+
29
+ # Capybara features specs
30
+ watch(%r{^app/views/(.+)/.*\.(erb|haml|slim)$}) { |m| "spec/features/#{m[1]}_spec.rb" }
31
+
32
+ # Turnip features and steps
33
+ watch(%r{^spec/acceptance/(.+)\.feature$})
34
+ watch(%r{^spec/acceptance/steps/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'spec/acceptance' }
35
+ end
36
+ end
37
+
38
+ guard 'livereload' do
39
+ watch(%r{app/views/.+\.(erb|haml|slim)$})
40
+ watch(%r{app/helpers/.+\.rb})
41
+ watch(%r{public/.+\.(css|js|html)})
42
+ watch(%r{config/locales/.+\.yml})
43
+ # Rails Assets Pipeline
44
+ watch(%r{(app|vendor)(/assets/\w+/(.+\.(css|js|html|png|jpg))).*}) { |m| "/assets/#{m[3]}" }
45
+ end
@@ -15,7 +15,6 @@
15
15
  //= require jquery.ui.draggable
16
16
  //= require jquery.ui.droppable
17
17
  //= require jquery.blockUI
18
- //= require turbolinks
19
18
  //= require ace/ace
20
19
  //= require ace/theme-clouds.js
21
20
  //= require ace/mode-ruby.js
@@ -80,7 +80,7 @@ Blockly.Msg.BLOCKS_SENSING_DOWN = Blockly.Msg.BLOCKS_SENSING_PUSH;
80
80
  Blockly.Msg.BLOCKS_SENSING_M_LBUTTON = '左ボタン';
81
81
  Blockly.Msg.BLOCKS_SENSING_M_MBUTTON = '中ボタン';
82
82
  Blockly.Msg.BLOCKS_SENSING_M_RBUTTON = '右ボタン';
83
- Blockly.Msg.BLOCKS_SENSING_UP = '押された';
83
+ Blockly.Msg.BLOCKS_SENSING_UP = '離された';
84
84
  Blockly.Msg.BLOCKS_SENSING_REACH_WALL = '端に触れた';
85
85
  Blockly.Msg.BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_PREFIX = 'キーボードの';
86
86
  Blockly.Msg.BLOCKS_SENSING_INPUT_KEY_PUSH_OR_DOWN_MIDDLE = 'が';
@@ -27,29 +27,15 @@
27
27
  colors = SmalrubyEditor::COLORS
28
28
 
29
29
  hues = [
30
- colors[:motion],
31
- colors[:motion],
32
- colors[:motion],
33
30
  colors[:motion],
34
31
  colors[:looks],
35
32
  colors[:sound],
36
33
  colors[:pen],
37
34
  colors[:data],
38
- colors[:data],
39
35
  colors[:events],
40
36
  colors[:control],
41
- colors[:control],
42
- colors[:control],
43
- colors[:control],
44
37
  colors[:sensing],
45
- colors[:sensing],
46
- colors[:sensing],
47
- colors[:operators],
48
- colors[:operators],
49
38
  colors[:operators],
50
- colors[:operators],
51
- colors[:etc],
52
- colors[:etc],
53
39
  colors[:etc],
54
40
  ]
55
41
 
@@ -57,11 +43,10 @@
57
43
  [hsv_to_rgb(h, 100, 80), hsv_to_rgb(h, 100, 100)]
58
44
  }
59
45
 
60
- ids = (0..9).to_a + ('a'..'z').to_a
61
46
  colors.each.with_index(1) do |(color, active_color), index|
62
47
  %>
63
48
 
64
- #\:<%= ids[index] %> {
49
+ div[aria-level="1"][aria-posinset="<%= index %>"] {
65
50
  .blocklyTreeRow {
66
51
  margin-bottom: 1px;
67
52
  padding-top: 1px;
@@ -9,16 +9,21 @@ class SourceCodesController < ApplicationController
9
9
  localPrograms: [],
10
10
  demoPrograms: [],
11
11
  }
12
+
13
+ select_and_get_summary = proc { |path|
14
+ s = SourceCode.new(filename: path.basename.to_s, data: path.read)
15
+ next if raspberrypi? && s.include_block?(/^(hardware_|pen_)/)
16
+ s.summary
17
+ }
18
+
12
19
  if standalone?
13
- res[:localPrograms] = local_program_paths.map { |path|
14
- SourceCode.new(filename: path.basename.to_s, data: path.read).summary
15
- }
20
+ res[:localPrograms] =
21
+ local_program_paths.map(&select_and_get_summary).compact
16
22
  end
17
23
 
18
- res[:demoPrograms] = Pathname.glob(Rails.root.join('demos/*.rb.xml')).map {
19
- |path|
20
- SourceCode.new(filename: path.basename.to_s, data: path.read).summary
21
- }
24
+ demo_program_paths = Pathname.glob(Rails.root.join('demos/*.rb.xml'))
25
+ res[:demoPrograms] =
26
+ demo_program_paths.map(&select_and_get_summary).compact
22
27
 
23
28
  render json: res
24
29
  end
@@ -67,7 +67,7 @@ class SourceCode < ActiveRecord::Base
67
67
  # ソースコードの概要を取得する
68
68
  def summary
69
69
  res = {}
70
- if /\.xml\z/ =~ filename
70
+ if xml?
71
71
  res[:filename] = filename.sub(/\.xml\z/, '')
72
72
 
73
73
  doc = Nokogiri::HTML.parse(data)
@@ -84,8 +84,41 @@ class SourceCode < ActiveRecord::Base
84
84
  res
85
85
  end
86
86
 
87
+ # 指定した命令ブロックを含んでいるかどうかを返す
88
+ #
89
+ # @param [String|Regexp] type 命令ブロックの種類
90
+ # @return [Boolean] 命令ブロックを含む場合はtrue、そうでない場合はfalse
91
+ def include_block?(type)
92
+ if xml?
93
+ doc = Nokogiri::HTML.parse(data)
94
+ if type.is_a?(Regexp)
95
+ doc.xpath(%(//block[matches(@type, '#{type.source}')]),
96
+ MatchesXPathFunction.new).length > 0
97
+ else
98
+ doc.xpath(%(//block[@type="#{type}"])).length > 0
99
+ end
100
+ else
101
+ false
102
+ end
103
+ end
104
+
105
+ # ソースコードの種別がXML形式かどうかを返す
106
+ def xml?
107
+ !!(/\.xml\z/ =~ filename)
108
+ end
109
+
87
110
  private
88
111
 
112
+ class MatchesXPathFunction
113
+ def matches(node_set, regex)
114
+ node_set.select { |node|
115
+ node.value =~ /#{regex}/
116
+ }
117
+ end
118
+ end
119
+
120
+ private_constant :MatchesXPathFunction
121
+
89
122
  def validate_filename
90
123
  if File.basename(filename) != filename
91
124
  errors.add(:filename, 'includes directory separator(s)')
@@ -40,10 +40,12 @@
40
40
  = toolbox_number_value('Y', 0)
41
41
 
42
42
  -# 変数:x座標
43
- %block{:type => "#{category}_self_x"}
43
+ - if !raspberrypi?
44
+ %block{:type => "#{category}_self_x"}
44
45
 
45
46
  -# 変数:y座標
46
- %block{:type => "#{category}_self_y"}
47
+ - if !raspberrypi?
48
+ %block{:type => "#{category}_self_y"}
47
49
 
48
50
  %category{:name => t('.motion_rotate')}
49
51
  -# もし端に着いたら、跳ね返る
@@ -77,64 +79,66 @@
77
79
  %block{:type => "#{category}_set_rotation_style"}
78
80
 
79
81
  -# 変数:向き
80
- %block{:type => "#{category}_self_angle"}
81
-
82
- - category = 'hardware'
83
- %category{:name => t('.motion_actuator')}
84
- - subcategory = 'servo'
85
- -# サーボ[▼PIN]を( )度(5~180)にする
86
- %block{:type => "#{category}_#{subcategory}_set_position"}
87
- = toolbox_number_value('POS', 90)
88
-
89
- - subcategory = 'two_wheel_drive_car'
90
- -# 2WD車[▼PIN]を( )秒[▼コマンド]
91
- %block{:type => "#{category}_#{subcategory}_run"}
92
- = toolbox_pin_field('D5')
93
- = toolbox_number_value('SEC', 1)
94
- %value{:name => 'COMMAND'}
95
- %block{:type => "#{category}_#{subcategory}_commands"}
96
-
97
- -# [▼コマンド]
98
- %block{:type => "#{category}_#{subcategory}_commands"}
99
- %field{:name => 'COMMAND'}<
100
- forward
101
-
102
- -# 2WD車[▼PIN]を進める
103
- %block{:type => "#{category}_#{subcategory}_forward"}
104
- = toolbox_pin_field('D5')
105
-
106
- -# 2WD車[▼PIN]をバックさせる
107
- %block{:type => "#{category}_#{subcategory}_backward"}
108
- = toolbox_pin_field('D5')
109
-
110
- -# 2WD車[▼PIN]を左に曲げる
111
- %block{:type => "#{category}_#{subcategory}_turn_left"}
112
- = toolbox_pin_field('D5')
113
-
114
- -# 2WD車[▼PIN]を右に曲げる
115
- %block{:type => "#{category}_#{subcategory}_turn_right"}
116
- = toolbox_pin_field('D5')
117
-
118
- -# 2WD車[▼PIN]を止める
119
- %block{:type => "#{category}_#{subcategory}_stop"}
120
- = toolbox_pin_field('D5')
121
-
122
- -# 2WD車[▼PIN]の[▼LOR]の速度を<SPEED>%にする
123
- %block{:type => "#{category}_#{subcategory}_set_speed"}
124
- = toolbox_pin_field('D5')
125
- = toolbox_number_value('SPEED', 100)
126
-
127
- - subcategory = 'motor_driver'
128
- -# (モータードライバ[▼PIN]で)モーターを[▼正転させる]
129
- %block{:type => "#{category}_#{subcategory}"}
130
- = toolbox_pin_field('D6')
131
- %field{:name => 'METHOD'}<
132
- forward
133
-
134
- -# (モータードライバ[▼PIN]の)モーターの速度を<SPEED>%にする
135
- %block{:type => "#{category}_#{subcategory}_set_speed"}
136
- = toolbox_pin_field('D6')
137
- = toolbox_number_value('SPEED', 100)
82
+ - if !raspberrypi?
83
+ %block{:type => "#{category}_self_angle"}
84
+
85
+ - if !raspberrypi?
86
+ - category = 'hardware'
87
+ %category{:name => t('.motion_actuator')}
88
+ - subcategory = 'servo'
89
+ -# サーボ[▼PIN]を( )度(5~180)にする
90
+ %block{:type => "#{category}_#{subcategory}_set_position"}
91
+ = toolbox_number_value('POS', 90)
92
+
93
+ - subcategory = 'two_wheel_drive_car'
94
+ -# 2WD車[▼PIN]を( )秒[▼コマンド]
95
+ %block{:type => "#{category}_#{subcategory}_run"}
96
+ = toolbox_pin_field('D5')
97
+ = toolbox_number_value('SEC', 1)
98
+ %value{:name => 'COMMAND'}
99
+ %block{:type => "#{category}_#{subcategory}_commands"}
100
+
101
+ -# [▼コマンド]
102
+ %block{:type => "#{category}_#{subcategory}_commands"}
103
+ %field{:name => 'COMMAND'}<
104
+ forward
105
+
106
+ -# 2WD車[▼PIN]を進める
107
+ %block{:type => "#{category}_#{subcategory}_forward"}
108
+ = toolbox_pin_field('D5')
109
+
110
+ -# 2WD車[▼PIN]をバックさせる
111
+ %block{:type => "#{category}_#{subcategory}_backward"}
112
+ = toolbox_pin_field('D5')
113
+
114
+ -# 2WD車[▼PIN]を左に曲げる
115
+ %block{:type => "#{category}_#{subcategory}_turn_left"}
116
+ = toolbox_pin_field('D5')
117
+
118
+ -# 2WD車[▼PIN]を右に曲げる
119
+ %block{:type => "#{category}_#{subcategory}_turn_right"}
120
+ = toolbox_pin_field('D5')
121
+
122
+ -# 2WD車[▼PIN]を止める
123
+ %block{:type => "#{category}_#{subcategory}_stop"}
124
+ = toolbox_pin_field('D5')
125
+
126
+ -# 2WD車[▼PIN]の[▼LOR]の速度を<SPEED>%にする
127
+ %block{:type => "#{category}_#{subcategory}_set_speed"}
128
+ = toolbox_pin_field('D5')
129
+ = toolbox_number_value('SPEED', 100)
130
+
131
+ - subcategory = 'motor_driver'
132
+ -# (モータードライバ[▼PIN]で)モーターを[▼正転させる]
133
+ %block{:type => "#{category}_#{subcategory}"}
134
+ = toolbox_pin_field('D6')
135
+ %field{:name => 'METHOD'}<
136
+ forward
137
+
138
+ -# (モータードライバ[▼PIN]の)モーターの速度を<SPEED>%にする
139
+ %block{:type => "#{category}_#{subcategory}_set_speed"}
140
+ = toolbox_pin_field('D6')
141
+ = toolbox_number_value('SPEED', 100)
138
142
 
139
143
  - category = 'looks'
140
144
  %category{:name => t('.looks')}
@@ -179,35 +183,36 @@
179
183
  -# [▼プリセット画像]
180
184
  -#%block{:type => "#{category}_preset_images"}
181
185
 
182
- - category = 'hardware'
183
- - subcategory = 'led'
184
- -# LED[▼PIN]をオンにする
185
- %block{:type => "#{category}_#{subcategory}_on"}
186
+ - if !raspberrypi?
187
+ - category = 'hardware'
188
+ - subcategory = 'led'
189
+ -# LED[▼PIN]をオンにする
190
+ %block{:type => "#{category}_#{subcategory}_on"}
186
191
 
187
- -# LED[▼PIN]をオフにする
188
- %block{:type => "#{category}_#{subcategory}_off"}
192
+ -# LED[▼PIN]をオフにする
193
+ %block{:type => "#{category}_#{subcategory}_off"}
189
194
 
190
- - subcategory = 'rgb_led'
191
- -# RGB LED[▼アノード]コモン[▼PIN]を[カラー]にする
192
- %block{:type => "#{category}_#{subcategory}_on"}
195
+ - subcategory = 'rgb_led'
196
+ -# RGB LED[▼アノード]コモン[▼PIN]を[カラー]にする
197
+ %block{:type => "#{category}_#{subcategory}_on"}
193
198
 
194
- -# RGB LED[▼アノード]コモン[▼PIN]をオフにする
195
- %block{:type => "#{category}_#{subcategory}_off"}
199
+ -# RGB LED[▼アノード]コモン[▼PIN]をオフにする
200
+ %block{:type => "#{category}_#{subcategory}_off"}
196
201
 
197
- - subcategory = 'seven_segment_display'
198
- -# 7セグディスプレイに[▼0-9]を表示する
199
- %block{:type => "#{category}_#{subcategory}_show"}
202
+ - subcategory = 'seven_segment_display'
203
+ -# 7セグディスプレイに[▼0-9]を表示する
204
+ %block{:type => "#{category}_#{subcategory}_show"}
200
205
 
201
- -# 7セグディスプレイをオフにする
202
- %block{:type => "#{category}_#{subcategory}_off"}
206
+ -# 7セグディスプレイをオフにする
207
+ %block{:type => "#{category}_#{subcategory}_off"}
203
208
 
204
- - subcategory = 'lcd'
205
- -# LCDに( )を表示する
206
- %block{:type => "#{category}_#{subcategory}_puts"}
207
- = toolbox_text_value('TEXT', 'Hello')
209
+ - subcategory = 'lcd'
210
+ -# LCDに( )を表示する
211
+ %block{:type => "#{category}_#{subcategory}_puts"}
212
+ = toolbox_text_value('TEXT', 'Hello')
208
213
 
209
- -# LCDをクリアする
210
- %block{:type => "#{category}_#{subcategory}_clear"}
214
+ -# LCDをクリアする
215
+ %block{:type => "#{category}_#{subcategory}_clear"}
211
216
 
212
217
  - category = 'sound'
213
218
  %category{:name => t('.sound')}
@@ -224,14 +229,15 @@
224
229
 
225
230
  - category = 'pen'
226
231
  %category{:name => t('.pen')}
227
- -# ペンを下ろす
228
- %block{:type => "#{category}_down_pen"}
232
+ - if !raspberrypi?
233
+ -# ペンを下ろす
234
+ %block{:type => "#{category}_down_pen"}
229
235
 
230
- -# ペンを上げる
231
- %block{:type => "#{category}_up_pen"}
236
+ -# ペンを上げる
237
+ %block{:type => "#{category}_up_pen"}
232
238
 
233
- -# ペンの色を[カラー]にする
234
- %block{:type => "#{category}_set_pen_color"}
239
+ -# ペンの色を[カラー]にする
240
+ %block{:type => "#{category}_set_pen_color"}
235
241
 
236
242
  %category{:name => t('.data')}
237
243
  %category{:name => t('.data_variables'), :custom => 'VARIABLE'}
@@ -251,12 +257,13 @@
251
257
  -# [▼キャラクター]にぶつかったとき
252
258
  %block{:type => "#{category}_on_hit"}
253
259
 
254
- - category = 'hardware'
255
- -# センサー[▼PIN]が変化したとき
256
- %block{:type => "#{category}_on_sensor_change"}
260
+ - if !raspberrypi?
261
+ - category = 'hardware'
262
+ -# センサー[▼PIN]が変化したとき
263
+ %block{:type => "#{category}_on_sensor_change"}
257
264
 
258
- -# ボタン[▼PIN]が[▼押された]とき
259
- %block{:type => "#{category}_on_button_down_or_up"}
265
+ -# ボタン[▼PIN]が[▼押された]とき
266
+ %block{:type => "#{category}_on_button_down_or_up"}
260
267
 
261
268
  - category = 'control'
262
269
  %category{:name => t('.control')}
@@ -274,11 +281,12 @@
274
281
  -# 繰り返しから脱出する
275
282
  %block{:type => "#{category}_break"}
276
283
 
277
- -# 次の繰り返しにジャンプする
278
- %block{:type => "#{category}_next"}
284
+ - if !raspberrypi?
285
+ -# 次の繰り返しにジャンプする
286
+ %block{:type => "#{category}_next"}
279
287
 
280
- -# 現在の繰り返しをやり直す
281
- %block{:type => "#{category}_redo"}
288
+ -# 現在の繰り返しをやり直す
289
+ %block{:type => "#{category}_redo"}
282
290
 
283
291
  %category{:name => t('.control_wait')}
284
292
  -# ( )秒待つ
@@ -336,29 +344,31 @@
336
344
  -# 変数:[▼キャラクター]の[▼プロパティ]
337
345
  %block{:type => "#{category}_character_property"}
338
346
 
339
- -# 変数:現在の[▼時]
340
- %block{:type => "#{category}_time_now"}
347
+ - if !raspberrypi?
348
+ -# 変数:現在の[▼時]
349
+ %block{:type => "#{category}_time_now"}
341
350
 
342
- -# 変数:2000年からの日数
343
- -#%block{:type => "#{category}_days_since_2000"}
351
+ -# 変数:2000年からの日数
352
+ %block{:type => "#{category}_days_since_2000"}
344
353
 
345
- - category = 'hardware'
346
- %category{:name => t('.sensing_hardware')}
347
- -# センサー[▼PIN]
348
- %block{:type => "#{category}_sensor_value"}
349
- = toolbox_pin_field('A0')
354
+ - if !raspberrypi?
355
+ - category = 'hardware'
356
+ %category{:name => t('.sensing_hardware')}
357
+ -# センサー[▼PIN]
358
+ %block{:type => "#{category}_sensor_value"}
359
+ = toolbox_pin_field('A0')
350
360
 
351
- -# 条件:ボタン[▼PIN]が[▼押された]
352
- %block{:type => "#{category}_button_down_or_up"}
353
- = toolbox_pin_field('D3')
361
+ -# 条件:ボタン[▼PIN]が[▼押された]
362
+ %block{:type => "#{category}_button_down_or_up"}
363
+ = toolbox_pin_field('D3')
354
364
 
355
- -# 2WD車[▼PIN]の[▼LOR]の速度%
356
- %block{:type => "#{category}_two_wheel_drive_car_speed"}
357
- = toolbox_pin_field('D5')
365
+ -# 2WD車[▼PIN]の[▼LOR]の速度%
366
+ %block{:type => "#{category}_two_wheel_drive_car_speed"}
367
+ = toolbox_pin_field('D5')
358
368
 
359
- -# (モータードライバ[▼PIN]の)モーターの速度(%)
360
- %block{:type => "#{category}_motor_driver_speed"}
361
- = toolbox_pin_field('D6')
369
+ -# (モータードライバ[▼PIN]の)モーターの速度(%)
370
+ %block{:type => "#{category}_motor_driver_speed"}
371
+ = toolbox_pin_field('D6')
362
372
 
363
373
  - category = 'operators'
364
374
  %category{:name => t('.operators')}
@@ -381,19 +391,20 @@
381
391
  = toolbox_number_value('B', 10)
382
392
 
383
393
  -# 変数:( )を( )で割った余り
384
- %block{:type => "#{category}_modulo"}
385
- = toolbox_number_value('A', 5)
386
- = toolbox_number_value('B', 2)
394
+ - if !raspberrypi?
395
+ %block{:type => "#{category}_modulo"}
396
+ = toolbox_number_value('A', 5)
397
+ = toolbox_number_value('B', 2)
387
398
 
388
- -# 変数:( )を丸める
389
- %block{:type => "#{category}_round"}
390
- = toolbox_number_value('A', 0.5)
399
+ -# 変数:( )を丸める
400
+ %block{:type => "#{category}_round"}
401
+ = toolbox_number_value('A', 0.5)
391
402
 
392
- -# 変数:( )の[▼数学関数]
393
- %block{:type => "#{category}_math_method"}
394
- = toolbox_number_value('NUM', 9)
395
- %field{:name => 'METHOD'}<
396
- Math.sqrt(%num%)
403
+ -# 変数:( )の[▼数学関数]
404
+ %block{:type => "#{category}_math_method"}
405
+ = toolbox_number_value('NUM', 9)
406
+ %field{:name => 'METHOD'}<
407
+ Math.sqrt(%num%)
397
408
 
398
409
  -# 数値
399
410
  %block{:type => 'math_number'}
@@ -447,25 +458,26 @@
447
458
  %block{:type => "#{category}_false"}
448
459
 
449
460
  %category{:name => t('.etc')}
450
- - category = 'ruby'
451
- %category{:name => t('.etc_ruby')}
452
- -#
453
- %block{:type => "#{category}_statement"}
461
+ - if !raspberrypi?
462
+ - category = 'ruby'
463
+ %category{:name => t('.etc_ruby')}
464
+ -#
465
+ %block{:type => "#{category}_statement"}
454
466
 
455
- -# 式
456
- %block{:type => "#{category}_expression"}
467
+ -# 式
468
+ %block{:type => "#{category}_expression"}
457
469
 
458
- -# コメント
459
- %block{:type => "#{category}_comment"}
470
+ -# コメント
471
+ %block{:type => "#{category}_comment"}
460
472
 
461
- -# p
462
- %block{:type => "#{category}_p"}
473
+ -# p
474
+ %block{:type => "#{category}_p"}
463
475
 
464
- - category = 'hardware'
465
- %category{:name => t('.etc_hardware')}
466
- -# ハードウェアを準備する
467
- %block{:type => "#{category}_init_hardware"}
476
+ - category = 'hardware'
477
+ %category{:name => t('.etc_hardware')}
478
+ -# ハードウェアを準備する
479
+ %block{:type => "#{category}_init_hardware"}
468
480
 
469
- -# ボタン[▼PIN]のプルアップ抵抗を使わない
470
- %block{:type => "#{category}_button_not_use_pullup"}
471
- = toolbox_pin_field('D3')
481
+ -# ボタン[▼PIN]のプルアップ抵抗を使わない
482
+ %block{:type => "#{category}_button_not_use_pullup"}
483
+ = toolbox_pin_field('D3')
@@ -41,16 +41,16 @@
41
41
  = t('.check')
42
42
  %button#reset-button.btn{class: "btn-primary"}<
43
43
  %i.icon-off
44
- = t('Reset')
44
+ = t('.reset')
45
45
  - if standalone?
46
46
  - if session[:username]
47
47
  %button#signout-button.btn{class: "btn-primary"}<
48
48
  %i.icon-eject
49
- = t('logout')
49
+ = t('.logout')
50
50
  - else
51
51
  %button#signout-button.btn{class: "btn-primary", style: "display: none"}<
52
52
  %i.icon-eject
53
- = t('logout')
53
+ = t('.logout')
54
54
 
55
55
  - else
56
56
  .btn-group
@@ -127,4 +127,4 @@
127
127
 
128
128
  - if raspberrypi?
129
129
  %script{type: "text/javascript"}
130
- $(function() { $('div[id=":7"]').hide(); });
130
+ $(function() { $('div[aria-level="1"][aria-posinset="4"],div[aria-level="1"][aria-posinset="10"]').hide(); });
@@ -10,8 +10,8 @@
10
10
  <meta name="msapplication-square150x150logo" content="square.png" />
11
11
  <meta name="msapplication-wide310x150logo" content="wide.png" />
12
12
  <meta name="msapplication-square310x310logo" content="large.png" />
13
- <%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
14
- <%= javascript_include_tag "application", "data-turbolinks-track" => true %>
13
+ <%= stylesheet_link_tag "application", media: "all" %>
14
+ <%= javascript_include_tag "application" %>
15
15
  <%= javascript_include_tag "blockly/msg/js/#{blockly_message_locale_name}" %>
16
16
  <%= javascript_include_tag "msg/#{blockly_message_locale_name}" %>
17
17
  <%= csrf_meta_tags %>