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
@@ -1,79 +1,79 @@
1
- <xml xmlns="http://www.w3.org/1999/xhtml">
2
- <character x="261" y="191" name="frog1" costumes="frog1.png" angle="0"></character>
3
- <block type="ruby_comment" x="42" y="-39">
4
- <field name="COMMENT">ライトをぴかっとさせるでよ</field>
5
- </block>
6
- <block type="hardware_init_hardware" x="40" y="6"></block>
7
- <block type="character_new" x="45" y="50">
8
- <field name="NAME">frog1</field>
9
- <statement name="DO">
10
- <block type="events_on_click">
11
- <statement name="DO">
12
- <block type="looks_say" inline="true">
13
- <value name="TEXT">
14
- <block type="text">
15
- <field name="TEXT">ライトをぴかっとさせるでよ♪</field>
16
- </block>
17
- </value>
18
- <next>
19
- <block type="hardware_led_on">
20
- <field name="PIN">D2</field>
21
- <next>
22
- <block type="control_sleep" inline="true">
23
- <value name="SEC">
24
- <block type="math_number">
25
- <field name="NUM">1</field>
26
- </block>
27
- </value>
28
- <next>
29
- <block type="hardware_led_off">
30
- <field name="PIN">D2</field>
31
- <next>
32
- <block type="control_sleep" inline="true">
33
- <value name="SEC">
34
- <block type="math_number">
35
- <field name="NUM">1</field>
36
- </block>
37
- </value>
38
- <next>
39
- <block type="hardware_led_on">
40
- <field name="PIN">D13</field>
41
- <next>
42
- <block type="control_sleep" inline="true">
43
- <value name="SEC">
44
- <block type="math_number">
45
- <field name="NUM">1</field>
46
- </block>
47
- </value>
48
- <next>
49
- <block type="hardware_led_off">
50
- <field name="PIN">D13</field>
51
- <next>
52
- <block type="looks_say" inline="true">
53
- <value name="TEXT">
54
- <block type="text">
55
- <field name="TEXT"></field>
56
- </block>
57
- </value>
58
- </block>
59
- </next>
60
- </block>
61
- </next>
62
- </block>
63
- </next>
64
- </block>
65
- </next>
66
- </block>
67
- </next>
68
- </block>
69
- </next>
70
- </block>
71
- </next>
72
- </block>
73
- </next>
74
- </block>
75
- </statement>
76
- </block>
77
- </statement>
78
- </block>
79
- </xml>
1
+ <xml xmlns="http://www.w3.org/1999/xhtml">
2
+ <character x="261" y="191" name="frog1" costumes="frog1.png" angle="0"></character>
3
+ <block type="ruby_comment" x="42" y="-39">
4
+ <field name="COMMENT">ライトをぴかっとさせるでよ</field>
5
+ </block>
6
+ <block type="hardware_init_hardware" x="40" y="6"></block>
7
+ <block type="character_new" x="45" y="50">
8
+ <field name="NAME">frog1</field>
9
+ <statement name="DO">
10
+ <block type="events_on_click">
11
+ <statement name="DO">
12
+ <block type="looks_say" inline="true">
13
+ <value name="TEXT">
14
+ <block type="text">
15
+ <field name="TEXT">ライトをぴかっとさせるでよ♪</field>
16
+ </block>
17
+ </value>
18
+ <next>
19
+ <block type="hardware_led_turn_on">
20
+ <field name="PIN">D2</field>
21
+ <next>
22
+ <block type="control_sleep" inline="true">
23
+ <value name="SEC">
24
+ <block type="math_number">
25
+ <field name="NUM">1</field>
26
+ </block>
27
+ </value>
28
+ <next>
29
+ <block type="hardware_led_turn_off">
30
+ <field name="PIN">D2</field>
31
+ <next>
32
+ <block type="control_sleep" inline="true">
33
+ <value name="SEC">
34
+ <block type="math_number">
35
+ <field name="NUM">1</field>
36
+ </block>
37
+ </value>
38
+ <next>
39
+ <block type="hardware_led_turn_on">
40
+ <field name="PIN">D13</field>
41
+ <next>
42
+ <block type="control_sleep" inline="true">
43
+ <value name="SEC">
44
+ <block type="math_number">
45
+ <field name="NUM">1</field>
46
+ </block>
47
+ </value>
48
+ <next>
49
+ <block type="hardware_led_turn_off">
50
+ <field name="PIN">D13</field>
51
+ <next>
52
+ <block type="looks_say" inline="true">
53
+ <value name="TEXT">
54
+ <block type="text">
55
+ <field name="TEXT"></field>
56
+ </block>
57
+ </value>
58
+ </block>
59
+ </next>
60
+ </block>
61
+ </next>
62
+ </block>
63
+ </next>
64
+ </block>
65
+ </next>
66
+ </block>
67
+ </next>
68
+ </block>
69
+ </next>
70
+ </block>
71
+ </next>
72
+ </block>
73
+ </next>
74
+ </block>
75
+ </statement>
76
+ </block>
77
+ </statement>
78
+ </block>
79
+ </xml>
@@ -0,0 +1,22 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ module SmalrubyEditor
4
+ class Config < Settingslogic
5
+ if Rails.env.test?
6
+ source({})
7
+ else
8
+ path = SmalrubyEditor.home_directory.join('config', 'config.yml')
9
+ if path.exist?
10
+ source(path)
11
+ else
12
+ source({})
13
+ end
14
+ end
15
+ suppress_errors(true)
16
+
17
+ def enabled?(feature)
18
+ features.try(:include?, feature)
19
+ end
20
+ module_function :enabled?
21
+ end
22
+ end
@@ -1,3 +1,3 @@
1
1
  module SmalrubyEditor
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -18,6 +18,37 @@ module SmalrubyEditor
18
18
  sound: 300,
