reactive-ruby 0.7.10 → 0.7.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/example/rails-tutorial/Gemfile.lock +2 -3
- data/example/rails-tutorial/app/controllers/home_controller.rb +1 -1
- data/example/rails-tutorial/app/views/components/home/show.rb +2 -6
- data/example/sinatra-tutorial/Gemfile.lock +1 -55
- data/example/sinatra-tutorial/_comments.json +4 -0
- data/lib/reactive-ruby/component.rb +2 -7
- data/lib/reactive-ruby/rendering_context.rb +2 -9
- data/lib/reactive-ruby/top_level.rb +1 -1
- data/lib/reactive-ruby/validator.rb +1 -5
- data/lib/reactive-ruby/version.rb +1 -1
- data/reactive-ruby.gemspec +1 -4
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d90d95c4a92f539fb4c4e6a459b6bcaae16134e
|
4
|
+
data.tar.gz: 43f28f80cd03d5b30513613508517f1e9455fd27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b76e2d32877d1610ef236541747ec088c60b0a7a86d5ef3f9bdab946fb4be86d407a7dd17bde638430d12e12d186a7f9945287795d6848d37885597d47623d8c
|
7
|
+
data.tar.gz: 5548a29283502e972e75d19b399740a1a842466587ece29aae8e4039683ec7a893caa3c42c191192074efcfeaaa534f09d963041aed489e34094bfb269e24d83
|
data/README.md
CHANGED
@@ -29,7 +29,11 @@ gem 'reactive-ruby'
|
|
29
29
|
|
30
30
|
gem 'therubyracer', platforms: :ruby # you need this for prerendering to work
|
31
31
|
gem 'react-rails', git: "https://github.com/catprintlabs/react-rails.git", :branch => 'isomorphic-methods-support'
|
32
|
-
gem 'opal-rails'
|
32
|
+
gem 'opal-rails'
|
33
|
+
|
34
|
+
# if you are planning on using jQuery don't forget to include it
|
35
|
+
|
36
|
+
gem 'jquery-rails'
|
33
37
|
```
|
34
38
|
|
35
39
|
Your react components will go into the `app/views/components/` directory of your rails app.
|
@@ -94,7 +98,7 @@ module Components
|
|
94
98
|
end
|
95
99
|
```
|
96
100
|
|
97
|
-
Components work just like views so put this in your home controller
|
101
|
+
Components work just like views so put this in your home controller
|
98
102
|
```ruby
|
99
103
|
# controllers/home_controller.rb
|
100
104
|
class HomeController < ApplicationController
|
@@ -13,8 +13,7 @@ GIT
|
|
13
13
|
PATH
|
14
14
|
remote: ../..
|
15
15
|
specs:
|
16
|
-
reactive-ruby (0.7.
|
17
|
-
jquery-rails
|
16
|
+
reactive-ruby (0.7.11)
|
18
17
|
opal
|
19
18
|
opal-activesupport
|
20
19
|
opal-browser
|
@@ -148,7 +147,7 @@ GEM
|
|
148
147
|
rake (10.4.2)
|
149
148
|
rdoc (4.2.0)
|
150
149
|
ref (2.0.0)
|
151
|
-
sass (3.4.
|
150
|
+
sass (3.4.18)
|
152
151
|
sass-rails (5.0.3)
|
153
152
|
railties (>= 4.0.0, < 5.0)
|
154
153
|
sass (~> 3.1)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# controllers/home_controller.rb
|
2
2
|
class HomeController < ApplicationController
|
3
3
|
def show
|
4
|
-
render_component say_hello_to: params[:say_hello_to] # by default render_component will use the controller name to find the appropriate component
|
4
|
+
render_component "Show", say_hello_to: params[:say_hello_to] # by default render_component will use the controller name to find the appropriate component
|
5
5
|
end
|
6
6
|
end
|
@@ -5,18 +5,14 @@ module Components
|
|
5
5
|
module Home
|
6
6
|
|
7
7
|
class Show
|
8
|
-
|
8
|
+
|
9
9
|
include React::Component # will create a new component named Show
|
10
10
|
|
11
11
|
optional_param :say_hello_to
|
12
|
-
|
13
|
-
backtrace :on
|
14
12
|
|
15
13
|
def render
|
16
14
|
puts "Rendering my first component!"
|
17
|
-
|
18
|
-
txt "hello #{'there '+say_hello_to if say_hello_to}" # render "hello" with optional 'there ...'
|
19
|
-
end
|
15
|
+
"hello #{'there '+say_hello_to if say_hello_to}" # render "hello" with optional 'there ...'
|
20
16
|
end
|
21
17
|
|
22
18
|
end
|
@@ -1,8 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
reactive-ruby (0.7.
|
5
|
-
jquery-rails
|
4
|
+
reactive-ruby (0.7.11)
|
6
5
|
opal
|
7
6
|
opal-activesupport
|
8
7
|
opal-browser
|
@@ -10,40 +9,7 @@ PATH
|
|
10
9
|
GEM
|
11
10
|
remote: https://rubygems.org/
|
12
11
|
specs:
|
13
|
-
actionpack (4.2.3)
|
14
|
-
actionview (= 4.2.3)
|
15
|
-
activesupport (= 4.2.3)
|
16
|
-
rack (~> 1.6)
|
17
|
-
rack-test (~> 0.6.2)
|
18
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
19
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
20
|
-
actionview (4.2.3)
|
21
|
-
activesupport (= 4.2.3)
|
22
|
-
builder (~> 3.1)
|
23
|
-
erubis (~> 2.7.0)
|
24
|
-
rails-dom-testing (~> 1.0, >= 1.0.5)
|
25
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
26
|
-
activesupport (4.2.3)
|
27
|
-
i18n (~> 0.7)
|
28
|
-
json (~> 1.7, >= 1.7.7)
|
29
|
-
minitest (~> 5.1)
|
30
|
-
thread_safe (~> 0.3, >= 0.3.4)
|
31
|
-
tzinfo (~> 1.1)
|
32
|
-
builder (3.2.2)
|
33
|
-
erubis (2.7.0)
|
34
12
|
hike (1.2.3)
|
35
|
-
i18n (0.7.0)
|
36
|
-
jquery-rails (4.0.4)
|
37
|
-
rails-dom-testing (~> 1.0)
|
38
|
-
railties (>= 4.2.0)
|
39
|
-
thor (>= 0.14, < 2.0)
|
40
|
-
json (1.8.3)
|
41
|
-
loofah (2.0.3)
|
42
|
-
nokogiri (>= 1.5.9)
|
43
|
-
mini_portile (0.6.2)
|
44
|
-
minitest (5.8.0)
|
45
|
-
nokogiri (1.6.6.2)
|
46
|
-
mini_portile (~> 0.6.0)
|
47
13
|
opal (0.8.0)
|
48
14
|
hike (~> 1.2)
|
49
15
|
sourcemap (~> 0.1.0)
|
@@ -60,22 +26,6 @@ GEM
|
|
60
26
|
rack (1.6.4)
|
61
27
|
rack-protection (1.5.3)
|
62
28
|
rack
|
63
|
-
rack-test (0.6.3)
|
64
|
-
rack (>= 1.0)
|
65
|
-
rails-deprecated_sanitizer (1.0.3)
|
66
|
-
activesupport (>= 4.2.0.alpha)
|
67
|
-
rails-dom-testing (1.0.7)
|
68
|
-
activesupport (>= 4.2.0.beta, < 5.0)
|
69
|
-
nokogiri (~> 1.6.0)
|
70
|
-
rails-deprecated_sanitizer (>= 1.0.1)
|
71
|
-
rails-html-sanitizer (1.0.2)
|
72
|
-
loofah (~> 2.0)
|
73
|
-
railties (4.2.3)
|
74
|
-
actionpack (= 4.2.3)
|
75
|
-
activesupport (= 4.2.3)
|
76
|
-
rake (>= 0.8.7)
|
77
|
-
thor (>= 0.18.1, < 2.0)
|
78
|
-
rake (10.4.2)
|
79
29
|
sinatra (1.4.6)
|
80
30
|
rack (~> 1.4)
|
81
31
|
rack-protection (~> 1.4)
|
@@ -83,11 +33,7 @@ GEM
|
|
83
33
|
sourcemap (0.1.1)
|
84
34
|
sprockets (3.3.3)
|
85
35
|
rack (~> 1.0)
|
86
|
-
thor (0.19.1)
|
87
|
-
thread_safe (0.3.5)
|
88
36
|
tilt (2.0.1)
|
89
|
-
tzinfo (1.2.2)
|
90
|
-
thread_safe (~> 0.1)
|
91
37
|
|
92
38
|
PLATFORMS
|
93
39
|
ruby
|
@@ -298,11 +298,6 @@ module React
|
|
298
298
|
define_param_method(name, options[:type])
|
299
299
|
end
|
300
300
|
|
301
|
-
def other_params(name)
|
302
|
-
validator.accepts_others
|
303
|
-
define_method("#{name}") { params }
|
304
|
-
end
|
305
|
-
|
306
301
|
def define_state(*states, &block)
|
307
302
|
default_initial_value = (block and block.arity == 0) ? yield : nil
|
308
303
|
states_hash = (states.last.is_a? Hash) ? states.pop : {}
|
@@ -369,9 +364,9 @@ module React
|
|
369
364
|
end
|
370
365
|
|
371
366
|
module API
|
372
|
-
include Native
|
367
|
+
#include Native
|
373
368
|
|
374
|
-
|
369
|
+
alias_native :dom_node, :getDOMNode
|
375
370
|
alias_native :mounted?, :isMounted
|
376
371
|
alias_native :force_update!, :forceUpdate
|
377
372
|
|
@@ -8,9 +8,7 @@ module React
|
|
8
8
|
|
9
9
|
def self.render(name, *args, &block)
|
10
10
|
@buffer = [] unless @buffer
|
11
|
-
if
|
12
|
-
element = args[0]
|
13
|
-
elsif block
|
11
|
+
if block
|
14
12
|
element = build do
|
15
13
|
saved_waiting_on_resources = waiting_on_resources
|
16
14
|
self.waiting_on_resources = nil
|
@@ -25,7 +23,7 @@ module React
|
|
25
23
|
raise "a components render method must generate and return exactly 1 element or a string"
|
26
24
|
end
|
27
25
|
|
28
|
-
@buffer << result.to_s if
|
26
|
+
@buffer << result.to_s if result.is_a? String or (result.respond_to? :acts_as_string? and result.acts_as_string?) # For convience we push the last return value on if its a string
|
29
27
|
@buffer << result if result.is_a? Element and @buffer.count == 0
|
30
28
|
if name
|
31
29
|
buffer = @buffer.dup
|
@@ -83,11 +81,6 @@ module React
|
|
83
81
|
end
|
84
82
|
end
|
85
83
|
|
86
|
-
def txt(*args)
|
87
|
-
return self.method_missing('txt', *args) if self.is_a? React::Component
|
88
|
-
React::RenderingContext.render("txt", self.to_s)
|
89
|
-
end
|
90
|
-
|
91
84
|
def br
|
92
85
|
return self.method_missing(*["br"]) if self.is_a? React::Component
|
93
86
|
React::RenderingContext.render("span") { React::RenderingContext.render(self.to_s); React::RenderingContext.render("br") }
|
@@ -10,7 +10,7 @@ module React
|
|
10
10
|
main map mark menu menuitem meta meter nav noscript object ol optgroup option
|
11
11
|
output p param picture pre progress q rp rt ruby s samp script section select
|
12
12
|
small source span strong style sub summary sup table tbody td textarea tfoot th
|
13
|
-
thead time title tr track u ul var video wbr
|
13
|
+
thead time title tr track u ul var video wbr)
|
14
14
|
ATTRIBUTES = %w(accept acceptCharset accessKey action allowFullScreen allowTransparency alt
|
15
15
|
async autoComplete autoPlay cellPadding cellSpacing charSet checked classID
|
16
16
|
className cols colSpan content contentEditable contextMenu controls coords
|
@@ -26,10 +26,6 @@ module React
|
|
26
26
|
@rules[prop_name] = options
|
27
27
|
end
|
28
28
|
|
29
|
-
def accepts_others
|
30
|
-
@accepts_others = true
|
31
|
-
end
|
32
|
-
|
33
29
|
def type_check(errors, error_prefix, object, klass)
|
34
30
|
is_native = !object.respond_to?(:is_a?) rescue true
|
35
31
|
if is_native or !object.is_a? klass
|
@@ -42,7 +38,7 @@ module React
|
|
42
38
|
def validate(props)
|
43
39
|
errors = []
|
44
40
|
props.keys.each do |prop_name|
|
45
|
-
errors << "Provided prop `#{prop_name}` not specified in spec" if @rules[prop_name] == nil
|
41
|
+
errors << "Provided prop `#{prop_name}` not specified in spec" if @rules[prop_name] == nil
|
46
42
|
end
|
47
43
|
|
48
44
|
props = props.select {|key| @rules.keys.include?(key) }
|
data/reactive-ruby.gemspec
CHANGED
@@ -18,12 +18,9 @@ Gem::Specification.new do |s|
|
|
18
18
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
19
|
s.require_paths = ['lib', 'vendor']
|
20
20
|
|
21
|
-
s.add_runtime_dependency 'opal'
|
21
|
+
s.add_runtime_dependency 'opal'
|
22
22
|
s.add_runtime_dependency 'opal-activesupport'
|
23
|
-
s.add_runtime_dependency 'jquery-rails'
|
24
|
-
#s.add_runtime_dependency 'opal-jquery'
|
25
23
|
s.add_runtime_dependency 'opal-browser'
|
26
|
-
#s.add_runtime_dependency 'react-source', '~> 0.12'
|
27
24
|
s.add_development_dependency 'opal-rspec'
|
28
25
|
s.add_development_dependency 'sinatra'
|
29
26
|
end
|
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.
|
4
|
+
version: 0.7.11
|
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-08-
|
11
|
+
date: 2015-08-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -38,20 +38,6 @@ dependencies:
|
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: jquery-rails
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - ">="
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - ">="
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
41
|
- !ruby/object:Gem::Dependency
|
56
42
|
name: opal-browser
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|