smalruby-editor 0.2.4-x86-mingw32 → 0.2.5-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 (54) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +8 -0
  3. data/Guardfile +8 -1
  4. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +11 -152
  5. data/app/assets/javascripts/msg/en_us.js +5 -5
  6. data/app/assets/javascripts/msg/ja.js +5 -5
  7. data/app/assets/javascripts/views/signin_modal_view.js.coffee.erb +0 -0
  8. data/app/controllers/sessions_controller.rb +0 -0
  9. data/app/helpers/sessions_helper.rb +4 -0
  10. data/app/models/concerns/ruby_to_block/block/hardware_operation.rb +11 -0
  11. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_s1_led_turn_on_or_off.rb → hardware_smalrubot_action.rb} +8 -5
  12. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_action_with_sec.rb +25 -0
  13. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_v3_motor_speed.rb → hardware_smalrubot_dc_motor_power_ratio.rb} +8 -5
  14. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_dc_motor_set_power_ratio.rb +23 -0
  15. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_v3_led_turn_on_or_off.rb → hardware_smalrubot_led_turn_on_or_off.rb} +8 -5
  16. data/app/models/concerns/ruby_to_block/block/{hardware_smalrubot_s1_ir_photoreflector_value.rb → hardware_smalrubot_sensor_value.rb} +8 -6
  17. data/app/views/editor/_toolbox_default.html.haml +4 -7
  18. data/app/views/editor/index.html.haml +7 -18
  19. data/bin/spring +0 -0
  20. data/config/application.rb +1 -0
  21. data/lib/smalruby_editor/version.rb +1 -1
  22. data/public/assets/{application-eece3e01e35f8f689e2e282a168f6059.js → application-e64da116c4adad30e499acda9d657fb5.js} +9 -9
  23. data/public/assets/application-e64da116c4adad30e499acda9d657fb5.js.gz +0 -0
  24. data/public/assets/{manifest-93f591b19a2a69655db7b53fa00d6b17.json → manifest-beef6aec1f5553cda5a2fe11ef0774ea.json} +1 -1
  25. data/public/assets/msg/{en_us-3eb2f104a6bad9c60226ff7475013874.js → en_us-a3f6b99f4b54cfaeed42452de11ab02e.js} +1 -1
  26. data/public/assets/msg/en_us-a3f6b99f4b54cfaeed42452de11ab02e.js.gz +0 -0
  27. data/public/assets/msg/ja-9323664964a9b8ede99ae16c43db5827.js +1 -0
  28. data/public/assets/msg/ja-9323664964a9b8ede99ae16c43db5827.js.gz +0 -0
  29. data/smalruby-editor.gemspec +1 -1
  30. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_s1_led_turn_on_or_off.feature +8 -8
  31. data/spec/acceptance/block_mode/blocks/hardware/{smalrubot_v3_motor_speed.feature → smalrubot_v3_dc_motor_power_ratio.feature} +12 -12
  32. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_led_turn_on_or_off.feature +8 -8
  33. data/spec/acceptance/block_mode/blocks/hardware/{smalrubot_s1_ir_photoreflector_value.feature → smalrubot_v3_sensor_value.feature} +7 -7
  34. data/spec/models/concerns/ruby_to_block/block/{hardware__smalrubot_s1_spec.rb → hardware__smalrubot_spec.rb} +88 -84
  35. data/spec/spec_helper.rb +0 -0
  36. data/spec/steps/base_steps.rb +0 -0
  37. data/spec/steps/text_editor_steps.rb +0 -0
  38. metadata +23 -36
  39. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action.rb +0 -13
  40. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_action_with_sec.rb +0 -14
  41. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_dc_motor_power_ratio.rb +0 -26
  42. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_s1_dc_motor_set_power_ratio.rb +0 -21
  43. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action.rb +0 -22
  44. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_action_with_sec.rb +0 -24
  45. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_light_sensor_value.rb +0 -28
  46. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_motor_set_speed.rb +0 -21
  47. data/app/models/concerns/ruby_to_block/block/hardware_smalrubot_v3_touch_sensor_pressed_or_released.rb +0 -29
  48. data/public/assets/application-eece3e01e35f8f689e2e282a168f6059.js.gz +0 -0
  49. data/public/assets/msg/en_us-3eb2f104a6bad9c60226ff7475013874.js.gz +0 -0
  50. data/public/assets/msg/ja-8450d011b1f093dc4b6b7c467e5bcae4.js +0 -1
  51. data/public/assets/msg/ja-8450d011b1f093dc4b6b7c467e5bcae4.js.gz +0 -0
  52. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_light_sensor_value.feature +0 -92
  53. data/spec/acceptance/block_mode/blocks/hardware/smalrubot_v3_touch_sensor_pressed_or_released.feature +0 -108
  54. data/spec/models/concerns/ruby_to_block/block/hardware__smalrubot_v3_spec.rb +0 -433
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99476a0dc900ee6de61a3faff9bad53dac243803
4
- data.tar.gz: 924ebec2766242f8d9b11179a30819c7121ebc80
3
+ metadata.gz: 82409640c53e76c3e90adcee5f84894ac51e895e
4
+ data.tar.gz: f17e839c44f18f704b76b15303811b907b63b94c
5
5
  SHA512:
6
- metadata.gz: 5ab1ebc879d01f408389c40e967da8d963f030297be40b8782b65322fd60f1622f915707b8b29c5cf5676c6ebf154fbadb994597fdcbbc29493d854c847466b3
7
- data.tar.gz: d3dce5a4d7a846508c890a3e0e131808bc7d04bfd8bceca06739ecd65aa799f09c07de5e0dd0427a4ca51b1437318540584979d7dc5f536fdd68ceb7f4e27bec
6
+ metadata.gz: 551126f0b286a827739d85227d9fe82b3f36cf36da0dc6c28efcd9f658d7128f7be41aa8d4192ef000d53154aaf066588ce280b849a46a27efacc237a2ba86eb
7
+ data.tar.gz: a0e16527bc49ec1c1a55245cc4b0c1aeb17948f3a86f2f03bfd642bb2e136cbedbaa42a3058996dd2ffc8424782f126b4476d357c031deee6f826bceee2abf5d
data/.rubocop.yml CHANGED
@@ -37,3 +37,11 @@ ClassLength:
37
37
  # LoadErrorなど、rescueブロックを空にすることはよくあるため。
38
38
  HandleExceptions:
39
39
  Enabled: false
40
+
41
+ # when use if/unless modifier, can't check coverage
42
+ IfUnlessModifier:
43
+ Enabled: false
44
+
45
+ # this is not important for me.
46
+ StringLiterals:
47
+ Enabled: false
data/Guardfile CHANGED
@@ -17,12 +17,19 @@ group :red_green_refactor, halt_on_fail: true do
17
17
  watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
18
18
  end
19
19
 
20
- guard :rspec, cmd: 'bundle exec bin/rspec' do
20
+ guard :rspec, cmd: 'bundle exec bin/spring rspec' do
21
21
  watch(%r{^spec/.+_spec\.rb$})
22
22
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
23
23
  watch('spec/spec_helper.rb') { "spec" }
24
24
 
25
25
  # Rails example
26
+ watch(%r{^app/models/concerns/ruby_to_block/block/hardware_(.*)\.rb$}) { |m|
27
+ if /smalrubot/.match(m[1])
28
+ "spec/models/concerns/ruby_to_block/block/hardware__smalrubot_spec.rb"
29
+ else
30
+ "spec/models/concerns/ruby_to_block/block/hardware_spec.rb"
31
+ end
32
+ }
26
33
  watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
27
34
  watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_spec.rb" }
28
35
  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"] }
@@ -453,158 +453,15 @@ Blockly.Ruby['<%= n %>'] = (block) ->
453
453
  pin = @getFieldValue('PIN')
