ruby2js 2.0.3 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,11 +23,12 @@ module Ruby2JS
23
23
  end
24
24
 
25
25
  begin
26
- block_depth,block_this,block_hash = @block_depth,@block_this,false
26
+ block_depth,block_hash = @block_depth,false
27
27
  left, right = node.children
28
28
 
29
29
  if Hash === right or right.type == :block
30
- @block_depth, block_hash = 0, true
30
+ block_hash = true
31
+ @block_depth = 0 unless @block_depth
31
32
  end
32
33
 
33
34
  if left.type == :prop
@@ -81,7 +82,6 @@ module Ruby2JS
81
82
  ensure
82
83
  if block_hash
83
84
  @block_depth = block_depth
84
- @block_this = block_this
85
85
  end
86
86
  end
87
87
  end
@@ -39,16 +39,16 @@ module Ruby2JS
39
39
  return super unless inheritance == s(:const, nil, :React)
40
40
 
41
41
  # traverse down to actual list of class statements
42
- if body.length == 1
42
+ if body.length == 1
43
43
  if not body.first
44
44
  body = []
45
45
  elsif body.first.type == :begin
46
- body = body.first.children
46
+ body = body.first.children
47
47
  end
48
48
  end
49
49
 
50
50
  # abort conversion unless all body statements are method definitions
51
- return super unless body.all? do |child|
51
+ return super unless body.all? do |child|
52
52
  child.type == :def or
53
53
  (child.type == :defs and child.children.first == s(:self))
54
54
  end
@@ -58,7 +58,7 @@ module Ruby2JS
58
58
  reactClass, @reactClass = @reactClass, true
59
59
 
60
60
  # automatically capture the displayName for the class
