smalruby-editor 0.1.15-x86-mingw32 → 0.1.16-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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/README.rdoc +16 -1
  3. data/app/assets/javascripts/blocks/character.js.coffee.erb +8 -1
  4. data/app/assets/javascripts/blocks/hardware.js.coffee.erb +59 -7
  5. data/app/assets/javascripts/blocks/motion.js.coffee.erb +1 -2
  6. data/app/assets/javascripts/models/character.js.coffee +27 -0
  7. data/app/assets/javascripts/smalruby.js.coffee +4 -0
  8. data/app/assets/javascripts/views/character_modal_view.js.coffee +22 -1
  9. data/app/assets/javascripts/views/character_selector_view.js.coffee +7 -6
  10. data/app/assets/stylesheets/application.css +8 -0
  11. data/app/assets/stylesheets/editor.css.scss +15 -5
  12. data/app/controllers/application_controller.rb +4 -7
  13. data/app/models/concerns/ruby_to_block/block/character.rb +14 -6
  14. data/app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car.rb +1 -1
  15. data/app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_commands.rb +15 -0
  16. data/app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_run.rb +19 -0
  17. data/app/models/concerns/ruby_to_block/block/motion_set_x.rb +1 -24
  18. data/app/models/concerns/ruby_to_block/block/motion_set_x_y.rb +21 -0
  19. data/app/models/source_code.rb +9 -6
  20. data/app/views/editor/_block_tab.html.haml +3 -1
  21. data/app/views/editor/_character_modal.html.haml +14 -5
  22. data/app/views/editor/_toolbox.html.haml +91 -78
  23. data/bin/smalruby-editor +15 -0
  24. data/lib/smalruby_editor.rb +39 -4
  25. data/lib/smalruby_editor/version.rb +1 -1
  26. data/public/assets/{application-51ab300acd1779bfba20b099e7000b7e.css → application-7f560d8d6d224f87269691c57ca9a376.css} +23 -9
  27. data/public/assets/{application-51ab300acd1779bfba20b099e7000b7e.css.gz → application-7f560d8d6d224f87269691c57ca9a376.css.gz} +0 -0
  28. data/public/assets/{application-dc485e2270d6c5fce20c149d1e2c4f8d.js → application-842ac8f5aa3fcc87bbb0e8b3a0fef5d7.js} +148 -21
  29. data/public/assets/{application-dc485e2270d6c5fce20c149d1e2c4f8d.js.gz → application-842ac8f5aa3fcc87bbb0e8b3a0fef5d7.js.gz} +0 -0
  30. data/public/assets/manifest-332a5a1668194028b55103e0ea45c054.json +1 -1
  31. data/smalruby-editor.gemspec +1 -1
  32. data/spec/acceptance/block_mode/blocks/motion/set_x_y.feature +2 -4
  33. data/spec/lib/smalruby_editor_spec.rb +12 -0
  34. data/spec/models/concerns/ruby_to_block/block/hardware_spec.rb +90 -10
  35. data/spec/models/concerns/ruby_to_block/block/motion_spec.rb +3 -6
  36. metadata +11 -8
@@ -62,5 +62,17 @@ describe SmalrubyEditor do
62
62
  SmalrubyEditor.create_home_directory
63
63
  end
64
64
  end
65
+
66
+ context 'database.ymlが存在する場合', create_home_directory: true do
67
+ before(:all) do
68
+ database_yml_path = @home_dir.join('config', 'database.yml')
69
+ FileUtils.mkdir_p(database_yml_path.dirname)
70
+ database_yml_path.open('w') do |f|
71
+ f.write('exist YAML')
72
+ end
73
+
74
+ SmalrubyEditor.create_home_directory(@home_dir)
75
+ end
76
+ end
65
77
  end
66
78
  end
@@ -14,17 +14,22 @@ car1 = Character.new(costume: "car1.png", x: 0, y: 0, angle: 0)
14
14
  car1.on(:start) do
15
15
  led("D4").on
16
16
  rgb_led_cathode("D9").on(color: [255, 0, 0])
17
- two_wheel_drive_car("D2").forward
17
+ two_wheel_drive_car("D6").forward
18
18
  end
19
19
  car1.led("D4").off
20
20
  car1.rgb_led_cathode("D9").off
21
- car1.two_wheel_drive_car("D2").backward
21
+ car1.two_wheel_drive_car("D6").backward
22
22
 
23
23
  car1.on(:sensor_change, "A0") do
24
24
  if sensor("A0").value < 200
