smalruby-editor 0.1.18-x86-mingw32 → 0.1.19-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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c8049cbbcf3bc6ad471242a8921f8ec39798c738
4
- data.tar.gz: 1e95df605aa7eda990ff2a31a6cc3028e7de433e
3
+ metadata.gz: dd073e87535e3c426e220b939494f6a065446002
4
+ data.tar.gz: 2fb97e28167e79ecab14f519b225faac9f74d9e6
5
5
  SHA512:
6
- metadata.gz: 43d4ee6c7e50c2b69bd40c963b68045bf9ad3f153f66d31a202bd5e349a230f588d64d09287e2d7f90d485ca5d5d91375f39b51f0f3ffa79c800a386aa510830
7
- data.tar.gz: a95b80d3d95ef5165b67e078911351718d6df5c65fb148d29c502e5b2c6a964f2c7c7aa8033e67c3e6e5cd2b4e9646b3d234252014fb3267ca60926440d6c434
6
+ metadata.gz: 6b14bc1ae322621c950550c4e2a8a684276bb20d227f4e5c7ccd63ea061920fc38a8b1da71daa19f53b2c3f96bf79011e259665a183a27937fb82b7b8d254024
7
+ data.tar.gz: 70e3e275be4ffff8c4c99f5d8ae4b839e75795e66227bac547a579855d2f0f8c949fb4503003164ba192a654fe4a8fbd0814f6d6847ce98ea24ff43d474bf8c2
@@ -22,6 +22,7 @@
22
22
  //= require bootstrap.js
23
23
  //= require jquery-fileupload/basic
24
24
  //= require blockly/blockly_compressed
25
+ //= require fix_blockly.js
25
26
  //= require blockly/blocks_compressed
26
27
  //= require blockly/msg/js/ja
27
28
  //= require underscore
@@ -31,4 +31,4 @@ Blockly.Ruby['<%= n %>'] = (block) ->
31
31
  Blockly.Ruby['<%= n %>'] = (block) ->
32
32
  val = Blockly.Ruby.valueToCode(block, 'VALUE', Blockly.Ruby.ORDER_NONE) || '0'
33
33
  name = Blockly.Ruby.variableDB_.getName(block.getFieldValue('VAR'), Blockly.Variables.NAME_TYPE)
34
- name + ' = ' + val + '\n';
34
+ name + ' = ' + val + '\n'
@@ -247,6 +247,28 @@ Blockly.Blocks['<%= n %>'] =
247
247
  Blockly.Ruby['<%= n %>'] = (block) ->
248
248
  Blockly.Ruby.characterMethodCall_('turn')
249
249
 
250
+ # [▼水平(X)]方向に跳ね返る
251
+ <% n = "#{category}_turn_xy" %>
252
+ Blockly.Blocks['<%= n %>'] =
253
+ init: ()->
254
+ dropdown = [
255
+ ['水平(X)', 'x'],
256
+ ['垂直(Y)', 'y'],
257
+ ]
258
+
259
+ @setHelpUrl('')
260
+ @setColour(<%= color %>)
261
+ @appendDummyInput()
262
+ .appendField(new Blockly.FieldDropdown(dropdown), 'XY')
263
+ .appendField('方向に跳ね返る')
264
+ @setPreviousStatement(true)
265
+ @setNextStatement(true)
266
+ @setTooltip('')
267
+
268
+ Blockly.Ruby['<%= n %>'] = (block) ->
269
+ xy = @getFieldValue('XY')
270
+ Blockly.Ruby.characterMethodCall_("turn_#{xy}")
271
+
250
272
  # 回転方法を[▼]にする
251
273
  <% n = "#{category}_set_rotation_style" %>
252
274
  Blockly.Blocks['<%= n %>'] =