454
454
  Blockly.Ruby.characterMethodCallInput_("sensor(#{Blockly.Ruby.quote_(pin)}).value")
455
455
 
456
- # SmalrubotV3 sub category
457
- <% subcategory = 'smalrubot_v3' %>
458
-
459
- # turn on/off Smalrubot v3 red/green LED
460
- <% n = "#{category}_#{subcategory}_led_turn_on_or_off" %>
461
- Blockly.Blocks['<%= n %>'] =
462
- init: ()->
463
- colourDropdown = [
464
- [<%= bm('colour.red') %>, 'red'],
465
- [<%= bm('colour.green') %>, 'green'],
466
- ]
467
- oooDropdown = [
468
- [<%= bm('common.turn_on') %>, 'turn_on'],
469
- [<%= bm('common.turn_off') %>, 'turn_off'],
470
- ]
471
-
472
- @setHelpUrl('')
473
- @setColour(<%= colors[:looks] %>)
474
- @interpolateMsg(<%= bm(".#{subcategory}_led_turn_on_or_off") %>,
475
- ['COLOUR', new Blockly.FieldDropdown(colourDropdown)],
476
- ['OOO', new Blockly.FieldDropdown(oooDropdown)],
477
- Blockly.ALIGN_RIGHT)
478
- @setInputsInline(true)
479
- @setPreviousStatement(true)
480
- @setNextStatement(true)
481
- @setTooltip('')
482
-
483
- Blockly.Ruby['<%= n %>'] = (block) ->
484
- colour = @getFieldValue('COLOUR')
485
- ooo = @getFieldValue('OOO')
486
- Blockly.Ruby.characterMethodCall_("<%= subcategory %>.#{colour}_led.#{ooo}")
487
-
488
- # Smalrubot v3 left/right motor speed
489
- <% n = "#{category}_#{subcategory}_motor_speed" %>
490
- Blockly.Blocks['<%= n %>'] =
491
- init: ()->
492
- @setHelpUrl('')
493
- @setColour(<%= colors[:sensing] %>)
494
- @interpolateMsg(<%= bm(".#{subcategory}_motor_speed") %>,
495
- ['LOR', new Blockly.FieldDropdown(lorDropdown)],
496
- Blockly.ALIGN_RIGHT)
497
- @setOutput(true, 'Number')
498
- @setTooltip('')
499
-
500
- Blockly.Ruby['<%= n %>'] = (block) ->
501
- lor = @getFieldValue('LOR')
502
- Blockly.Ruby.characterMethodCallInput_("<%= subcategory %>.#{lor}_motor.speed")
503
-
504
- # set Smalrubot v3 left/right motor speed
505
- <% n = "#{category}_#{subcategory}_motor_set_speed" %>
506
- Blockly.Blocks['<%= n %>'] =
507
- init: ()->
508
- @setHelpUrl('')
509
- @setColour(<%= colors[:motion] %>)
510
- @interpolateMsg(<%= bm(".#{subcategory}_motor_set_speed") %>,
511
- ['LOR', new Blockly.FieldDropdown(lorDropdown)],
512
- ['SPEED', ['Number'], Blockly.ALIGN_RIGHT],
513
- Blockly.ALIGN_RIGHT)
514
- @setInputsInline(true)
515
- @setPreviousStatement(true)
516
- @setNextStatement(true)
517
- @setTooltip('')
518
-
519
- Blockly.Ruby['<%= n %>'] = (block) ->
520
- lor = @getFieldValue('LOR')
521
- speed = Blockly.Ruby.valueToCode(@, 'SPEED', Blockly.Ruby.ORDER_NONE) || '100'
522
- Blockly.Ruby.characterSetVariable_("<%= subcategory %>.#{lor}_motor.speed",
523
- speed)
524
-
525
- # forward/backward/turn left/turn right/stop Smalrubot v3
526
- <% n = "#{category}_#{subcategory}_action" %>
527
- Blockly.Blocks['<%= n %>'] =
528
- init: ()->
529
- @setHelpUrl('')
530
- @setColour(<%= colors[:motion] %>)
531
- @interpolateMsg(<%= bm(".#{subcategory}_action") %>,
532
- ['ACTION', new Blockly.FieldDropdown(actionDropdown)],
533
- Blockly.ALIGN_RIGHT)
534
- @setInputsInline(true)
535
- @setPreviousStatement(true)
536
- @setNextStatement(true)
537
- @setTooltip('')
538
-
539
- Blockly.Ruby['<%= n %>'] = (block) ->
540
- action = @getFieldValue('ACTION')
541
- Blockly.Ruby.characterMethodCall_("<%= subcategory %>.#{action}")
542
-
543
- # forward/backward/turn left/turn right/stop Smalrubot v3 for ( ) secs
544
- <% n = "#{category}_#{subcategory}_action_with_sec" %>
545
- Blockly.Blocks['<%= n %>'] =
546
- init: ()->
547
- @setHelpUrl('')
548
- @setColour(<%= colors[:motion] %>)
549
- @interpolateMsg(<%= bm(".#{subcategory}_action_with_sec") %>,
550
- ['ACTION', new Blockly.FieldDropdown(actionDropdown)],
551
- ['SEC', ['Number'], Blockly.ALIGN_RIGHT],
552
- Blockly.ALIGN_RIGHT)
553
- @setInputsInline(true)
554
- @setPreviousStatement(true)
555
- @setNextStatement(true)
556
- @setTooltip('')
557
-
558
- Blockly.Ruby['<%= n %>'] = (block) ->
559
- action = @getFieldValue('ACTION')
560
- sec = Blockly.Ruby.valueToCode(@, 'SEC', Blockly.Ruby.ORDER_FUNCTION_CALL) || 'nil'
561
- Blockly.Ruby.characterMethodCall_("<%= subcategory %>.#{action}(sec: #{sec})")
562
-
563
- # Smalrubot v3 touch sensor pressed/released
564
- <% n = "#{category}_#{subcategory}_touch_sensor_pressed_or_released" %>
565
- Blockly.Blocks['<%= n %>'] =
566
- init: ()->
567
- porDropdown = window.SmalrubyEditor.Sensing.PressedOrReleasedDropdown
568
-
569
- @setHelpUrl('')
570
- @setColour(<%= colors[:sensing] %>)
571
- @interpolateMsg(<%= bm(".#{subcategory}_touch_sensor_pressed_or_released") %>,
572
- ['LOR', new Blockly.FieldDropdown(lorDropdown)],
573
- ['POR', new Blockly.FieldDropdown(porDropdown)],
574
- Blockly.ALIGN_RIGHT)
575
- @setOutput(true, 'Boolean')
576
- @setTooltip('')
577
-
578
- Blockly.Ruby['<%= n %>'] = (block) ->
579
- lor = @getFieldValue('LOR')
580
- por = @getFieldValue('POR')
581
- Blockly.Ruby.characterMethodCallInput_("<%= subcategory %>.#{lor}_touch_sensor.#{por}?")
582
-
583
- # Smalrubot v3 light sensor value
584
- <% n = "#{category}_#{subcategory}_light_sensor_value" %>
585
- Blockly.Blocks['<%= n %>'] =
586
- init: ()->
587
- @setHelpUrl('')
588
- @setColour(<%= colors[:sensing] %>)
589
- @appendDummyInput().appendField(<%= bm(".#{subcategory}_light_sensor_value") %>)
590
- @setOutput(true, 'Number')
591
- @setTooltip('')
592
-
593
- Blockly.Ruby['<%= n %>'] = (block) ->
594
- Blockly.Ruby.characterMethodCallInput_("<%= subcategory %>.light_sensor.value")
595
-
596
456
 