19
19
  }
20
20
 
21
+ # http://c4se.hatenablog.com/entry/2013/08/04/190937 をほぼコピーした
22
+ def hsv_to_rgb(h, s, v)
23
+ s /= 100.0
24
+ v /= 100.0
25
+ c = v * s
26
+ x = c * (1 - ((h / 60.0) % 2 - 1).abs)
27
+ m = v - c
28
+ r, g, b = *(
29
+ case
30
+ when h < 60 then [c, x, 0]
31
+ when h < 120 then [x, c, 0]
32
+ when h < 180 then [0, c, x]
33
+ when h < 240 then [0, x, c]
34
+ when h < 300 then [x, 0, c]
35
+ else [c, 0, x]
36
+ end
37
+ )
38
+ [r, g, b].map { |channel|
39
+ sprintf('%02x', ((channel + m) * 255).ceil)
40
+ }.join
41
+ end
42
+ module_function :hsv_to_rgb
43
+
44
+ # return smalruby's home directory
45
+ # (default is '~/.smalruby-editor').
46
+ def home_directory
47
+ path = ENV['SMALRUBY_EDITOR_HOME'] || '~/.smalruby-editor'
48
+ Pathname(path).expand_path
49
+ end
50
+ module_function :home_directory
51
+
21
52
  def create_home_directory(home_dir = nil)
22
53
  if home_dir.blank?
23
54
  path = ENV['SMALRUBY_EDITOR_HOME'] || '~/.smalruby-editor'
@@ -25,6 +56,7 @@ module SmalrubyEditor
25
56
  end
26
57
  create_under_home_directories(home_dir)
27
58
  create_database_yml(home_dir)
59
+ create_config_yml(home_dir)
28
60
  home_dir
29
61
  end
30
62
  module_function :create_home_directory
@@ -93,5 +125,31 @@ standalone:
93
125
  f.write(DATABASE_YML_TEMPLATE.gsub(/%db_path%/, db_path.to_s))
94
126
  end
95
127
  end
128
+
129
+ CONFIG_YML_TEMPLATE = <<-EOS
130
+ #toolbox_name: default
131
+ #toolbox_css_name: default
132
+ features:
133
+ - add_character_from_beginning
134
+ #- disabled_new_character
135
+ #- auto_init_hardware
136
+ #- readonly_ruby_mode
137
+ #- must_signin
138
+ #- enabled_hardware_blocks_on_default
139
+ #- enabled_2wd_car_blocks_on_default
140
+ #- enabled_smalrubot_v3_blocks_on_default
141
+ #- enabled_smalrubot_s1_blocks_on_default
142
+ EOS
143
+
144
+ def create_config_yml(home_dir)
145
+ config_yml_path = home_dir.join('config', 'config.yml')
146
+ unless config_yml_path.exist?
147
+ File.open(config_yml_path, 'w') do |f|
148
+ f.write(CONFIG_YML_TEMPLATE)
149
+ end
150
+ end
151
+ end
96
152
  end
97
153
  end
154
+
155
+ require 'smalruby_editor/config'