25
- two_wheel_drive_car("D2").turn_left
26
- two_wheel_drive_car("D2").turn_right
27
- two_wheel_drive_car("D2").stop
25
+ two_wheel_drive_car("D6").turn_left
26
+ two_wheel_drive_car("D6").turn_right
27
+ two_wheel_drive_car("D6").stop
28
+ two_wheel_drive_car("D6").run(command: "forward", sec: 1)
29
+ two_wheel_drive_car("D6").run(command: "backward", sec: 2)
30
+ two_wheel_drive_car("D6").run(command: "turn_left", sec: 3)
31
+ two_wheel_drive_car("D6").run(command: "turn_right", sec: 4)
32
+ two_wheel_drive_car("D6").run(command: "stop", sec: 5)
28
33
  end
29
34
  end
30
35
  EOS
@@ -50,7 +55,7 @@ end
50
55
  <field name="COLOUR">#ff0000</field>
51
56
  <next>
52
57
  <block type="hardware_two_wheel_drive_car_forward">
53
- <field name="PIN">D2</field>
58
+ <field name="PIN">D6</field>
54
59
  </block>
55
60
  </next>
56
61
  </block>
@@ -66,7 +71,7 @@ end
66
71
  <field name="PIN">D9</field>
67
72
  <next>
68
73
  <block type="hardware_two_wheel_drive_car_backward">
69
- <field name="PIN">D2</field>
74
+ <field name="PIN">D6</field>
70
75
  <next>
71
76
  <block type="hardware_on_sensor_change">
72
77
  <field name="PIN">A0</field>
@@ -88,13 +93,88 @@ end
88
93
  </value>
89
94
  <statement name="THEN">
90
95
  <block type="hardware_two_wheel_drive_car_turn_left">
91
- <field name="PIN">D2</field>
96
+ <field name="PIN">D6</field>
92
97
  <next>
93
98
  <block type="hardware_two_wheel_drive_car_turn_right">
94
- <field name="PIN">D2</field>
99
+ <field name="PIN">D6</field>
95
100
  <next>
96
101
  <block type="hardware_two_wheel_drive_car_stop">
97
- <field name="PIN">D2</field>
102
+ <field name="PIN">D6</field>
103
+ <next>
104
+ <block type="hardware_two_wheel_drive_car_run" inline="true">
105
+ <field name="PIN">D6</field>
106
+ <value name="SEC">
107
+ <block type="math_number">
108
+ <field name="NUM">1</field>
109
+ </block>
110
+ </value>
111
+ <value name="COMMAND">
112
+ <block type="hardware_two_wheel_drive_car_commands">
113
+ <field name="COMMAND">forward</field>
114
+ </block>
115
+ </value>
116
+ <next>
117
+ <block type="hardware_two_wheel_drive_car_run" inline="true">
118
+ <field name="PIN">D6</field>
119
+ <value name="SEC">
120
+ <block type="math_number">
121
+ <field name="NUM">2</field>
122
+ </block>
123
+ </value>
124
+ <value name="COMMAND">
125
+ <block type="hardware_two_wheel_drive_car_commands">
126
+ <field name="COMMAND">backward</field>
127
+ </block>
128
+ </value>
129
+ <next>
130
+ <block type="hardware_two_wheel_drive_car_run" inline="true">
131
+ <field name="PIN">D6</field>
132
+ <value name="SEC">
133
+ <block type="math_number">
134
+ <field name="NUM">3</field>
135
+ </block>
136
+ </value>
137
+ <value name="COMMAND">
138
+ <block type="hardware_two_wheel_drive_car_commands">
139
+ <field name="COMMAND">turn_left</field>
140
+ </block>
141
+ </value>
142
+ <next>
143
+ <block type="hardware_two_wheel_drive_car_run" inline="true">
144
+ <field name="PIN">D6</field>
145
+ <value name="SEC">
146
+ <block type="math_number">
147
+ <field name="NUM">4</field>
148
+ </block>
149
+ </value>
150
+ <value name="COMMAND">
151
+ <block type="hardware_two_wheel_drive_car_commands">
152
+ <field name="COMMAND">turn_right</field>
153
+ </block>
154
+ </value>
155
+ <next>
156
+ <block type="hardware_two_wheel_drive_car_run" inline="true">
157
+ <field name="PIN">D6</field>
158
+ <value name="SEC">
159
+ <block type="math_number">
160
+ <field name="NUM">5</field>
161
+ </block>
162
+ </value>
163
+ <value name="COMMAND">
164
+ <block type="hardware_two_wheel_drive_car_commands">
165
+ <field name="COMMAND">stop</field>
166
+ </block>
167
+ </value>
168
+ </block>
169
+ </next>
170
+ </block>
171
+ </next>
172
+ </block>
173
+ </next>
174
+ </block>
175
+ </next>
176
+ </block>
177
+ </next>
98
178
  </block>