457
+ # SmalrubotV3 sub category
597
458
  # SmalrubotS1 sub category
598
- <% subcategory = 'smalrubot_s1' %>
459
+ <% %w(smalrubot_v3 smalrubot_s1).each do |subcategory| %>
599
460
 
600
461
  # turn on/off Smalrubot s1 blue/white LED
601
462
  <% n = "#{category}_#{subcategory}_led_turn_on_or_off" %>
602
463
  Blockly.Blocks['<%= n %>'] =
603
464
  init: ()->
604
- colourDropdown = [
605
- [<%= bm('colour.blue') %>, 'blue'],
606
- [<%= bm('colour.white') %>, 'white'],
607
- ]
608
465
  oooDropdown = [
609
466
  [<%= bm('common.turn_on') %>, 'turn_on'],
610
467
  [<%= bm('common.turn_off') %>, 'turn_off'],
@@ -613,7 +470,7 @@ Blockly.Blocks['<%= n %>'] =
613
470
  @setHelpUrl('')
614
471
  @setColour(<%= colors[:looks] %>)
615
472
  @interpolateMsg(<%= bm(".#{subcategory}_led_turn_on_or_off") %>,
616
- ['COLOUR', new Blockly.FieldDropdown(colourDropdown)],
473
+ ['LOR', new Blockly.FieldDropdown(lorDropdown)],
617
474
  ['OOO', new Blockly.FieldDropdown(oooDropdown)],
618
475
  Blockly.ALIGN_RIGHT)
619
476
  @setInputsInline(true)
@@ -622,9 +479,9 @@ Blockly.Blocks['<%= n %>'] =
622
479
  @setTooltip('')
623
480
 
624
481
  Blockly.Ruby['<%= n %>'] = (block) ->
625
- colour = @getFieldValue('COLOUR')
482
+ lor = @getFieldValue('LOR')
626
483
  ooo = @getFieldValue('OOO')
627
- Blockly.Ruby.characterMethodCall_("<%= subcategory %>.#{ooo}_#{colour}_led")
484
+ Blockly.Ruby.characterMethodCall_("<%= subcategory %>.#{ooo}_#{lor}_led")
628
485
 
629
486
  # forward/backward/turn left/turn right/stop Smalrubot s1
630
487
  <% n = "#{category}_#{subcategory}_action" %>
@@ -664,13 +521,13 @@ Blockly.Ruby['<%= n %>'] = (block) ->
664
521
  sec = Blockly.Ruby.valueToCode(@, 'SEC', Blockly.Ruby.ORDER_FUNCTION_CALL) || 'nil'
665
522
  Blockly.Ruby.characterMethodCall_("<%= subcategory %>.#{action}(sec: #{sec})")
666
523
 
667
- # Smalrubot s1 left/right ir photoreflector value
668
- <% n = "#{category}_#{subcategory}_ir_photoreflector_value" %>
524
+ # Smalrubot s1 left/right sensor value
525
+ <% n = "#{category}_#{subcategory}_sensor_value" %>
669
526
  Blockly.Blocks['<%= n %>'] =
670
527
  init: ()->
671
528
  @setHelpUrl('')
672
529
  @setColour(<%= colors[:sensing] %>)
673
- @interpolateMsg(<%= bm(".#{subcategory}_ir_photoreflector_value") %>,
530
+ @interpolateMsg(<%= bm(".#{subcategory}_sensor_value") %>,
674
531
  ['LOR', new Blockly.FieldDropdown(lorDropdown)],
675
532
  Blockly.ALIGN_RIGHT)
676
533
  @setOutput(true, 'Boolean')
@@ -678,7 +535,7 @@ Blockly.Blocks['<%= n %>'] =
678
535
 
679
536
  Blockly.Ruby['<%= n %>'] = (block) ->
680
537
  lor = @getFieldValue('LOR')
681
- Blockly.Ruby.characterMethodCallInput_("<%= subcategory %>.#{lor}_ir_photoreflector_value")
538
+ Blockly.Ruby.characterMethodCallInput_("<%= subcategory %>.#{lor}_sensor_value")
682
539
 
683
540
  # Smalrubot s1 left/right dc motor power ratio
684
541
  <% n = "#{category}_#{subcategory}_dc_motor_power_ratio" %>
@@ -716,3 +573,5 @@ Blockly.Ruby['<%= n %>'] = (block) ->
716
573
  speed = Blockly.Ruby.valueToCode(@, 'SPEED', Blockly.Ruby.ORDER_NONE) || '100'
717
574
  Blockly.Ruby.characterSetVariable_("<%= subcategory %>.#{lor}_dc_motor_power_ratio",
718
575
  speed)
576
+
577
+ <% end %>
@@ -252,17 +252,17 @@ Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_SET_SPEED = "set (motor driver %1's) mo
252
252
  Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_SPEED = "(motor driver %1's) motor speed (%)";
253
253
  Blockly.Msg.BLOCKS_HARDWARE_BUTTON_PRESSED_OR_RELEASED = 'button %1 %2 ?';
254
254
  Blockly.Msg.BLOCKS_HARDWARE_SENSOR_VALUE = 'sensor %1 value';
255
+
255
256
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_LED_TURN_ON_OR_OFF = '%2 Smalrubot v3 %1 LED';
256
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SPEED = 'Smalrubot v3 %1 motor speed';
257
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SET_SPEED = 'set Smalrubot v3 %1 motor speed to %2 %';
258
257
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION = '%1 Smalrubot v3';
259
258
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION_WITH_SEC = '%1 Smalrubot v3 for %2 secs';
260
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_TOUCH_SENSOR_PRESSED_OR_RELEASED = 'Smalrubot v3 %1 touch sensor %2 ?';
261
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_LIGHT_SENSOR_VALUE = 'Smalrubot v3 light sensor value';
259
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_SENSOR_VALUE = 'Smalrubot v3 %1 sensor';
260
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_DC_MOTOR_POWER_RATIO = 'Smalrubot v3 %1 dc motor power ratio';
261
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_DC_MOTOR_SET_POWER_RATIO = 'set Smalrubot v3 %1 dc motor power ratio to %2 %';
262
262
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_LED_TURN_ON_OR_OFF = '%2 Smalrubot s1 %1 LED';
263
263
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_ACTION = '%1 Smalrubot s1';
264
264
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_ACTION_WITH_SEC = '%1 Smalrubot s1 for %2 secs';
265
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_IR_PHOTOREFLECTOR_VALUE = 'Smalrubot s1 %1 IR Photoreflector';
265
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_SENSOR_VALUE = 'Smalrubot s1 %1 sensor';
266
266
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_DC_MOTOR_POWER_RATIO = 'Smalrubot s1 %1 dc motor power ratio';
267
267
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_DC_MOTOR_SET_POWER_RATIO = 'set Smalrubot s1 %1 dc motor power ratio to %2 %';
268
268
 
@@ -86,6 +86,7 @@ Blockly.Msg.VIEWS_SIGNIN_MODAL_VIEW_ERROR = 'ログインに失敗しました';
86
86
 
87
87
  // blocks/motion.js.coffee.erb
88
88
  Blockly.Msg.BLOCKS_MOTION_MOVE = '■%1歩動かす';
89
+ Blockly.Msg.BLOCKS_MOTION_MOVE2 = '■%1歩動かす2';
89
90
  Blockly.Msg.BLOCKS_MOTION_TURN_RIGHT_DEGREES = '■時計回りに%1度回す';
90
91
  Blockly.Msg.BLOCKS_MOTION_TURN_LEFT_DEGREES = '■反時計回りに%1度回す';
91
92
  Blockly.Msg.BLOCKS_MOTION_POINT_IN_DIRECTION = '■%1 度に向ける';
@@ -253,16 +254,15 @@ Blockly.Msg.BLOCKS_HARDWARE_MOTOR_DRIVER_SPEED = '◎(モータードライバ %
253
254
  Blockly.Msg.BLOCKS_HARDWARE_BUTTON_PRESSED_OR_RELEASED = '◎ボタン %1 が %2 ?';
254
255
  Blockly.Msg.BLOCKS_HARDWARE_SENSOR_VALUE = '◎センサー %1';
255
256
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_LED_TURN_ON_OR_OFF = '★スモウルボットV3の %1 LEDを %2';
256
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SPEED = '◎スモウルボットV3の %1 モーターの速度(%)';
257
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_MOTOR_SET_SPEED = '■スモウルボットV3の %1 モーターの速度を %2 (%) にする';
258
257
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION = '■スモウルボットV3を %1';
259
258
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_ACTION_WITH_SEC = '■スモウルボットV3を %2 秒 %1';
260
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_TOUCH_SENSOR_PRESSED_OR_RELEASED = '◎スモウルボットV3の %1 のタッチセンサーが %2 ?';
261
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_LIGHT_SENSOR_VALUE = '◎スモウルボットV3の光センサー';
259
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_SENSOR_VALUE = '◎スモウルボットV3の %1 のセンサー';
260
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_DC_MOTOR_POWER_RATIO = '◎スモウルボットV3の %1 DCモーターの速度(%)';
261
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_V3_DC_MOTOR_SET_POWER_RATIO = '■スモウルボットV3の %1 DCモーターの速度を %2 (%) にする';
262
262
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_LED_TURN_ON_OR_OFF = '★スモウルボットS1の %1 LEDを %2';
263
263
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_ACTION = '■スモウルボットS1を %1';
264
264
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_ACTION_WITH_SEC = '■スモウルボットS1を %2 秒 %1';
265
- Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_IR_PHOTOREFLECTOR_VALUE = '◎スモウルボットS1の %1 のセンサー';
265
+ Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_SENSOR_VALUE = '◎スモウルボットS1の %1 のセンサー';
266
266
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_DC_MOTOR_POWER_RATIO = '◎スモウルボットS1の %1 DCモーターの速度(%)';
267
267
  Blockly.Msg.BLOCKS_HARDWARE_SMALRUBOT_S1_DC_MOTOR_SET_POWER_RATIO = '■スモウルボットS1の %1 DCモーターの速度を %2 (%) にする';
268
268
 
File without changes
@@ -1,2 +1,6 @@
1
1
  module SessionsHelper
2
+ # whether signed in or not.
3
+ def signed_in?
4
+ session[:username]
5
+ end
2
6
  end
@@ -5,13 +5,24 @@ module RubyToBlock
5
5
  module HardwareOperation
6
6
  extend ActiveSupport::Concern
7
7
 
8
+ SMALRUBOT_RE = '(smalrubot_[^.]+)'
8
9
  DIO_PIN_RE = '\s*"(D(?:[2-9]|10|11|12|13))"\s*'
9
10
  PWM_PIN_RE = '\s*"(D(?:3|5|6|9|10|11))"\s*'
10
11
  AIO_PIN_RE = '\s*"(A[0-5])"\s*'
11
12
  TWO_WHEEL_DRIVE_CAR_PIN_RE = '\s*"(D[56])"\s*'
12
13
  LOR_RE = '(left|right)'
14
+ ON_OFF_RE = '(turn_on|turn_off)'
13
15
  POR_RE = '(pressed|released)'
14
16
  ACTION_RE = '(forward|backward|turn_left|turn_right|stop)'
17
+
18
+ included do
19
+ attr_accessor :smalrubot_name
20
+ end
21
+
22
+ def type
23
+ @type ||=
24
+ (smalrubot_name ? super.gsub('smalrubot', smalrubot_name) : super)
25
+ end
15
26
  end
16
27
  end
17
28
  end
@@ -1,19 +1,22 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module RubyToBlock
3
3
  module Block
4
- class HardwareSmalrubotS1LedTurnOnOrOff < CharacterMethodCall
4
+ class HardwareSmalrubotAction < CharacterMethodCall
5
5
  include HardwareOperation
6
6
 
7
7
  # rubocop:disable LineLength
8
- blocknize '^\s*' + CHAR_RE +
9
- 'smalrubot_s1\.(turn_on|turn_off)_(blue|white)_led' +
10
- '\s*$',
8
+ blocknize ['^\s*',
9
+ CHAR_RE,
10
+ SMALRUBOT_RE, '\.',
11
+ ACTION_RE,
12
+ '\s*$'].join(''),
11
13
  statement: true, inline: true
12
14
  # rubocop:enable LineLength
13
15
 
14
16
  def self.process_match_data(md, context)
15
17
  md2 = regexp.match(md[type])
16
- block = new(fields: { COLOUR: md2[3], OOO: md2[2] })
18
+ block = new(fields: { ACTION: md2[3] })
19
+ block.smalrubot_name = md2[2]
17
20
  add_character_method_call_block(context, md2[1], block)
18
21
  true
19
22
  end
@@ -0,0 +1,25 @@
1
+ # -*- coding: utf-8 -*-
2
+ module RubyToBlock
3
+ module Block
4
+ class HardwareSmalrubotActionWithSec < CharacterMethodCall
5
+ include HardwareOperation
6
+
7
+ # rubocop:disable LineLength
8
+ blocknize ['^\s*',
9
+ CHAR_RE,
10
+ SMALRUBOT_RE, '\.',
11
+ ACTION_RE, '\(\s*sec:\s*(\d+(?:\.\d+)?)\)',
12
+ '\s*$'].join(''),
13
+ statement: true, inline: true
14
+ # rubocop:enable LineLength
15
+
16
+ def self.process_match_data(md, context)
17
+ md2 = regexp.match(md[type])
18
+ block = new(fields: { ACTION: md2[3] })
19
+ block.smalrubot_name = md2[2]
20
+ add_character_method_call_block(context, md2[1], block, SEC: md2[4])
21
+ true
22
+ end
23
+ end
24
+ end
25
+ end
@@ -1,12 +1,14 @@
1
1
  module RubyToBlock
2
2
  module Block
3
- class HardwareSmalrubotV3MotorSpeed < Value
3
+ class HardwareSmalrubotDcMotorPowerRatio < Value
4
4
  include CharacterOperation
5
5
  include HardwareOperation
6
6
 
7
- blocknize '^\s*' + CHAR_RE +
8
- 'smalrubot_v3\.' +
9
- LOR_RE + '_motor_speed\s*$',
7
+ blocknize ['^\s*',
8
+ CHAR_RE,
9
+ SMALRUBOT_RE, '\.',
10
+ LOR_RE, '_dc_motor_power_ratio',
11
+ '\s*$'].join(''),
10
12
  value: true
11
13
 
12
14
  def self.process_match_data(md, context)
@@ -15,7 +17,8 @@ module RubyToBlock
15
17
  character = get_character(context, md2[1])
16
18
  return false if context.receiver && context.receiver != character
17
19
 
18
- block = new(fields: { LOR: md2[2] })
20
+ block = new(fields: { LOR: md2[3] })
21
+ block.smalrubot_name = md2[2]
19
22
  context.add_value(block)
20
23
  block.character = character
21
24
 
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ module RubyToBlock
3
+ module Block
4
+ class HardwareSmalrubotDcMotorSetPowerRatio < CharacterMethodCall
5
+ include HardwareOperation
6
+
7
+ blocknize ['^\s*',
8
+ CHAR_RE,
9
+ SMALRUBOT_RE, '\.',
10
+ LOR_RE, '_dc_motor_power_ratio\s*=\s*(\S+)',
11
+ '\s*$'].join(''),
12
+ statement: true, inline: true
13
+
14
+ def self.process_match_data(md, context)
15
+ md2 = regexp.match(md[type])
16
+ block = new(fields: { LOR: md2[3] })
17
+ block.smalrubot_name = md2[2]
18
+ add_character_method_call_block(context, md2[1], block, SPEED: md2[4])
19
+ true
20
+ end
21
+ end
22
+ end
23
+ end