61
- pairs = [s(:pair, s(:sym, :displayName),
61
+ pairs = [s(:pair, s(:sym, :displayName),
62
62
  s(:str, cname.children.last.to_s))]
63
63
 
64
64
  # collect static properties/functions
@@ -66,10 +66,10 @@ module Ruby2JS
66
66
  body.select {|child| child.type == :defs}.each do |child|
67
67
  parent, mname, args, *block = child.children
68
68
  if child.is_method?
69
- statics << s(:pair, s(:sym, mname), process(child.updated(:block,
69
+ statics << s(:pair, s(:sym, mname), process(child.updated(:block,
70
70
  [s(:send, nil, :proc), args, s(:autoreturn, *block)])))
71
- elsif
72
- block.length == 1 and
71
+ elsif
72
+ block.length == 1 and
73
73
  Converter::EXPRESSIONS.include? block.first.type
74
74
  then
75
75
  statics << s(:pair, s(:sym, mname), *block)
@@ -88,14 +88,14 @@ module Ruby2JS
88
88
  # and there are references to instance variables.
89
89
  if
90
90
  not body.any? do |child|
91
- child.type == :def and
91
+ child.type == :def and
92
92
  [:getInitialState, :initialize].include? child.children.first
93
93
  end
94
94
  then
95
- @reactIvars = {pre: [], post: [], asgn: [], ref: []}
95
+ @reactIvars = {pre: [], post: [], asgn: [], ref: [], cond: []}
96
96
  react_walk(node)
97
97
  unless @reactIvars.values.flatten.empty?
98
- body = [s(:def, :getInitialState, s(:args),
98
+ body = [s(:def, :getInitialState, s(:args),
99
99
  s(:return, s(:hash))), *body]
100
100
  end
101
101
  end
@@ -107,9 +107,9 @@ module Ruby2JS
107
107
  @reactProps = child.updated(:attr, [s(:self), :props])
108
108
 
109
109
  # analyze ivar usage
110
- @reactIvars = {pre: [], post: [], asgn: [], ref: []}
110
+ @reactIvars = {pre: [], post: [], asgn: [], ref: [], cond: []}
111
111
  react_walk(child) unless mname == :initialize
112
- @reactIvars[:capture] =
112
+ @reactIvars[:capture] =
113
113
  (@reactIvars[:pre] + @reactIvars[:post]).uniq
114
114
 
115
115
  if mname == :initialize
@@ -152,12 +152,12 @@ module Ruby2JS
152
152
  end
153
153
 
154
154
  elsif mname == :render
155
- if
156
- block.length != 1 or not block.last or
155
+ if
156
+ block.length != 1 or not block.last or
157
157
  not [:send, :block].include? block.last.type
158
158
  then
159
159
  # wrap multi-line blocks with a 'span' element
160
- block = [s(:return,
160
+ block = [s(:return,
161
161
  s(:block, s(:send, nil, :_span), s(:args), *block))]
162
162
  end
163
163
 
@@ -180,14 +180,14 @@ module Ruby2JS
180
180
 
181
181
  # capture ivars that are both set and referenced
182
182
  @reactIvars[:pre].uniq.sort.reverse.each do |ivar|
183
- block.unshift(s(:lvasgn, "$#{ivar.to_s[1..-1]}",
183
+ block.unshift(s(:lvasgn, "$#{ivar.to_s[1..-1]}",
184
184
  s(:attr, s(:attr, s(:self), :state), ivar.to_s[1..-1])))
185
185
  end
186
186
 
187
187
  # update ivars that are set and later referenced
188
188
  unless @reactIvars[:post].empty?
189
189
  updates = @reactIvars[:post].uniq.sort.reverse.map do |ivar|
190
- s(:pair, s(:lvar, ivar.to_s[1..-1]),
190
+ s(:pair, s(:lvar, ivar.to_s[1..-1]),
191
191
  s(:lvar, "$#{ivar.to_s[1..-1]}"))
192
192
  end
193
193
  update = s(:send, s(:self), :setState, s(:hash, *updates))
@@ -220,7 +220,7 @@ module Ruby2JS
220
220
  end
221
221
 
222
222
  # emit a createClass statement
223
- node.updated(:casgn, [nil, cname.children.last,
223
+ node.updated(:casgn, [nil, cname.children.last,
224
224
  s(:send, inheritance, :createClass, s(:hash, *pairs))])
225
225
  end
226
226
 
@@ -228,7 +228,7 @@ module Ruby2JS
228
228
  if not @react
229
229
  # enable React filtering within React class method calls or
230
230
  # React component calls
231
- if
231
+ if
232
232
  node.children.first == s(:const, nil, :React)
233
233
  then
234
234
  begin
@@ -252,7 +252,7 @@ module Ruby2JS
252
252
  process(node.children[2])
253
253
  end
254
254
 
255
- elsif
255
+ elsif
256
256
  @reactApply and node.children[1] == :createElement and
257
257
  node.children[0] == s(:const, nil, :React)
258
258
  then
@@ -262,7 +262,7 @@ module Ruby2JS
262
262
 
263
263
  elsif node.children[0] == nil and node.children[1] =~ /^_\w/
264
264
  # map method calls starting with an underscore to React calls
265
- # to create an element.
265
+ # to create an element.
266
266
  #
267
267
  # input:
268
268
  # _a 'name', href: 'link'
@@ -318,7 +318,7 @@ module Ruby2JS
318
318
  expr = expr.children.first
319
319
  end
320
320
 
321
- if
321
+ if
322
322
  expr.type == :if and expr.children[1] and
323
323
  expr.children[1].type == :str
324
324
  then
@@ -340,6 +340,41 @@ module Ruby2JS
340
340
  pairs.unshift s(:pair, s(:sym, :className), value)
341
341
  end
342
342
 
343
+ # support controlled form components
344
+ if %w(input select textarea).include? tag
345
+ # search for the presence of a 'value' attribute
346
+ value = pairs.find_index do |pair|
347
+ ['value', :value].include? pair.children.first.children.first
348
+ end
349
+
350
+ # search for the presence of a 'onChange' attribute
351
+ onChange = pairs.find_index do |pair|
352
+ ['onChange', :onChange].include? pair.children.first.children[0]
353
+ end
354
+
355
+ if value and pairs[value].children.last.type == :ivar and
356
+ !onChange
357
+ pairs << s(:pair, s(:sym, :onChange),
358
+ s(:block, s(:send, nil, :proc), s(:args, s(:arg, :event)),
359
+ s(:ivasgn, pairs[value].children.last.children.first,
360
+ s(:attr, s(:attr, s(:lvar, :event), :target), :value))))
361
+ end
362
+
363
+ if not value and not onChange and tag == 'input'
364
+ # search for the presence of a 'checked' attribute
365
+ checked = pairs.find_index do |pair|
366
+ ['checked', :checked].include? pair.children.first.children[0]
367
+ end
368
+
369
+ if checked and pairs[checked].children.last.type == :ivar
370
+ pairs << s(:pair, s(:sym, :onChange),
371
+ s(:block, s(:send, nil, :proc), s(:args),
372
+ s(:ivasgn, pairs[checked].children.last.children.first,
373
+ s(:send, pairs[checked].children.last, :!))))
374
+ end
375
+ end
376
+ end
377
+
343
378
  # search for the presence of a 'for' attribute
344
379
  htmlFor = pairs.find_index do |pair|
345
380
  ['for', :for].include? pair.children.first.children.first
@@ -366,11 +401,11 @@ module Ruby2JS
366
401
 
367
402
  # traverse down to actual list of nested statements
368
403
  args = block.children[2..-1]
369
- if args.length == 1
404
+ if args.length == 1
370
405
  if not args.first
371
406
  args = []
372
407
  elsif args.first.type == :begin
373
- args = args.first.children
408
+ args = args.first.children
374
409
  end
375
410
  end
376
411
 
@@ -405,8 +440,8 @@ module Ruby2JS
405
440
  # }())
406
441
  #
407
442
  # Base Ruby2JS processing will convert the 'splat' to 'apply'
408
- params = [s(:splat, s(:send, s(:block, s(:send, nil, :proc),
409
- s(:args, s(:shadowarg, :$_)), s(:begin,
443
+ params = [s(:splat, s(:send, s(:block, s(:send, nil, :proc),
444
+ s(:args, s(:shadowarg, :$_)), s(:begin,
410
445
  s(:lvasgn, :$_, s(:array, *params)),
411
446
  *args.map {|arg| process arg},
412
447
  s(:return, s(:lvar, :$_)))), :[]))]
@@ -424,7 +459,7 @@ module Ruby2JS
424
459
  params.pop if params.last == s(:nil)
425
460
 
426
461
  # construct element using params
427
- element = node.updated(:send, [s(:const, nil, :React),
462
+ element = node.updated(:send, [s(:const, nil, :React),
428
463
  :createElement, *params])
429
464
 
430
465
  if @reactApply
@@ -504,7 +539,7 @@ module Ruby2JS
504
539
  # possible getter/setter
505
540
  method = node.children[1]
506
541
  method = method.to_s.chomp('=') if method =~ /=$/
507
- rewrite = [rewrite_tilda[node.children[0]],
542
+ rewrite = [rewrite_tilda[node.children[0]],
508
543
  method, *node.children[2..-1]]
509
544
  rewrite[1] = node.children[1]
510
545
  node.updated nil, rewrite
@@ -516,16 +551,16 @@ module Ruby2JS
516
551
  s(:send, s(:gvar, "$#{node.children[0]}"), :getDOMNode)
517
552
  elsif node.type == :str
518
553
  if node.children.first =~ /^#[-\w]+$/
519
- s(:send, s(:attr, nil, :document), :getElementById,
554
+ s(:send, s(:attr, nil, :document), :getElementById,
520
555
  s(:str, node.children.first[1..-1].gsub('_', '-')))
521
556
  elsif node.children.first =~ /^(\.[-\w]+)+$/
522
- s(:send, s(:send, s(:attr, nil, :document),
523
- :getElementsByClassName, s(:str,
557
+ s(:send, s(:send, s(:attr, nil, :document),
558
+ :getElementsByClassName, s(:str,
524
559
  node.children.first[1..-1].gsub('.', ' ').gsub('_', '-'))),
525
560
  :[], s(:int, 0))
526
561
  elsif node.children.first =~ /^[-\w]+$/
527
- s(:send, s(:send, s(:attr, nil, :document),
528
- :getElementsByTagName, s(:str,
562
+ s(:send, s(:send, s(:attr, nil, :document),
563
+ :getElementsByTagName, s(:str,
529
564
  node.children.first.gsub('_', '-'))), :[], s(:int, 0))
530
565
  else
531
566
  s(:send, s(:attr, nil, :document), :querySelector, node)
@@ -553,11 +588,11 @@ module Ruby2JS
553
588
  while node != child
554
589
  if node.children[1] !~ /!$/
555
590
  # convert method name to hash {className: name} pair
556
- pair = s(:pair, s(:sym, :className),
591
+ pair = s(:pair, s(:sym, :className),
557
592
  s(:str, node.children[1].to_s.gsub('_','-')))
558
593
  else
559
594
  # convert method name to hash {id: name} pair
560
- pair = s(:pair, s(:sym, :id),
595
+ pair = s(:pair, s(:sym, :id),
561
596
  s(:str, node.children[1].to_s[0..-2].gsub('_','-')))
562
597
  end
563
598
 
@@ -579,7 +614,7 @@ module Ruby2JS
579
614
  super
580
615
  end
581
616
 
582
- elsif
617
+ elsif
583
618
  node.children[0] and node.children[0].type == :self and
584
619
  node.children.length == 2 and
585
620
  node.children[1] == :componentWillReceiveProps
@@ -596,11 +631,11 @@ module Ruby2JS
596
631
  if not @react
597
632
  # enable React filtering within React class method calls or
598
633
  # React component calls
599
- if
634
+ if
600
635
  node.children.first == s(:const, nil, :React)
601
636
  then
602
637
  begin
603
- reacth @react = @react, true
638
+ react, @react = @react, true
604
639
  return on_block(node)
605
640
  ensure
606
641
  @react = react
@@ -634,11 +669,16 @@ module Ruby2JS
634
669
  if child.children[0] == nil and child.children[1] =~ /^_\w/
635
670
  block = s(:block, s(:send, nil, :proc), s(:args),
636
671
  *node.children[2..-1])
637
- return on_send node.children.first.updated(:send,
672
+ return on_send node.children.first.updated(:send,
638
673
  [*node.children.first.children, block])
639
674
  end
640
675
 
641
- super
676
+ begin
677
+ reactBlock, @reactBlock = @reactBlock, true
678
+ super
679
+ ensure
680
+ @reactBlock = reactBlock
681
+ end
642
682
  end
643
683
 
644
684
  # convert global variables to refs
@@ -653,7 +693,7 @@ module Ruby2JS
653
693
  if @reactMethod and @reactIvars[:capture].include? node.children.first
654
694
  node.updated(:lvar, ["$#{node.children.first[1..-1]}"])
655
695
  else
656
- node.updated(:attr, [s(:attr, s(:self), :state),
696
+ node.updated(:attr, [s(:attr, s(:self), :state),
657
697
  node.children.first.to_s[1..-1]])
658
698
  end
659
699
  end
@@ -663,8 +703,15 @@ module Ruby2JS
663
703
  return super unless @react
664
704
 
665
705
  if @reactMethod and @reactIvars[:capture].include? node.children.first
666
- return s(:lvasgn, "$#{node.children.first[1..-1]}",
667
- *process_all(node.children[1..-1]))
706
+ ivar = node.children.first.to_s
707
+ if @reactBlock
708
+ return s(:send, s(:self), :setState, s(:hash, s(:pair,
709
+ s(:lvar, ivar[1..-1]), process(s(:lvasgn, "$#{ivar[1..-1]}",
710
+ *node.children[1..-1])))))
711
+ else
712
+ return s(:lvasgn, "$#{ivar[1..-1]}",
713
+ *process_all(node.children[1..-1]))
714
+ end
668
715
  end
669
716
 
670
717
  vars = [node.children.first]
@@ -674,13 +721,15 @@ module Ruby2JS
674
721
  vars << node.children.first
675
722
  end
676
723
 
677
- if @reactMethod == :initialize
678
- s(:begin, *vars.map {|var| s(:send, s(:attr, s(:self), :state),
679
- var.to_s[1..-1] + '=', process(node.children.last))})
680
- else
681
- s(:send, s(:self), :setState, s(:hash,
682
- *vars.map {|var| s(:pair, s(:str, var.to_s[1..-1]),
683
- process(node.children.last))}))
724
+ if node.children.length == 2
725
+ if @reactMethod == :initialize
726
+ s(:begin, *vars.map {|var| s(:send, s(:attr, s(:self), :state),
727
+ var.to_s[1..-1] + '=', process(node.children.last))})
728
+ else
729
+ s(:send, s(:self), :setState, s(:hash,
730
+ *vars.map {|var| s(:pair, s(:str, var.to_s[1..-1]),
731
+ process(node.children.last))}))
732
+ end
684
733
  end
685
734
  end
686
735
 
@@ -690,19 +739,45 @@ module Ruby2JS
690
739
  raise NotImplementedError, "setting a React property"
691
740
  end
692
741
 
693
- # convert class variables to props
742
+ # convert instance variables to state: "@x ||= y"
743
+ def on_or_asgn(node)
744
+ return super unless @react
745
+ return super unless node.children.first.type == :ivasgn
746
+ on_op_asgn(node)
747
+ end
748
+
749
+ # convert instance variables to state: "@x &&= y"
750
+ def on_and_asgn(node)
751
+ return super unless @react
752
+ return super unless node.children.first.type == :ivasgn
753
+ on_op_asgn(node)
754
+ end
755
+
756
+ # convert instance variables to state: "@x += y"
694
757
  def on_op_asgn(node)
695
758
  return super unless @react
696
759
  return super unless node.children.first.type == :ivasgn
697
760
  var = node.children.first.children.first
698
761
  if @reactMethod and @reactIvars[:capture].include? var
699
- process s(:op_asgn, s(:lvasgn, "$#{var[1..-1]}"),
700
- *node.children[1..-1])
762
+ if @reactBlock
763
+ s(:send, s(:self), :setState, s(:hash, s(:pair,
764
+ s(:lvar, var[1..-1]), process(s(node.type,
765
+ s(:lvasgn, "$#{var[1..-1]}"), *node.children[1..-1])))))
766
+ else
767
+ process s(node.type, s(:lvasgn, "$#{var[1..-1]}"),
768
+ *node.children[1..-1])
769
+ end
701
770
  elsif @reactMethod == :initialize
702
- process s(:op_asgn, s(:attr, s(:attr, s(:self), :state),
771
+ process s(node.type, s(:attr, s(:attr, s(:self), :state),
703
772
  var[1..-1]), *node.children[1..-1])
773
+ elsif node.type == :or_asgn
774
+ process s(:ivasgn, var, s(:or, s(:ivar, var),
775
+ *node.children[1..-1]))
776
+ elsif node.type == :and_asgn
777
+ process s(:ivasgn, var, s(:and, s(:ivar, var),
778
+ *node.children[1..-1]))
704
779
  else
705
- process s(:ivasgn, var, s(:send, s(:ivar, var),
780
+ process s(:ivasgn, var, s(:send, s(:ivar, var),
706
781
  *node.children[1..-1]))
707
782
  end
708
783
  end
@@ -717,34 +792,42 @@ module Ruby2JS
717
792
  def react_walk(node)
718
793
  child = node.children.first
719
794
 
795
+ base = @reactIvars[:asgn].dup if [:if, :case].include? node.type
796
+
720
797
  node.children.each do |child|
721
798
  react_walk(child) if Parser::AST::Node === child
722
799
  end
723
800
 
724
801
  case node.type
802
+ when :if, :case
803
+ @reactIvars[:cond] += @reactIvars[:asgn] - base
804
+
725
805
  when :ivar
726
- if @reactIvars[:asgn].include? child
806
+ if @reactIvars[:cond].include? child
807
+ @reactIvars[:post] << child
808
+ @reactIvars[:pre] << child
809
+ elsif @reactIvars[:asgn].include? child
727
810
  @reactIvars[:post] << child
728
811
  @reactIvars[:pre] << child if @reactIvars[:ref].include? child
729
812
  end
730
813
  @reactIvars[:ref] << child
731
-
814
+
732
815
  when :ivasgn
733
816
  @reactIvars[:asgn] << child
734
817
 
735
- when :op_asgn
818
+ when :op_asgn, :or_asgn, :and_asgn
736
819
  if child.type == :ivasgn
737
820
  gchild = child.children.first
738
- if @reactIvars[:ref].include? gchild
739
- @reactIvars[:pre] << gchild
740
- @reactIvars[:post] << gchild
821
+ if (@reactIvars[:ref]+@reactIvars[:cond]).include? gchild
822
+ @reactIvars[:pre] << gchild
823
+ @reactIvars[:post] << gchild
741
824
  end
742
825
  @reactIvars[:ref] << gchild
743
826
  @reactIvars[:asgn] << gchild
744
827
  end
745
828
 
746
- when :send
747
- if
829
+ when :send
830
+ if
748
831
  child and child.type == :self and node.children.length == 2 and
749
832
  node.children[1] == :componentWillReceiveProps
750
833
  then
@@ -757,7 +840,7 @@ module Ruby2JS
757
840
  def on_begin(node)
758
841
  node = super
759
842
  (node.children.length-2).downto(0) do |i|
760
- if
843
+ if
761
844
  node.children[i].type == :send and
762
845
  node.children[i].children[0] and
763
846
  node.children[i].children[0].type == :self and
@@ -38,9 +38,9 @@ module Ruby2JS
38
38
  filename.untaint
39
39
  end
40
40
 
41
- if not File.exist? filename and File.exist? filename+".rb"
41
+ if not File.file? filename and File.file? filename+".rb"
42
42
  filename += '.rb'
43
- elsif not File.exist? filename and File.exist? filename+".js.rb"
43
+ elsif not File.file? filename and File.file? filename+".js.rb"
44
44
  filename += '.js.rb'
45
45
  end
46
46
 
@@ -2,7 +2,7 @@ module Ruby2JS
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 2
4
4
  MINOR = 0
5
- TINY = 3
5
+ TINY = 4
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
data/ruby2js.gemspec CHANGED
@@ -2,23 +2,23 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = "ruby2js"
5
- s.version = "2.0.3"
5
+ s.version = "2.0.4"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Sam Ruby"]
9
- s.date = "2015-04-15"
9
+ s.date = "2015-04-20"
10
10
  s.description = " The base package maps Ruby syntax to JavaScript semantics.\n Filters may be provided to add Ruby-specific or framework specific\n behavior.\n"
11
11
  s.email = "rubys@intertwingly.net"
12
- s.files = ["ruby2js.gemspec", "README.md", "lib/ruby2js", "lib/ruby2js/cgi.rb", "lib/ruby2js/converter", "lib/ruby2js/converter/arg.rb", "lib/ruby2js/converter/args.rb", "lib/ruby2js/converter/array.rb", "lib/ruby2js/converter/begin.rb", "lib/ruby2js/converter/block.rb", "lib/ruby2js/converter/blockpass.rb", "lib/ruby2js/converter/boolean.rb", "lib/ruby2js/converter/break.rb", "lib/ruby2js/converter/case.rb", "lib/ruby2js/converter/casgn.rb", "lib/ruby2js/converter/class.rb", "lib/ruby2js/converter/const.rb", "lib/ruby2js/converter/cvar.rb", "lib/ruby2js/converter/cvasgn.rb", "lib/ruby2js/converter/def.rb", "lib/ruby2js/converter/defined.rb", "lib/ruby2js/converter/defs.rb", "lib/ruby2js/converter/dstr.rb", "lib/ruby2js/converter/for.rb", "lib/ruby2js/converter/hash.rb", "lib/ruby2js/converter/if.rb", "lib/ruby2js/converter/in.rb", "lib/ruby2js/converter/ivar.rb", "lib/ruby2js/converter/ivasgn.rb", "lib/ruby2js/converter/kwbegin.rb", "lib/ruby2js/converter/literal.rb", "lib/ruby2js/converter/logical.rb", "lib/ruby2js/converter/masgn.rb", "lib/ruby2js/converter/module.rb", "lib/ruby2js/converter/next.rb", "lib/ruby2js/converter/nil.rb", "lib/ruby2js/converter/nthref.rb", "lib/ruby2js/converter/opasgn.rb", "lib/ruby2js/converter/prototype.rb", "lib/ruby2js/converter/regexp.rb", "lib/ruby2js/converter/return.rb", "lib/ruby2js/converter/self.rb", "lib/ruby2js/converter/send.rb", "lib/ruby2js/converter/super.rb", "lib/ruby2js/converter/sym.rb", "lib/ruby2js/converter/undef.rb", "lib/ruby2js/converter/until.rb", "lib/ruby2js/converter/untilpost.rb", "lib/ruby2js/converter/var.rb", "lib/ruby2js/converter/vasgn.rb", "lib/ruby2js/converter/while.rb", "lib/ruby2js/converter/whilepost.rb", "lib/ruby2js/converter/xstr.rb", "lib/ruby2js/converter.rb", "lib/ruby2js/execjs.rb", "lib/ruby2js/filter", "lib/ruby2js/filter/angular-resource.rb", "lib/ruby2js/filter/angular-route.rb", "lib/ruby2js/filter/angularrb.rb", "lib/ruby2js/filter/camelCase.rb", "lib/ruby2js/filter/functions.rb", "lib/ruby2js/filter/jquery.rb", "lib/ruby2js/filter/minitest-jasmine.rb", "lib/ruby2js/filter/react.rb", "lib/ruby2js/filter/require.rb", "lib/ruby2js/filter/return.rb", "lib/ruby2js/filter/rubyjs.rb", "lib/ruby2js/filter/strict.rb", "lib/ruby2js/filter/underscore.rb", "lib/ruby2js/rails.rb", "lib/ruby2js/serializer.rb", "lib/ruby2js/sinatra.rb", "lib/ruby2js/version.rb", "lib/ruby2js.rb"]
12
+ s.files = ["ruby2js.gemspec", "README.md", "lib/ruby2js", "lib/ruby2js/execjs.rb", "lib/ruby2js/converter.rb", "lib/ruby2js/version.rb", "lib/ruby2js/filter", "lib/ruby2js/filter/jquery.rb", "lib/ruby2js/filter/return.rb", "lib/ruby2js/filter/underscore.rb", "lib/ruby2js/filter/require.rb", "lib/ruby2js/filter/angularrb.rb", "lib/ruby2js/filter/minitest-jasmine.rb", "lib/ruby2js/filter/camelCase.rb", "lib/ruby2js/filter/rubyjs.rb", "lib/ruby2js/filter/strict.rb", "lib/ruby2js/filter/functions.rb", "lib/ruby2js/filter/angular-resource.rb", "lib/ruby2js/filter/react.rb", "lib/ruby2js/filter/angular-route.rb", "lib/ruby2js/sinatra.rb", "lib/ruby2js/rails.rb", "lib/ruby2js/serializer.rb", "lib/ruby2js/cgi.rb", "lib/ruby2js/converter", "lib/ruby2js/converter/self.rb", "lib/ruby2js/converter/arg.rb", "lib/ruby2js/converter/dstr.rb", "lib/ruby2js/converter/xstr.rb", "lib/ruby2js/converter/sym.rb", "lib/ruby2js/converter/return.rb", "lib/ruby2js/converter/break.rb", "lib/ruby2js/converter/for.rb", "lib/ruby2js/converter/defined.rb", "lib/ruby2js/converter/cvasgn.rb", "lib/ruby2js/converter/whilepost.rb", "lib/ruby2js/converter/logical.rb", "lib/ruby2js/converter/in.rb", "lib/ruby2js/converter/args.rb", "lib/ruby2js/converter/def.rb", "lib/ruby2js/converter/prototype.rb", "lib/ruby2js/converter/class.rb", "lib/ruby2js/converter/nthref.rb", "lib/ruby2js/converter/opasgn.rb", "lib/ruby2js/converter/module.rb", "lib/ruby2js/converter/kwbegin.rb", "lib/ruby2js/converter/send.rb", "lib/ruby2js/converter/boolean.rb", "lib/ruby2js/converter/masgn.rb", "lib/ruby2js/converter/hash.rb", "lib/ruby2js/converter/cvar.rb", "lib/ruby2js/converter/ivasgn.rb", "lib/ruby2js/converter/case.rb", "lib/ruby2js/converter/const.rb", "lib/ruby2js/converter/vasgn.rb", "lib/ruby2js/converter/untilpost.rb", "lib/ruby2js/converter/begin.rb", "lib/ruby2js/converter/ivar.rb", "lib/ruby2js/converter/while.rb", "lib/ruby2js/converter/next.rb", "lib/ruby2js/converter/nil.rb", "lib/ruby2js/converter/blockpass.rb", "lib/ruby2js/converter/super.rb", "lib/ruby2js/converter/defs.rb", "lib/ruby2js/converter/array.rb", "lib/ruby2js/converter/block.rb", "lib/ruby2js/converter/if.rb", "lib/ruby2js/converter/until.rb", "lib/ruby2js/converter/regexp.rb", "lib/ruby2js/converter/casgn.rb", "lib/ruby2js/converter/undef.rb", "lib/ruby2js/converter/literal.rb", "lib/ruby2js/converter/var.rb", "lib/ruby2js.rb"]
13
13
  s.homepage = "http://github.com/rubys/ruby2js"
14
14
  s.licenses = ["MIT"]
15
15
  s.require_paths = ["lib"]
16
16
  s.required_ruby_version = Gem::Requirement.new(">= 1.9.3")
17
- s.rubygems_version = "2.0.14"
17
+ s.rubygems_version = "1.8.23.2"
18
18
  s.summary = "Minimal yet extensible Ruby to JavaScript conversion."
19
19
 
20
20
  if s.respond_to? :specification_version then
21
- s.specification_version = 4
21
+ s.specification_version = 3
22
22
 
23
23
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
24
24
  s.add_runtime_dependency(%q<parser>, [">= 0"])
metadata CHANGED
@@ -1,33 +1,34 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby2js
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ prerelease:
5
+ version: 2.0.4
5
6
  platform: ruby
6
7
  authors:
7
8
  - Sam Ruby
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2015-04-15 00:00:00.000000000 Z
12
+ date: 2015-04-20 00:00:00.000000000 Z
12
13
  dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
- name: parser
15
- requirement: !ruby/object:Gem::Requirement
15
+ version_requirements: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - ! '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
+ none: false
20
21
  type: :runtime
22
+ name: parser
21
23
  prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
24
+ requirement: !ruby/object:Gem::Requirement
23
25
  requirements:
24
- - - ">="
26
+ - - ! '>='
25
27
  - !ruby/object:Gem::Version
26
28
  version: '0'
27
- description: |2
28
- The base package maps Ruby syntax to JavaScript semantics.
29
- Filters may be provided to add Ruby-specific or framework specific
30
- behavior.
29
+ none: false
30
+ description: ! " The base package maps Ruby syntax to JavaScript semantics.\n Filters
31
+ may be provided to add Ruby-specific or framework specific\n behavior.\n"
31
32
  email: rubys@intertwingly.net
32
33
  executables: []
33
34
  extensions: []
@@ -35,97 +36,98 @@ extra_rdoc_files: []
35
36
  files:
36
37
  - ruby2js.gemspec
37
38
  - README.md
39
+ - lib/ruby2js/execjs.rb
40
+ - lib/ruby2js/converter.rb
41
+ - lib/ruby2js/version.rb
42
+ - lib/ruby2js/filter/jquery.rb
43
+ - lib/ruby2js/filter/return.rb
44
+ - lib/ruby2js/filter/underscore.rb
45
+ - lib/ruby2js/filter/require.rb
46
+ - lib/ruby2js/filter/angularrb.rb
47
+ - lib/ruby2js/filter/minitest-jasmine.rb
48
+ - lib/ruby2js/filter/camelCase.rb
49
+ - lib/ruby2js/filter/rubyjs.rb
50
+ - lib/ruby2js/filter/strict.rb
51
+ - lib/ruby2js/filter/functions.rb
52
+ - lib/ruby2js/filter/angular-resource.rb
53
+ - lib/ruby2js/filter/react.rb
54
+ - lib/ruby2js/filter/angular-route.rb
55
+ - lib/ruby2js/sinatra.rb
56
+ - lib/ruby2js/rails.rb
57
+ - lib/ruby2js/serializer.rb
38
58
  - lib/ruby2js/cgi.rb
59
+ - lib/ruby2js/converter/self.rb
39
60
  - lib/ruby2js/converter/arg.rb
40
- - lib/ruby2js/converter/args.rb
41
- - lib/ruby2js/converter/array.rb
42
- - lib/ruby2js/converter/begin.rb
43
- - lib/ruby2js/converter/block.rb
44
- - lib/ruby2js/converter/blockpass.rb
45
- - lib/ruby2js/converter/boolean.rb
46
- - lib/ruby2js/converter/break.rb
47
- - lib/ruby2js/converter/case.rb
48
- - lib/ruby2js/converter/casgn.rb
49
- - lib/ruby2js/converter/class.rb
50
- - lib/ruby2js/converter/const.rb
51
- - lib/ruby2js/converter/cvar.rb
52
- - lib/ruby2js/converter/cvasgn.rb
53
- - lib/ruby2js/converter/def.rb
54
- - lib/ruby2js/converter/defined.rb
55
- - lib/ruby2js/converter/defs.rb
56
61
  - lib/ruby2js/converter/dstr.rb
62
+ - lib/ruby2js/converter/xstr.rb
63
+ - lib/ruby2js/converter/sym.rb
64
+ - lib/ruby2js/converter/return.rb
65
+ - lib/ruby2js/converter/break.rb
57
66
  - lib/ruby2js/converter/for.rb
58
- - lib/ruby2js/converter/hash.rb
59
- - lib/ruby2js/converter/if.rb
67
+ - lib/ruby2js/converter/defined.rb
68
+ - lib/ruby2js/converter/cvasgn.rb
69
+ - lib/ruby2js/converter/whilepost.rb
70
+ - lib/ruby2js/converter/logical.rb
60
71
  - lib/ruby2js/converter/in.rb
61
- - lib/ruby2js/converter/ivar.rb
62
- - lib/ruby2js/converter/ivasgn.rb
72
+ - lib/ruby2js/converter/args.rb
73
+ - lib/ruby2js/converter/def.rb
74
+ - lib/ruby2js/converter/prototype.rb
75
+ - lib/ruby2js/converter/class.rb
76
+ - lib/ruby2js/converter/nthref.rb
77
+ - lib/ruby2js/converter/opasgn.rb
78
+ - lib/ruby2js/converter/module.rb
63
79
  - lib/ruby2js/converter/kwbegin.rb
64
- - lib/ruby2js/converter/literal.rb
65
- - lib/ruby2js/converter/logical.rb
80
+ - lib/ruby2js/converter/send.rb
81
+ - lib/ruby2js/converter/boolean.rb
66
82
  - lib/ruby2js/converter/masgn.rb
67
- - lib/ruby2js/converter/module.rb
83
+ - lib/ruby2js/converter/hash.rb
84
+ - lib/ruby2js/converter/cvar.rb
85
+ - lib/ruby2js/converter/ivasgn.rb
86
+ - lib/ruby2js/converter/case.rb
87
+ - lib/ruby2js/converter/const.rb
88
+ - lib/ruby2js/converter/vasgn.rb
89
+ - lib/ruby2js/converter/untilpost.rb
90
+ - lib/ruby2js/converter/begin.rb
91
+ - lib/ruby2js/converter/ivar.rb
92
+ - lib/ruby2js/converter/while.rb
68
93
  - lib/ruby2js/converter/next.rb
69
94
  - lib/ruby2js/converter/nil.rb
70
- - lib/ruby2js/converter/nthref.rb
71
- - lib/ruby2js/converter/opasgn.rb
72
- - lib/ruby2js/converter/prototype.rb
73
- - lib/ruby2js/converter/regexp.rb
74
- - lib/ruby2js/converter/return.rb
75
- - lib/ruby2js/converter/self.rb
76
- - lib/ruby2js/converter/send.rb
95
+ - lib/ruby2js/converter/blockpass.rb
77
96
  - lib/ruby2js/converter/super.rb
78
- - lib/ruby2js/converter/sym.rb
79
- - lib/ruby2js/converter/undef.rb
97
+ - lib/ruby2js/converter/defs.rb
98
+ - lib/ruby2js/converter/array.rb
99
+ - lib/ruby2js/converter/block.rb
100
+ - lib/ruby2js/converter/if.rb
80
101
  - lib/ruby2js/converter/until.rb
81
- - lib/ruby2js/converter/untilpost.rb
102
+ - lib/ruby2js/converter/regexp.rb
103
+ - lib/ruby2js/converter/casgn.rb
104
+ - lib/ruby2js/converter/undef.rb
105
+ - lib/ruby2js/converter/literal.rb
82
106
  - lib/ruby2js/converter/var.rb
83
- - lib/ruby2js/converter/vasgn.rb
84
- - lib/ruby2js/converter/while.rb
85
- - lib/ruby2js/converter/whilepost.rb
86
- - lib/ruby2js/converter/xstr.rb
87
- - lib/ruby2js/converter.rb
88
- - lib/ruby2js/execjs.rb
89
- - lib/ruby2js/filter/angular-resource.rb
90
- - lib/ruby2js/filter/angular-route.rb
91
- - lib/ruby2js/filter/angularrb.rb
92
- - lib/ruby2js/filter/camelCase.rb
93
- - lib/ruby2js/filter/functions.rb
94
- - lib/ruby2js/filter/jquery.rb
95
- - lib/ruby2js/filter/minitest-jasmine.rb
96
- - lib/ruby2js/filter/react.rb
97
- - lib/ruby2js/filter/require.rb
98
- - lib/ruby2js/filter/return.rb
99
- - lib/ruby2js/filter/rubyjs.rb
100
- - lib/ruby2js/filter/strict.rb
101
- - lib/ruby2js/filter/underscore.rb
102
- - lib/ruby2js/rails.rb
103
- - lib/ruby2js/serializer.rb
104
- - lib/ruby2js/sinatra.rb
105
- - lib/ruby2js/version.rb
106
107
  - lib/ruby2js.rb
107
108
  homepage: http://github.com/rubys/ruby2js
108
109
  licenses:
109
110
  - MIT
110
- metadata: {}
111
111
  post_install_message:
112
112
  rdoc_options: []
113
113
  require_paths:
114
114
  - lib
115
115
  required_ruby_version: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - ">="
117
+ - - ! '>='
118
118
  - !ruby/object:Gem::Version
119
119
  version: 1.9.3
120
+ none: false
120
121
  required_rubygems_version: !ruby/object:Gem::Requirement
121
122
  requirements:
122
- - - ">="
123
+ - - ! '>='
123
124
  - !ruby/object:Gem::Version
124
125
  version: '0'
126
+ none: false
125
127
  requirements: []
126
128
  rubyforge_project:
127
- rubygems_version: 2.0.14
129
+ rubygems_version: 1.8.23.2
128
130
  signing_key:
129
- specification_version: 4
131
+ specification_version: 3
130
132
  summary: Minimal yet extensible Ruby to JavaScript conversion.
131
133
  test_files: []
checksums.yaml DELETED
@@ -1,7 +0,0 @@
1
- ---
2
- SHA1:
3
- metadata.gz: 41b51a0b8a9e699a3940a9266d6ed450865c5d25
4
- data.tar.gz: 9b8169f14d942efc013c22880fbc6999b3777197
5
- SHA512:
6
- metadata.gz: f22fa0762024fe374b7e57cac75114b58b0f9d26d6dd62a7da0ffa336c4f0fec738521579c136c328d10cdecee392ae78f36e4c7ad3b721ba88940ef2b500c7c
7
- data.tar.gz: a104f444d257a72652349a8de2ab0c2cb3d816c922707a3450f90fffb77179aeeea3c5e2b2fbbe379c62297a3311b1b5b863984cda8ca9298c255694cc7f7d2b