@@ -0,0 +1,16 @@
1
+ Blockly.Names.prototype.safeName_ = function(name) {
2
+ if (!name) {
3
+ name = 'unnamed';
4
+ } else {
5
+ // Unfortunately names in non-latin characters will look like
6
+ // _E9_9F_B3_E4_B9_90 which is pretty meaningless.
7
+ // HACK: Rubyでは日本語の変数名を許可しているためencodeURIを行わない。
8
+ // また、使えない記号を置換する。
9
+ name = name.replace(/[ !"#$%&'()=\-~^\\|`@{\[+;*:}\]<>,.?\/]/g, '_')
10
+ // Most languages don't allow names with leading numbers.
11
+ if ('0123456789'.indexOf(name[0]) != -1) {
12
+ name = '_' + name;
13
+ }
14
+ }
15
+ return name;
16
+ };
@@ -37,6 +37,7 @@
37
37
  93
38
38
  93
39
39
  93
40
+ 330
40
41
  340
41
42
  208
42
43
  208
@@ -27,16 +27,21 @@ class SourceCodesController < ApplicationController
27
27
  filename: 'car_chase.rb',
28
28
  imageUrl: '/smalruby/assets/car2.png',
29
29
  }
30
- res[:demoPrograms] << {
31
- title: 'ライトをぴかっとさせるでよ',
32
- filename: 'hardware_led.rb',
33
- imageUrl: '/smalruby/assets/frog1.png',
34
- }
35
30
  res[:demoPrograms] << {
36
31
  title: 'クリックスターだにゃ~',
37
32
  filename: 'star.rb',
38
33
  imageUrl: '/smalruby/assets/cat1.png',
39
34
  }
35
+ res[:demoPrograms] << {
36
+ title: 'ピンポンゲーム',
37
+ filename: 'pong.rb',
38
+ imageUrl: '/smalruby/assets/cat2.png',
39
+ }
40
+ res[:demoPrograms] << {
41
+ title: 'ライトをぴかっとさせるでよ',
42
+ filename: 'hardware_led.rb',
43
+ imageUrl: '/smalruby/assets/frog1.png',
44
+ }
40
45
 
41
46
  render json: res
42
47
  end
@@ -0,0 +1,14 @@
1
+ # -*- coding: utf-8 -*-
2
+ module RubyToBlock
3
+ module Block
4
+ class MotionTurnXy < CharacterMethodCall
5
+ blocknize '^\s*' + CHAR_RE + 'turn_([xy])\s*$', statement: true
6
+
7
+ def self.process_match_data(md, context)
8
+ md2 = regexp.match(md[type])
9
+ add_character_method_call_block(context, md2[1], new(fields: { XY: md2[2] }))
10
+ true
11
+ end
12
+ end
13
+ end
14
+ end
@@ -54,6 +54,9 @@
54
54
  -# 跳ね返る
55
55
  %block{:type => "#{category}_turn"}
56
56
 
57
+ -# [▼水平(X)]方向に跳ね返る
58
+ %block{:type => "#{category}_turn_xy"}
59
+
57
60
  -# 時計回りに( )度回す
58
61
  %block{:type => "#{category}_rotate_right"}
59
62
  = toolbox_number_value('ANGLE', 15)
@@ -1,3 +1,3 @@
1
1
  module SmalrubyEditor
2
- VERSION = '0.1.18'
2
+ VERSION = '0.1.19'
3
3
  end
@@ -68,7 +68,7 @@ Gem::Specification.new do |spec|
68
68
  ['launchy'],
69
69
  ['mime-types', '~> 1.16'],
70
70
  ['haml-rails'],
71
- ['smalruby', '~> 0.0.26'],
71
+ ['smalruby', '~> 0.0.27'],
72
72
  ]
73
73
  runtime_dependencies << ['therubyracer'] unless is_windows
74
74
  runtime_dependencies.each do |args|
@@ -0,0 +1,76 @@
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::MotionTurnXy, to_blocks: true do
8
+ _parts = <<-EOS
9
+ turn_x
10
+ turn_y
11
+ EOS
12
+ describe compact_source_code(_parts), on_start_data: true do
13
+ __parts = _parts
14
+ let(:parts) { __parts }
15
+
16
+ it '結果が正しいこと' do
17
+ should eq_block_xml(<<-XML)
18
+ <block type="motion_turn_xy">
19
+ <field name="XY">x</field>
20
+ <next>
21
+ <block type="motion_turn_xy">
22
+ <field name="XY">y</field>
23
+ </block>
24
+ </next>
25
+ </block>
26
+ XML
27
+ end
28
+ end
29
+
30
+ _parts = <<-EOS
31
+ car1.turn_x
32
+ car1.turn_y
33
+ EOS
34
+ describe compact_source_code(_parts), character_new_data: true do
35
+ __parts = _parts
36
+ let(:parts) { __parts }
37
+
38
+ it '結果が正しいこと' do
39
+ should eq_block_xml(<<-XML)
40
+ <field name="NAME">car1</field>
41
+ <statement name="DO">
42
+ <block type="motion_turn_xy">
43
+ <field name="XY">x</field>
44
+ <next>
45
+ <block type="motion_turn_xy">
46
+ <field name="XY">y</field>
47
+ </block>
48
+ </next>
49
+ </block>
50
+ </statement>
51
+ XML
52
+ end
53
+ end
54
+
55
+ _parts = <<-EOS
56
+ turn_x
57
+ turn_y
58
+ EOS
59
+ describe compact_source_code(_parts) do
60
+ __parts = _parts
61
+ let(:data) { __parts }
62
+
63
+ it '結果が正しいこと' do
64
+ should eq_block_xml(<<-XML)
65
+ <block type="ruby_statement">
66
+ <field name="STATEMENT">turn_x</field>
67
+ <next>
68
+ <block type="ruby_statement">
69
+ <field name="STATEMENT">turn_y</field>
70
+ </block>
71
+ </next>
72
+ </block>
73
+ XML
74
+ end
75
+ end
76
+ end
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.18
4
+ version: 0.1.19
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-28 00:00:00.000000000 Z
11
+ date: 2014-07-13 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.26
187
+ version: 0.0.27
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.26
194
+ version: 0.0.27
195
195
  - !ruby/object:Gem::Dependency