99
179
  </next>
100
180
  </block>
@@ -8,8 +8,7 @@ describe RubyToBlock::Block, '移動・回転ジャンル', to_blocks: true do
8
8
  parts = <<-EOS
9
9
  car1.on(:start) do
10
10
  move(10)
11
- self.x = 0
12
- self.y = 0
11
+ self.position = [0, 0]
13
12
  self.x += 10
14
13
  self.x = 0
15
14
  self.y += 10
@@ -21,8 +20,7 @@ car1.on(:start) do
21
20
  end
22
21
  end
23
22
  car1.move(10)
24
- car1.x = 0
25
- car1.y = 0
23
+ car1.position = [0, 0]
26
24
  car1.x += 10
27
25
  car1.x = 0
28
26
  car1.y += 10
@@ -195,8 +193,7 @@ car1.y = 0
195
193
 
196
194
  parts = <<-EOS
197
195
  car1.move(10)
198
- car1.x = 0
199
- car1.y = 0
196
+ car1.position = [0, 0]
200
197
  car1.x += 10
201
198
  EOS
202
199
  describe compact_source_code(parts), character_new_data: true do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smalruby-editor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.15
4
+ version: 0.1.16
5
5
  platform: x86-mingw32
6
6
  authors:
7
7
  - Kouji Takao
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-01 00:00:00.000000000 Z
11
+ date: 2014-06-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -184,14 +184,14 @@ dependencies:
184
184
  requirements:
185
185
  - - ~>
186
186
  - !ruby/object:Gem::Version
187
- version: 0.0.23
187
+ version: 0.0.25
188
188
  type: :runtime
189
189
  prerelease: false
190
190
  version_requirements: !ruby/object:Gem::Requirement
191
191
  requirements:
192
192
  - - ~>
193
193
  - !ruby/object:Gem::Version
194
- version: 0.0.23
194
+ version: 0.0.25
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: bundler
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -318,6 +318,8 @@ files:
318
318
  - app/models/concerns/ruby_to_block/block/hardware_rgb_led_on.rb
319
319
  - app/models/concerns/ruby_to_block/block/hardware_sensor_value.rb
320
320
  - app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car.rb
321
+ - app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_commands.rb
322
+ - app/models/concerns/ruby_to_block/block/hardware_two_wheel_drive_car_run.rb
321
323
  - app/models/concerns/ruby_to_block/block/looks_hide.rb
322
324
  - app/models/concerns/ruby_to_block/block/looks_say.rb
323
325
  - app/models/concerns/ruby_to_block/block/looks_show.rb
@@ -336,6 +338,7 @@ files:
336
338
  - app/models/concerns/ruby_to_block/block/motion_self_y.rb
337
339
  - app/models/concerns/ruby_to_block/block/motion_set_angle.rb
338
340
  - app/models/concerns/ruby_to_block/block/motion_set_x.rb
341
+ - app/models/concerns/ruby_to_block/block/motion_set_x_y.rb
339
342
  - app/models/concerns/ruby_to_block/block/motion_set_y.rb
340
343
  - app/models/concerns/ruby_to_block/block/motion_turn.rb
341
344
  - app/models/concerns/ruby_to_block/block/motion_turn_if_reach_wall.rb
@@ -587,10 +590,10 @@ files:
587
590
  - vendor/assets/javascripts/blockly/msg/js/ja.js
588
591
  - vendor/assets/javascripts/jquery.blockUI.js
589
592
  - vendor/assets/stylesheets/.keep
590
- - public/assets/application-51ab300acd1779bfba20b099e7000b7e.css
591
- - public/assets/application-51ab300acd1779bfba20b099e7000b7e.css.gz
592
- - public/assets/application-dc485e2270d6c5fce20c149d1e2c4f8d.js
593
- - public/assets/application-dc485e2270d6c5fce20c149d1e2c4f8d.js.gz
593
+ - public/assets/application-7f560d8d6d224f87269691c57ca9a376.css
594
+ - public/assets/application-7f560d8d6d224f87269691c57ca9a376.css.gz
595
+ - public/assets/application-842ac8f5aa3fcc87bbb0e8b3a0fef5d7.js
596
+ - public/assets/application-842ac8f5aa3fcc87bbb0e8b3a0fef5d7.js.gz
594
597
  - public/assets/favicon-a37c90b368fd8ed436cb8f9e9396465c.ico
595
598
  - public/assets/jquery-ui/animated-overlay-c48c87b7a95316f4698484e3b85ee4aa.gif
596
599
  - public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-58b63faadd031ca3db096dfdffd90224.png