reactive-ruby 0.7.34 → 0.7.35

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6c55ecaccf2f1aa02991631d35faff6457449212
4
- data.tar.gz: 4c28f571ca9a7fdae271866f13b6f7e310c7b6a5
3
+ metadata.gz: 05ae08f2b56a80908ec8567ccc3357293ab2c7bc
4
+ data.tar.gz: de11dd05910b4caed3bc5f2b2176b3884f6db348
5
5
  SHA512:
6
- metadata.gz: 08a20f1549e946d19ea82dc3785f72ecfa8e249ad031728ae7e672d8a40f102b53c9138c69e285ae09eed5ba2bef372a71c701c720b80d4ef7a36e41769531dc
7
- data.tar.gz: 40638518e753f5a03e1f20848d4aa2586fb5f02dcdce3e8eab500c68e48d2099e92b3b12295bf36c6ea696910af122ede99b41ae08d47d1c4ff8337fbd5d1dfc
6
+ metadata.gz: 538f69788b50ced92007ee30f819ddaf1696ce01c61ade058134a7ab36874da6d6de5c354b88849a69d4a7c0634603b1b45163e89e77898acb303f6b567cb6ec
7
+ data.tar.gz: f9ea8686c375fb3f52e202e2bb3c1c9579336f3ae13d5260795bd479699da39361de9373d34d80a6419a523cb3c6b6ef5627c8e5f3392fa51b08086a08e61ad7
data/README.md CHANGED
@@ -3,6 +3,7 @@
3
3
  [![Join the chat at https://gitter.im/zetachang/react.rb](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/zetachang/react.rb?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
4
  [![Build Status](https://travis-ci.org/zetachang/react.rb.svg)](https://travis-ci.org/zetachang/react.rb)
5
5
  [![Code Climate](https://codeclimate.com/github/zetachang/react.rb/badges/gpa.svg)](https://codeclimate.com/github/zetachang/react.rb)
6
+ [![Gem Version](https://badge.fury.io/rb/reactive-ruby.svg)](https://badge.fury.io/rb/reactive-ruby)
6
7
 
7
8
  **React.rb is an [Opal Ruby](http://opalrb.org) wrapper of
8
9
  [React.js library](http://facebook.github.io/react/)**.
@@ -44,7 +44,7 @@ module React
44
44
  unless name && name.method_defined?(:render)
45
45
  return super
46
46
  end
47
- RenderingContext.build_or_render(node_only, name, *args, &block)
47
+ React::RenderingContext.build_or_render(node_only, name, *args, &block)
48
48
  end
49
49
  end
50
50
  end
@@ -241,7 +241,7 @@ module React
241
241
  name = "p"
242
242
  end
243
243
 
244
- RenderingContext.build_or_render(node_only, name, *args, &block)
244
+ React::RenderingContext.build_or_render(node_only, name, *args, &block)
245
245
  end
246
246
 
247
247
  def watch(value, &on_change)
@@ -256,7 +256,7 @@ module React
256
256
 
257
257
  def _render_wrapper
258
258
  State.set_state_context_to(self) do
259
- RenderingContext.render(nil) {render || ""}.tap { |element| @waiting_on_resources = element.waiting_on_resources if element.respond_to? :waiting_on_resources }
259
+ React::RenderingContext.render(nil) {render || ""}.tap { |element| @waiting_on_resources = element.waiting_on_resources if element.respond_to? :waiting_on_resources }
260
260
  end
261
261
  rescue Exception => e
262
262
  self.class.process_exception(e, self)
@@ -98,6 +98,11 @@ module React
98
98
  define_method(name) do
99
99
  @_all_others ||= self.class.validator.undefined_props(props)
100
100
  end
101
+
102
+ validator_in_lexial_scope = validator
103
+ props_wrapper.define_method(name) do
104
+ @_all_others ||= validator_in_lexial_scope.undefined_props(props)
105
+ end
101
106
  end
102
107
 
103
108
  def define_state(*states, &block)
data/lib/react/element.rb CHANGED
@@ -60,18 +60,18 @@ module React
60
60
  new_props = properties.dup
61
61
  new_props["class"] = "#{new_props['class']} #{class_name} #{args.delete("class")} #{args.delete('className')}".split(" ").uniq.join(" ")
62
62
  new_props.merge! args
63
- RenderingContext.replace(
63
+ React::RenderingContext.replace(
64
64
  self,
65
65
  React::RenderingContext.build { React::RenderingContext.render(type, new_props, &new_block) }
66
66
  )
67
67
  end
68
68
 
69
69
  def as_node
70
- RenderingContext.as_node(self)
70
+ React::RenderingContext.as_node(self)
71
71
  end
72
72
 
73
73
  def delete
74
- RenderingContext.delete(self)
74
+ React::RenderingContext.delete(self)
75
75
  end
76
76
  end
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module React
2
- VERSION = "0.7.34"
2
+ VERSION = "0.7.35"
3
3
  end
@@ -0,0 +1,8 @@
1
+
2
+ For example assuming you are releasing fix to 0.8.18
3
+
4
+ 1. Checkout 0-8-stable
5
+ 2. Update tests, fix the bug and commit the changes.
6
+ 3. Build & Release to RubyGems (Remember the version in version.rb should already be 0.8.19)
7
+ 4. Create a tag 'v0.8.19' pointing to that commit.
8
+ 5. Bump the version in 0-8-stable to 0.8.20 so it will be ready for the next patch level release.
@@ -9,7 +9,7 @@ Gem::Specification.new do |s|
9
9
 
10
10
  s.author = 'David Chang'
11
11
  s.email = 'zeta11235813@gmail.com'
12
- s.homepage = 'https://reactive-ruby.github.io'
12
+ s.homepage = 'https://reactrb.org'
13
13
  s.summary = 'Opal Ruby wrapper of React.js library.'
14
14
  s.license = 'MIT'
15
15
  s.description = "Write React UI components in pure Ruby."
@@ -2,15 +2,137 @@ require 'spec_helper'
2
2
 
3
3
  if opal?
4
4
  describe 'the React DSL' do
5
- it "will treat the component class name as a first class component name" # Foo()
6
- it "can add class names by the haml .class notation" # Foo.my_class
7
- it "can use the 'class' keyword for classes" # Foo(class: "my-class")
8
- it "will turn the last string in a block into a span" # Foo { "hello there" }
9
- it "has a .span short hand String method" # "hello there".span
10
- it "has a .br short hand String method"
11
- it "has a .td short hand String method"
12
- it "has a .para short hand String method"
13
- it "can generate a unrendered node using the .as_node method" # div { "hello" }.as_node
14
- it "can use the dangerously_set_inner_HTML param" # div { dangerously_set_inner_HTML: "<div>danger</div>" }
5
+
6
+ it "will turn the last string in a block into a element" do
7
+ stub_const 'Foo', Class.new
8
+ Foo.class_eval do
9
+ include React::Component
10
+ def render
11
+ div { "hello" }
12
+ end
13
+ end
14
+
15
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div>hello</div>')
16
+ end
17
+
18
+ it "has a .span short hand String method" do
19
+ stub_const 'Foo', Class.new
20
+ Foo.class_eval do
21
+ include React::Component
22
+ def render
23
+ div { "hello".span; "goodby".span }
24
+ end
25
+ end
26
+
27
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div><span>hello</span><span>goodby</span></div>')
28
+ end
29
+
30
+ it "has a .br short hand String method" do
31
+ stub_const 'Foo', Class.new
32
+ Foo.class_eval do
33
+ include React::Component
34
+ def render
35
+ div { "hello".br }
36
+ end
37
+ end
38
+
39
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div><span>hello<br></span></div>')
40
+ end
41
+
42
+ it "has a .td short hand String method" do
43
+ stub_const 'Foo', Class.new
44
+ Foo.class_eval do
45
+ include React::Component
46
+ def render
47
+ table { tr { "hello".td } }
48
+ end
49
+ end
50
+
51
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<table><tr><td>hello</td></tr></table>')
52
+ end
53
+
54
+ it "has a .para short hand String method" do
55
+ stub_const 'Foo', Class.new
56
+ Foo.class_eval do
57
+ include React::Component
58
+ def render
59
+ div { "hello".para }
60
+ end
61
+ end
62
+
63
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div><p>hello</p></div>')
64
+ end
65
+
66
+ it "will treat the component class name as a first class component name" do
67
+ stub_const 'Mod::Bar', Class.new
68
+ Mod::Bar.class_eval do
69
+ include React::Component
70
+ def render
71
+ "a man walks into a bar"
72
+ end
73
+ end
74
+ stub_const 'Foo', Class.new(React::Component::Base)
75
+ Foo.class_eval do
76
+ def render
77
+ Mod::Bar()
78
+ end
79
+ end
80
+
81
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<span>a man walks into a bar</span>')
82
+ end
83
+
84
+ it "can add class names by the haml .class notation" do
85
+ stub_const 'Mod::Bar', Class.new(React::Component::Base)
86
+ Mod::Bar.class_eval do
87
+ collect_other_params_as :attributes
88
+ def render
89
+ "a man walks into a bar".span(attributes)
90
+ end
91
+ end
92
+ stub_const 'Foo', Class.new(React::Component::Base)
93
+ Foo.class_eval do
94
+ def render
95
+ Mod::Bar().the_class
96
+ end
97
+ end
98
+
99
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<span class="the-class">a man walks into a bar</span>')
100
+ end
101
+
102
+ it "can use the 'class' keyword for classes" do
103
+ stub_const 'Foo', Class.new
104
+ Foo.class_eval do
105
+ include React::Component
106
+ def render
107
+ span(class: "the-class") { "hello" }
108
+ end
109
+ end
110
+
111
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<span class="the-class">hello</span>')
112
+ end
113
+
114
+ it "can generate a unrendered node using the .as_node method" do # div { "hello" }.as_node
115
+ stub_const 'Foo', Class.new #(React::Component::Base)
116
+ Foo.class_eval do
117
+ include React::Component
118
+ def render
119
+ span { "hello".span.as_node.class.name }.as_node.render
120
+ end
121
+ end
122
+
123
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<span>React::Element</span>')
124
+ end
125
+
126
+ it "can use the dangerously_set_inner_HTML param" do
127
+ stub_const 'Foo', Class.new
128
+ Foo.class_eval do
129
+ include React::Component
130
+ def render
131
+ div(dangerously_set_inner_HTML: { __html: "Hello&nbsp;&nbsp;Goodby" })
132
+ end
133
+ end
134
+
135
+ expect(React.render_to_static_markup(React.create_element(Foo))).to eq('<div>Hello&nbsp;&nbsp;Goodby</div>')
136
+ end
15
137
  end
16
138
  end
@@ -2,6 +2,34 @@ require 'spec_helper'
2
2
 
3
3
  if opal?
4
4
  describe 'the param macro' do
5
+ it 'defines collect_other_params_as method on params proxy' do
6
+ stub_const 'Foo', Class.new(React::Component::Base)
7
+ Foo.class_eval do
8
+ collect_other_params_as :foo
9
+
10
+ def render
11
+ div { params.foo[:bar] }
12
+ end
13
+ end
14
+
15
+ html = React.render_to_static_markup(React.create_element(Foo, { bar: 'biz' }))
16
+ expect(html).to eq('<div>biz</div>')
17
+ end
18
+
19
+ it 'still defines deprecated collect_other_params_as method' do
20
+ stub_const 'Foo', Class.new(React::Component::Base)
21
+ Foo.class_eval do
22
+ collect_other_params_as :foo
23
+
24
+ def render
25
+ div { foo[:bar] }
26
+ end
27
+ end
28
+
29
+ html = React.render_to_static_markup(React.create_element(Foo, { bar: 'biz' }))
30
+ expect(html).to eq('<div>biz</div>')
31
+ end
32
+
5
33
  it 'still defines deprecated param accessor method' do
6
34
  stub_const 'Foo', Class.new(React::Component::Base)
7
35
  Foo.class_eval do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reactive-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.34
4
+ version: 0.7.35
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Chang
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-14 00:00:00.000000000 Z
11
+ date: 2015-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal
@@ -344,6 +344,7 @@ files:
344
344
  - logo1.png
345
345
  - logo2.png
346
346
  - logo3.png
347
+ - path_release_steps.md
347
348
  - reactive-ruby.gemspec
348
349
  - spec/controller_helper_spec.rb
349
350
  - spec/index.html.erb
@@ -368,7 +369,7 @@ files:
368
369
  - spec/spec_helper.rb
369
370
  - spec/support/react/spec_helpers.rb
370
371
  - spec/vendor/es5-shim.min.js
371
- homepage: https://reactive-ruby.github.io
372
+ homepage: https://reactrb.org
372
373
  licenses:
373
374
  - MIT
374
375
  metadata: {}