196
196
  name: bundler
197
197
  requirement: !ruby/object:Gem::Requirement
@@ -263,6 +263,7 @@ files:
263
263
  - app/assets/javascripts/blocks/sound.js.coffee.erb
264
264
  - app/assets/javascripts/collections/.keep
265
265
  - app/assets/javascripts/collections/character_set.js.coffee
266
+ - app/assets/javascripts/fix_blockly.js
266
267
  - app/assets/javascripts/generators/ruby.js.coffee.erb
267
268
  - app/assets/javascripts/models/.keep
268
269
  - app/assets/javascripts/models/character.js.coffee
@@ -345,6 +346,7 @@ files:
345
346
  - app/models/concerns/ruby_to_block/block/motion_set_y.rb
346
347
  - app/models/concerns/ruby_to_block/block/motion_turn.rb
347
348
  - app/models/concerns/ruby_to_block/block/motion_turn_if_reach_wall.rb
349
+ - app/models/concerns/ruby_to_block/block/motion_turn_xy.rb
348
350
  - app/models/concerns/ruby_to_block/block/null.rb
349
351
  - app/models/concerns/ruby_to_block/block/operators_compare.rb
350
352
  - app/models/concerns/ruby_to_block/block/operators_false.rb
@@ -401,6 +403,7 @@ files:
401
403
  - db/seeds.rb
402
404
  - demos/car_chase.rb.xml
403
405
  - demos/hardware_led.rb.xml
406
+ - demos/pong.rb.xml
404
407
  - demos/rgb_led_anode.rb.xml
405
408
  - demos/star.rb.xml
406
409
  - lib/assets/.keep
@@ -569,6 +572,7 @@ files:
569
572
  - spec/models/concerns/ruby_to_block/block/motion_reach_wall_spec.rb
570
573
  - spec/models/concerns/ruby_to_block/block/motion_spec.rb
571
574
  - spec/models/concerns/ruby_to_block/block/motion_turn_spec.rb
575
+ - spec/models/concerns/ruby_to_block/block/motion_turn_xy_spec.rb
572
576
  - spec/models/concerns/ruby_to_block/block/require_smalruby_spec.rb
573
577
  - spec/models/concerns/ruby_to_block/block/ruby_comment_spec.rb
574
578
  - spec/models/concerns/ruby_to_block/block/ruby_statement_spec.rb
@@ -594,10 +598,10 @@ files:
594
598
  - vendor/assets/javascripts/blockly/msg/js/ja.js
595
599
  - vendor/assets/javascripts/jquery.blockUI.js
596
600
  - vendor/assets/stylesheets/.keep
597
- - public/assets/application-842ac8f5aa3fcc87bbb0e8b3a0fef5d7.js
598
- - public/assets/application-842ac8f5aa3fcc87bbb0e8b3a0fef5d7.js.gz
599
- - public/assets/application-b31ceba36a60591e488903231db4cb37.css
600
- - public/assets/application-b31ceba36a60591e488903231db4cb37.css.gz
601
+ - public/assets/application-acf953339e4b5c31b5d6060375b13a44.js
602
+ - public/assets/application-acf953339e4b5c31b5d6060375b13a44.js.gz
603
+ - public/assets/application-e9d089df8f23954c49647ab7af8481dc.css
604
+ - public/assets/application-e9d089df8f23954c49647ab7af8481dc.css.gz
601
605
  - public/assets/favicon-a37c90b368fd8ed436cb8f9e9396465c.ico
602
606
  - public/assets/jquery-ui/animated-overlay-c48c87b7a95316f4698484e3b85ee4aa.gif
603
607
  - public/assets/jquery-ui/ui-bg_flat_0_aaaaaa_40x100-58b63faadd031ca3db096dfdffd90224.png
@@ -748,6 +752,7 @@ test_files:
748
752
  - spec/models/concerns/ruby_to_block/block/motion_reach_wall_spec.rb
749
753
  - spec/models/concerns/ruby_to_block/block/motion_spec.rb
750
754
  - spec/models/concerns/ruby_to_block/block/motion_turn_spec.rb
755
+ - spec/models/concerns/ruby_to_block/block/motion_turn_xy_spec.rb
751
756
  - spec/models/concerns/ruby_to_block/block/require_smalruby_spec.rb
752
757
  - spec/models/concerns/ruby_to_block/block/ruby_comment_spec.rb
753
758
  - spec/models/concerns/ruby_to_block/block/ruby_statement_spec.rb