react.rb 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/Gemfile.lock +16 -13
- data/README.md +4 -1
- data/{example → examples}/basic-jsx/Gemfile +0 -0
- data/{example → examples}/basic-jsx/Gemfile.lock +20 -17
- data/examples/basic-jsx/config.ru +10 -0
- data/{example → examples}/basic-jsx/example.jsx.rb +0 -0
- data/examples/basic-jsx/index.html.erb +11 -0
- data/{example → examples}/react-tutorial/Gemfile +0 -0
- data/{example → examples}/react-tutorial/Gemfile.lock +19 -16
- data/{example → examples}/react-tutorial/README.md +0 -0
- data/{example → examples}/react-tutorial/_comments.json +0 -0
- data/{example → examples}/react-tutorial/config.ru +4 -19
- data/{example → examples}/react-tutorial/example.rb +0 -0
- data/examples/react-tutorial/index.html.erb +14 -0
- data/{example → examples}/react-tutorial/public/base.css +0 -0
- data/examples/todos/Gemfile +6 -0
- data/examples/todos/Gemfile.lock +65 -0
- data/{example → examples}/todos/README.md +0 -0
- data/{example → examples}/todos/Rakefile +0 -0
- data/{example → examples}/todos/app/application.rb +1 -2
- data/{example → examples}/todos/app/components/app.react.rb +0 -0
- data/{example → examples}/todos/app/components/footer.react.rb +0 -0
- data/{example → examples}/todos/app/components/todo_item.react.rb +2 -1
- data/{example → examples}/todos/app/components/todo_list.react.rb +0 -0
- data/{example → examples}/todos/app/models/todo.rb +0 -0
- data/{example → examples}/todos/config.ru +3 -1
- data/examples/todos/index.html.erb +20 -0
- data/{example → examples}/todos/spec/todo_spec.rb +0 -0
- data/{example → examples}/todos/vendor/base.css +0 -0
- data/{example → examples}/todos/vendor/bg.png +0 -0
- data/{example → examples}/todos/vendor/jquery.js +0 -0
- data/lib/react/api.rb +4 -1
- data/lib/react/element.rb +1 -1
- data/lib/react/ext/jsx_support.rb +15 -10
- data/lib/react/version.rb +1 -1
- data/react.rb.gemspec +3 -2
- data/spec/react_spec.rb +10 -0
- data/spec/vendor/es5-shim.min.js +0 -1
- metadata +57 -35
- data/example/basic-jsx/config.ru +0 -38
- data/example/todos/Gemfile +0 -11
- data/example/todos/Gemfile.lock +0 -80
- data/example/todos/index.html.haml +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 32d54ccf85fe948f2a0c3ac70fa16290d05f5f40
|
4
|
+
data.tar.gz: 72b6d263a3cec35a258cf6a2c41a7851a034269d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6a023c8bd9fbe0b509e6ae14d50394ccd46e99d4682a646b9b17bb22b257f05fa2eee2d18003921786dd18fbbb76e2233234fc9ce539c8616a07899c23fcc77e
|
7
|
+
data.tar.gz: 2e3e7c01ac8390d6f087900f3a2f0ab521902331ee961a297481056b7a214eb0963e34088e9528f90af6da888b30b20d096f88b9e04c059d758fad04569373b7
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.3.0
|
2
|
+
* Depends on `sprockets < 3` thus source map can still work
|
3
|
+
* Remove sprockets-es6 from dependency
|
4
|
+
* Set `displayName` of component as the Ruby class name, which make it displayed better in [react-devtools](https://github.com/facebook/react-devtools)
|
5
|
+
* Fix React::Element bridging in React Native environment (#fba2daeb)
|
6
|
+
* React#create_element accept a native component constructor function
|
7
|
+
|
1
8
|
## 0.2.1
|
2
9
|
* Depends on opal `~> 0.6.0`, which accidentally got loosen in previous release
|
3
10
|
|
data/Gemfile.lock
CHANGED
@@ -4,19 +4,18 @@ PATH
|
|
4
4
|
react.rb (0.2.1)
|
5
5
|
opal (~> 0.6.0)
|
6
6
|
opal-activesupport (~> 0)
|
7
|
-
|
7
|
+
react-jsx (~> 0.8.0)
|
8
|
+
sprockets (>= 2.2.3, < 3.0.0)
|
8
9
|
therubyracer (~> 0)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
|
14
|
-
|
15
|
-
babel-source (>= 4.0, < 5)
|
16
|
-
execjs (~> 2.0)
|
17
|
-
execjs (2.4.0)
|
14
|
+
execjs (2.5.2)
|
15
|
+
hike (1.2.3)
|
18
16
|
json (1.8.2)
|
19
17
|
libv8 (3.16.14.7)
|
18
|
+
multi_json (1.11.0)
|
20
19
|
opal (0.6.3)
|
21
20
|
source_map
|
22
21
|
sprockets
|
@@ -30,6 +29,10 @@ GEM
|
|
30
29
|
rack-protection (1.5.3)
|
31
30
|
rack
|
32
31
|
rake (10.4.2)
|
32
|
+
react-jsx (0.8.0)
|
33
|
+
execjs (>= 2.0.2)
|
34
|
+
json (>= 1.8.0)
|
35
|
+
react-source (>= 0.4.1)
|
33
36
|
react-source (0.12.2)
|
34
37
|
ref (1.0.5)
|
35
38
|
sinatra (1.4.6)
|
@@ -38,15 +41,15 @@ GEM
|
|
38
41
|
tilt (>= 1.3, < 3)
|
39
42
|
source_map (3.0.1)
|
40
43
|
json
|
41
|
-
sprockets (
|
44
|
+
sprockets (2.12.3)
|
45
|
+
hike (~> 1.2)
|
46
|
+
multi_json (~> 1.0)
|
42
47
|
rack (~> 1.0)
|
43
|
-
|
44
|
-
|
45
|
-
sprockets (~> 3.0.0.beta)
|
46
|
-
therubyracer (0.12.1)
|
48
|
+
tilt (~> 1.1, != 1.3.0)
|
49
|
+
therubyracer (0.12.2)
|
47
50
|
libv8 (~> 3.16.14.0)
|
48
51
|
ref
|
49
|
-
tilt (
|
52
|
+
tilt (1.4.1)
|
50
53
|
|
51
54
|
PLATFORMS
|
52
55
|
ruby
|
@@ -55,6 +58,6 @@ DEPENDENCIES
|
|
55
58
|
opal-jquery (~> 0)
|
56
59
|
opal-rspec (~> 0.3.0.beta3)
|
57
60
|
rake (~> 10)
|
58
|
-
react-source (~> 0.12)
|
61
|
+
react-source (~> 0.12.0)
|
59
62
|
react.rb!
|
60
63
|
sinatra (~> 1)
|
data/README.md
CHANGED
@@ -242,11 +242,14 @@ end
|
|
242
242
|
* TodoMVC: see [example/todos](example/todos), your beloved TodoMVC <3.
|
243
243
|
* JSX Example: see [example/basic-jsx](example/basic-jsx).
|
244
244
|
|
245
|
+
## React Native
|
246
|
+
|
247
|
+
For [React Native](http://facebook.github.io/react-native/) support, please refer to [Opal Native](https://github.com/zetachang/opal-native).
|
248
|
+
|
245
249
|
## TODOS
|
246
250
|
|
247
251
|
* Documentation
|
248
252
|
* API wrapping coverage of the original js library (pretty close though)
|
249
|
-
* React Native?
|
250
253
|
|
251
254
|
## Developing
|
252
255
|
|
File without changes
|
@@ -1,22 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
react.rb (0.1
|
4
|
+
react.rb (0.2.1)
|
5
5
|
opal (~> 0.6.0)
|
6
|
-
opal-activesupport
|
7
|
-
|
8
|
-
|
6
|
+
opal-activesupport (~> 0)
|
7
|
+
react-jsx (~> 0.8.0)
|
8
|
+
sprockets (>= 2.2.3, < 3.0.0)
|
9
|
+
therubyracer (~> 0)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
|
14
|
-
|
15
|
-
babel-source (>= 4.0, < 5)
|
16
|
-
execjs (~> 2.0)
|
17
|
-
execjs (2.4.0)
|
14
|
+
execjs (2.5.2)
|
15
|
+
hike (1.2.3)
|
18
16
|
json (1.8.2)
|
19
17
|
libv8 (3.16.14.7)
|
18
|
+
multi_json (1.11.0)
|
20
19
|
opal (0.6.3)
|
21
20
|
source_map
|
22
21
|
sprockets
|
@@ -29,20 +28,24 @@ GEM
|
|
29
28
|
rack (1.6.0)
|
30
29
|
rack-protection (1.5.3)
|
31
30
|
rack
|
32
|
-
react-
|
31
|
+
react-jsx (0.8.0)
|
32
|
+
execjs (>= 2.0.2)
|
33
|
+
json (>= 1.8.0)
|
34
|
+
react-source (>= 0.4.1)
|
35
|
+
react-source (0.13.2)
|
33
36
|
ref (1.0.5)
|
34
|
-
sinatra (1.4.
|
37
|
+
sinatra (1.4.6)
|
35
38
|
rack (~> 1.4)
|
36
39
|
rack-protection (~> 1.4)
|
37
|
-
tilt (
|
40
|
+
tilt (>= 1.3, < 3)
|
38
41
|
source_map (3.0.1)
|
39
42
|
json
|
40
|
-
sprockets (
|
43
|
+
sprockets (2.12.3)
|
44
|
+
hike (~> 1.2)
|
45
|
+
multi_json (~> 1.0)
|
41
46
|
rack (~> 1.0)
|
42
|
-
|
43
|
-
|
44
|
-
sprockets (~> 3.0.0.beta)
|
45
|
-
therubyracer (0.12.1)
|
47
|
+
tilt (~> 1.1, != 1.3.0)
|
48
|
+
therubyracer (0.12.2)
|
46
49
|
libv8 (~> 3.16.14.0)
|
47
50
|
ref
|
48
51
|
tilt (1.4.1)
|
File without changes
|
File without changes
|
@@ -1,22 +1,21 @@
|
|
1
1
|
PATH
|
2
2
|
remote: ../..
|
3
3
|
specs:
|
4
|
-
react.rb (0.1
|
4
|
+
react.rb (0.2.1)
|
5
5
|
opal (~> 0.6.0)
|
6
|
-
opal-activesupport
|
7
|
-
|
8
|
-
|
6
|
+
opal-activesupport (~> 0)
|
7
|
+
react-jsx (~> 0.8.0)
|
8
|
+
sprockets (>= 2.2.3, < 3.0.0)
|
9
|
+
therubyracer (~> 0)
|
9
10
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
|
14
|
-
|
15
|
-
babel-source (>= 4.0, < 5)
|
16
|
-
execjs (~> 2.0)
|
17
|
-
execjs (2.4.0)
|
14
|
+
execjs (2.5.2)
|
15
|
+
hike (1.2.3)
|
18
16
|
json (1.8.2)
|
19
17
|
libv8 (3.16.14.7)
|
18
|
+
multi_json (1.11.0)
|
20
19
|
opal (0.6.3)
|
21
20
|
source_map
|
22
21
|
sprockets
|
@@ -27,7 +26,11 @@ GEM
|
|
27
26
|
rack (1.6.0)
|
28
27
|
rack-protection (1.5.3)
|
29
28
|
rack
|
30
|
-
react-
|
29
|
+
react-jsx (0.8.0)
|
30
|
+
execjs (>= 2.0.2)
|
31
|
+
json (>= 1.8.0)
|
32
|
+
react-source (>= 0.4.1)
|
33
|
+
react-source (0.13.2)
|
31
34
|
ref (1.0.5)
|
32
35
|
sinatra (1.4.6)
|
33
36
|
rack (~> 1.4)
|
@@ -35,15 +38,15 @@ GEM
|
|
35
38
|
tilt (>= 1.3, < 3)
|
36
39
|
source_map (3.0.1)
|
37
40
|
json
|
38
|
-
sprockets (
|
41
|
+
sprockets (2.12.3)
|
42
|
+
hike (~> 1.2)
|
43
|
+
multi_json (~> 1.0)
|
39
44
|
rack (~> 1.0)
|
40
|
-
|
41
|
-
|
42
|
-
sprockets (~> 3.0.0.beta)
|
43
|
-
therubyracer (0.12.1)
|
45
|
+
tilt (~> 1.1, != 1.3.0)
|
46
|
+
therubyracer (0.12.2)
|
44
47
|
libv8 (~> 3.16.14.0)
|
45
48
|
ref
|
46
|
-
tilt (
|
49
|
+
tilt (1.4.1)
|
47
50
|
|
48
51
|
PLATFORMS
|
49
52
|
ruby
|
File without changes
|
File without changes
|
@@ -4,13 +4,12 @@ Bundler.require
|
|
4
4
|
|
5
5
|
require "react/source"
|
6
6
|
|
7
|
-
Opal::Processor.source_map_enabled = true
|
8
|
-
|
9
7
|
opal = Opal::Server.new {|s|
|
10
8
|
s.append_path './'
|
11
9
|
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
|
12
10
|
s.main = 'example'
|
13
11
|
s.debug = true
|
12
|
+
s.index_path = "index.html.erb"
|
14
13
|
}
|
15
14
|
|
16
15
|
map opal.source_maps.prefix do
|
@@ -33,23 +32,9 @@ post "/comments.json" do
|
|
33
32
|
JSON.generate(comments)
|
34
33
|
end
|
35
34
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<html>
|
40
|
-
<head>
|
41
|
-
<title>Hello React</title>
|
42
|
-
<link rel="stylesheet" href="base.css" />
|
43
|
-
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
|
44
|
-
<script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
|
45
|
-
<script src="/assets/react-with-addons.js"></script>
|
46
|
-
<script src="/assets/example.js"></script>
|
47
|
-
</head>
|
48
|
-
<body>
|
49
|
-
<div id="content"></div>
|
50
|
-
</body>
|
51
|
-
</html>
|
52
|
-
HTML
|
35
|
+
map '/' do
|
36
|
+
# Sourcemap won't work if only `assets/example.js` is loaded
|
37
|
+
use Opal::Server::Index, opal
|
53
38
|
end
|
54
39
|
|
55
40
|
run Sinatra::Application
|
File without changes
|
@@ -0,0 +1,14 @@
|
|
1
|
+
<!doctype html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Hello React</title>
|
5
|
+
<link rel="stylesheet" href="base.css" />
|
6
|
+
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
|
7
|
+
<script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
|
8
|
+
<%= javascript_include_tag "react-with-addons.js" %>
|
9
|
+
<%= javascript_include_tag "example" %>
|
10
|
+
</head>
|
11
|
+
<body>
|
12
|
+
<div id="content"></div>
|
13
|
+
</body>
|
14
|
+
</html>
|
File without changes
|
@@ -0,0 +1,65 @@
|
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/opal/vienna.git
|
3
|
+
revision: 593335cbd7fb99ce471fa720e9b9c849d99b8dda
|
4
|
+
ref: 593335cbd7fb99ce471fa720e9b9c849d99b8dda
|
5
|
+
specs:
|
6
|
+
vienna (0.0.2)
|
7
|
+
opal (>= 0.5.0, < 1.0.0)
|
8
|
+
opal-activesupport
|
9
|
+
opal-jquery
|
10
|
+
|
11
|
+
PATH
|
12
|
+
remote: ../..
|
13
|
+
specs:
|
14
|
+
react.rb (0.2.1)
|
15
|
+
opal (~> 0.6.0)
|
16
|
+
opal-activesupport (~> 0)
|
17
|
+
react-jsx (~> 0.8.0)
|
18
|
+
sprockets (>= 2.2.3, < 3.0.0)
|
19
|
+
therubyracer (~> 0)
|
20
|
+
|
21
|
+
GEM
|
22
|
+
remote: https://rubygems.org/
|
23
|
+
specs:
|
24
|
+
execjs (2.5.2)
|
25
|
+
hike (1.2.3)
|
26
|
+
json (1.8.2)
|
27
|
+
libv8 (3.16.14.7)
|
28
|
+
multi_json (1.11.0)
|
29
|
+
opal (0.6.3)
|
30
|
+
source_map
|
31
|
+
sprockets
|
32
|
+
opal-activesupport (0.1.0)
|
33
|
+
opal (>= 0.5.0, < 1.0.0)
|
34
|
+
opal-jquery (0.2.0)
|
35
|
+
opal (>= 0.5.0, < 1.0.0)
|
36
|
+
opal-rspec (0.3.0.beta3)
|
37
|
+
opal (>= 0.6.0, < 1.0.0)
|
38
|
+
rack (1.6.0)
|
39
|
+
rake (10.4.2)
|
40
|
+
react-jsx (0.8.0)
|
41
|
+
execjs (>= 2.0.2)
|
42
|
+
json (>= 1.8.0)
|
43
|
+
react-source (>= 0.4.1)
|
44
|
+
react-source (0.13.2)
|
45
|
+
ref (1.0.5)
|
46
|
+
source_map (3.0.1)
|
47
|
+
json
|
48
|
+
sprockets (2.12.3)
|
49
|
+
hike (~> 1.2)
|
50
|
+
multi_json (~> 1.0)
|
51
|
+
rack (~> 1.0)
|
52
|
+
tilt (~> 1.1, != 1.3.0)
|
53
|
+
therubyracer (0.12.2)
|
54
|
+
libv8 (~> 3.16.14.0)
|
55
|
+
ref
|
56
|
+
tilt (1.4.1)
|
57
|
+
|
58
|
+
PLATFORMS
|
59
|
+
ruby
|
60
|
+
|
61
|
+
DEPENDENCIES
|
62
|
+
opal-rspec (= 0.3.0.beta3)
|
63
|
+
rake
|
64
|
+
react.rb!
|
65
|
+
vienna!
|
File without changes
|
File without changes
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'opal'
|
2
2
|
require 'jquery'
|
3
3
|
require 'opal-jquery'
|
4
|
-
require 'opal-haml'
|
5
4
|
require 'vienna'
|
6
5
|
require "react"
|
7
6
|
|
@@ -11,7 +10,7 @@ require "components/app.react"
|
|
11
10
|
|
12
11
|
Document.ready? do
|
13
12
|
element = React.create_element(TodoAppView, filter: "all")
|
14
|
-
component = React.render(element,
|
13
|
+
component = React.render(element, `document.getElementById('todoapp')`)
|
15
14
|
|
16
15
|
Vienna::Router.new.tap do |router|
|
17
16
|
router.route('/:filter') do |params|
|
File without changes
|
File without changes
|
@@ -24,7 +24,8 @@ class TodoItem
|
|
24
24
|
def render
|
25
25
|
li(class_name: {editing: self.editing}) do
|
26
26
|
div(class_name: 'view') do
|
27
|
-
input(class_name: "toggle", type: "checkbox", checked: params[:todo].completed)
|
27
|
+
input(class_name: "toggle", type: "checkbox", checked: params[:todo].completed)
|
28
|
+
.on(:change) do |e|
|
28
29
|
todo = params[:todo]
|
29
30
|
todo.update(:completed => !todo.completed)
|
30
31
|
end
|
File without changes
|
File without changes
|
@@ -3,6 +3,8 @@ Bundler.require
|
|
3
3
|
|
4
4
|
require "react/source"
|
5
5
|
|
6
|
+
Opal::Processor.source_map_enabled = true
|
7
|
+
|
6
8
|
run Opal::Server.new { |s|
|
7
9
|
s.append_path 'app'
|
8
10
|
s.append_path 'vendor'
|
@@ -10,5 +12,5 @@ run Opal::Server.new { |s|
|
|
10
12
|
|
11
13
|
s.debug = true
|
12
14
|
s.main = 'application'
|
13
|
-
s.index_path = 'index.html.
|
15
|
+
s.index_path = 'index.html.erb'
|
14
16
|
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html lang='en'>
|
3
|
+
<head>
|
4
|
+
<meta charset='utf-8'>
|
5
|
+
<meta content='IE=edge,chrome=1' http-equiv='X-UA-Compatible'>
|
6
|
+
<link href='/vendor/base.css' rel='stylesheet'>
|
7
|
+
<%= javascript_include_tag 'react-with-addons.js' %>
|
8
|
+
<%= javascript_include_tag 'application' %>
|
9
|
+
</head>
|
10
|
+
<body>
|
11
|
+
<section id='todoapp'></section>
|
12
|
+
<div id='info'>
|
13
|
+
<p>Double-click to edit a todo</p>
|
14
|
+
<p>
|
15
|
+
Part of
|
16
|
+
<a href='http://todomvc.com'>TodoMVC</a>
|
17
|
+
</p>
|
18
|
+
</div>
|
19
|
+
</body>
|
20
|
+
</html>
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/react/api.rb
CHANGED
@@ -6,7 +6,9 @@ module React
|
|
6
6
|
params = []
|
7
7
|
|
8
8
|
# Component Spec or Nomral DOM
|
9
|
-
if type
|
9
|
+
if `(typeof type === 'function')`
|
10
|
+
params << type
|
11
|
+
elsif type.kind_of?(Class)
|
10
12
|
raise "Provided class should define `render` method" if !(type.method_defined? :render)
|
11
13
|
params << self.native_component_class(type)
|
12
14
|
else
|
@@ -86,6 +88,7 @@ module React
|
|
86
88
|
this.__opalInstance = instance;
|
87
89
|
return instance;
|
88
90
|
},
|
91
|
+
displayName: #{type.to_s},
|
89
92
|
render: function() {
|
90
93
|
var instance = this._getOpalInstance.apply(this);
|
91
94
|
return instance.$render();
|
data/lib/react/element.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require "./ext/string"
|
2
2
|
|
3
3
|
module React
|
4
|
-
class Element < `(function(){var f =
|
4
|
+
class Element < `(function(){var r = React;var f = function(){};var c = r.createClass({render:function(){return null;}});f.prototype = Object.getPrototypeOf(r.createElement(c));return f;})()`
|
5
5
|
def self.new
|
6
6
|
raise "use React.create_element instead"
|
7
7
|
end
|
@@ -1,16 +1,21 @@
|
|
1
|
-
require
|
1
|
+
require 'react/jsx'
|
2
|
+
require 'tilt'
|
2
3
|
require "sprockets"
|
3
|
-
require "sprockets/es6"
|
4
4
|
|
5
|
-
module
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
module React
|
6
|
+
module JSX
|
7
|
+
|
8
|
+
class Template < Tilt::Template
|
9
|
+
self.default_mime_type = 'application/javascript'
|
10
|
+
|
11
|
+
def prepare
|
12
|
+
end
|
13
|
+
|
14
|
+
def evaluate(scope, locals, &block)
|
15
|
+
@output ||= React::JSX.compile(data)
|
16
|
+
end
|
11
17
|
end
|
12
18
|
end
|
13
19
|
end
|
14
20
|
|
15
|
-
Sprockets.
|
16
|
-
Sprockets.register_transformer 'text/jsx', 'application/javascript', Sprockets::ES6.new('whitelist' => ['react'])
|
21
|
+
Sprockets.register_engine '.jsx', React::JSX::Template
|
data/lib/react/version.rb
CHANGED
data/react.rb.gemspec
CHANGED
@@ -18,9 +18,10 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_runtime_dependency 'opal', '~> 0.6.0'
|
20
20
|
s.add_runtime_dependency 'opal-activesupport', '~> 0'
|
21
|
-
s.add_runtime_dependency 'sprockets-es6', '~> 0'
|
22
21
|
s.add_runtime_dependency 'therubyracer', '~> 0'
|
23
|
-
s.
|
22
|
+
s.add_runtime_dependency 'react-jsx', '~> 0.8.0'
|
23
|
+
s.add_runtime_dependency 'sprockets', '>= 2.2.3', '< 3.0.0'
|
24
|
+
s.add_development_dependency 'react-source', '~> 0.12.0'
|
24
25
|
s.add_development_dependency 'opal-rspec', '~> 0.3.0.beta3'
|
25
26
|
s.add_development_dependency 'sinatra', '~> 1'
|
26
27
|
s.add_development_dependency 'opal-jquery', '~> 0'
|
data/spec/react_spec.rb
CHANGED
@@ -22,6 +22,16 @@ describe React do
|
|
22
22
|
element = React.create_element('div')
|
23
23
|
expect(React.is_valid_element(element)).to eq(true)
|
24
24
|
end
|
25
|
+
|
26
|
+
it "should allow passed a React.Component class (constructor function)" do
|
27
|
+
hello_message = `React.createClass({displayName: "HelloMessage",
|
28
|
+
render: function() {
|
29
|
+
return React.createElement("div", null, "Hello ", this.props.name);
|
30
|
+
}
|
31
|
+
});`
|
32
|
+
element = React.create_element(hello_message, name: "David")
|
33
|
+
expect(React.render_to_static_markup(element)).to eq('<div>Hello David</div>')
|
34
|
+
end
|
25
35
|
|
26
36
|
context "with block" do
|
27
37
|
it "should create a valid element with text as only child when block yield String" do
|
data/spec/vendor/es5-shim.min.js
CHANGED
@@ -4,4 +4,3 @@
|
|
4
4
|
* see https://github.com/es-shims/es5-shim/blob/v4.1.0/LICENSE
|
5
5
|
*/
|
6
6
|
(function(t,e){"use strict";if(typeof define==="function"&&define.amd){define(e)}else if(typeof exports==="object"){module.exports=e()}else{t.returnExports=e()}})(this,function(){var t=Array.prototype;var e=Object.prototype;var r=Function.prototype;var n=String.prototype;var i=Number.prototype;var a=t.slice;var o=t.splice;var u=t.push;var l=t.unshift;var f=r.call;var s=e.toString;var c=Array.isArray||function ye(t){return s.call(t)==="[object Array]"};var p=typeof Symbol==="function"&&typeof Symbol.toStringTag==="symbol";var h;var v=Function.prototype.toString,g=function de(t){try{v.call(t);return true}catch(e){return false}},y="[object Function]",d="[object GeneratorFunction]";h=function me(t){if(typeof t!=="function"){return false}if(p){return g(t)}var e=s.call(t);return e===y||e===d};var m;var b=RegExp.prototype.exec,w=function be(t){try{b.call(t);return true}catch(e){return false}},T="[object RegExp]";m=function we(t){if(typeof t!=="object"){return false}return p?w(t):s.call(t)===T};var x;var O=String.prototype.valueOf,j=function Te(t){try{O.call(t);return true}catch(e){return false}},S="[object String]";x=function xe(t){if(typeof t==="string"){return true}if(typeof t!=="object"){return false}return p?j(t):s.call(t)===S};var E=function Oe(t){var e=s.call(t);var r=e==="[object Arguments]";if(!r){r=!c(t)&&t!==null&&typeof t==="object"&&typeof t.length==="number"&&t.length>=0&&h(t.callee)}return r};var N=function(t){var e=Object.defineProperty&&function(){try{Object.defineProperty({},"x",{});return true}catch(t){return false}}();var r;if(e){r=function(t,e,r,n){if(!n&&e in t){return}Object.defineProperty(t,e,{configurable:true,enumerable:false,writable:true,value:r})}}else{r=function(t,e,r,n){if(!n&&e in t){return}t[e]=r}}return function n(e,i,a){for(var o in i){if(t.call(i,o)){r(e,o,i[o],a)}}}}(e.hasOwnProperty);function I(t){var e=typeof t;return t===null||e==="undefined"||e==="boolean"||e==="number"||e==="string"}var D={ToInteger:function je(t){var e=+t;if(e!==e){e=0}else if(e!==0&&e!==1/0&&e!==-(1/0)){e=(e>0||-1)*Math.floor(Math.abs(e))}return e},ToPrimitive:function Se(t){var e,r,n;if(I(t)){return t}r=t.valueOf;if(h(r)){e=r.call(t);if(I(e)){return e}}n=t.toString;if(h(n)){e=n.call(t);if(I(e)){return e}}throw new TypeError},ToObject:function(t){if(t==null){throw new TypeError("can't convert "+t+" to object")}return Object(t)},ToUint32:function Ee(t){return t>>>0}};var M=function Ne(){};N(r,{bind:function Ie(t){var e=this;if(!h(e)){throw new TypeError("Function.prototype.bind called on incompatible "+e)}var r=a.call(arguments,1);var n;var i=function(){if(this instanceof n){var i=e.apply(this,r.concat(a.call(arguments)));if(Object(i)===i){return i}return this}else{return e.apply(t,r.concat(a.call(arguments)))}};var o=Math.max(0,e.length-r.length);var u=[];for(var l=0;l<o;l++){u.push("$"+l)}n=Function("binder","return function ("+u.join(",")+"){ return binder.apply(this, arguments); }")(i);if(e.prototype){M.prototype=e.prototype;n.prototype=new M;M.prototype=null}return n}});var F=f.bind(e.hasOwnProperty);var R=function(){var t=[1,2];var e=t.splice();return t.length===2&&c(e)&&e.length===0}();N(t,{splice:function De(t,e){if(arguments.length===0){return[]}else{return o.apply(this,arguments)}}},!R);var U=function(){var e={};t.splice.call(e,0,0,1);return e.length===1}();N(t,{splice:function Me(t,e){if(arguments.length===0){return[]}var r=arguments;this.length=Math.max(D.ToInteger(this.length),0);if(arguments.length>0&&typeof e!=="number"){r=a.call(arguments);if(r.length<2){r.push(this.length-t)}else{r[1]=D.ToInteger(e)}}return o.apply(this,r)}},!U);var k=[].unshift(0)!==1;N(t,{unshift:function(){l.apply(this,arguments);return this.length}},k);N(Array,{isArray:c});var A=Object("a");var C=A[0]!=="a"||!(0 in A);var P=function Fe(t){var e=true;var r=true;if(t){t.call("foo",function(t,r,n){if(typeof n!=="object"){e=false}});t.call([1],function(){"use strict";r=typeof this==="string"},"x")}return!!t&&e&&r};N(t,{forEach:function Re(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=arguments[1],i=-1,a=r.length>>>0;if(!h(t)){throw new TypeError}while(++i<a){if(i in r){t.call(n,r[i],i,e)}}}},!P(t.forEach));N(t,{map:function Ue(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=r.length>>>0,i=Array(n),a=arguments[1];if(!h(t)){throw new TypeError(t+" is not a function")}for(var o=0;o<n;o++){if(o in r){i[o]=t.call(a,r[o],o,e)}}return i}},!P(t.map));N(t,{filter:function ke(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=r.length>>>0,i=[],a,o=arguments[1];if(!h(t)){throw new TypeError(t+" is not a function")}for(var u=0;u<n;u++){if(u in r){a=r[u];if(t.call(o,a,u,e)){i.push(a)}}}return i}},!P(t.filter));N(t,{every:function Ae(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=r.length>>>0,i=arguments[1];if(!h(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in r&&!t.call(i,r[a],a,e)){return false}}return true}},!P(t.every));N(t,{some:function Ce(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=r.length>>>0,i=arguments[1];if(!h(t)){throw new TypeError(t+" is not a function")}for(var a=0;a<n;a++){if(a in r&&t.call(i,r[a],a,e)){return true}}return false}},!P(t.some));var Z=false;if(t.reduce){Z=typeof t.reduce.call("es5",function(t,e,r,n){return n})==="object"}N(t,{reduce:function Pe(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=r.length>>>0;if(!h(t)){throw new TypeError(t+" is not a function")}if(!n&&arguments.length===1){throw new TypeError("reduce of empty array with no initial value")}var i=0;var a;if(arguments.length>=2){a=arguments[1]}else{do{if(i in r){a=r[i++];break}if(++i>=n){throw new TypeError("reduce of empty array with no initial value")}}while(true)}for(;i<n;i++){if(i in r){a=t.call(void 0,a,r[i],i,e)}}return a}},!Z);var J=false;if(t.reduceRight){J=typeof t.reduceRight.call("es5",function(t,e,r,n){return n})==="object"}N(t,{reduceRight:function Ze(t){var e=D.ToObject(this),r=C&&x(this)?this.split(""):e,n=r.length>>>0;if(!h(t)){throw new TypeError(t+" is not a function")}if(!n&&arguments.length===1){throw new TypeError("reduceRight of empty array with no initial value")}var i,a=n-1;if(arguments.length>=2){i=arguments[1]}else{do{if(a in r){i=r[a--];break}if(--a<0){throw new TypeError("reduceRight of empty array with no initial value")}}while(true)}if(a<0){return i}do{if(a in r){i=t.call(void 0,i,r[a],a,e)}}while(a--);return i}},!J);var z=Array.prototype.indexOf&&[0,1].indexOf(1,2)!==-1;N(t,{indexOf:function Je(t){var e=C&&x(this)?this.split(""):D.ToObject(this),r=e.length>>>0;if(!r){return-1}var n=0;if(arguments.length>1){n=D.ToInteger(arguments[1])}n=n>=0?n:Math.max(0,r+n);for(;n<r;n++){if(n in e&&e[n]===t){return n}}return-1}},z);var $=Array.prototype.lastIndexOf&&[0,1].lastIndexOf(0,-3)!==-1;N(t,{lastIndexOf:function ze(t){var e=C&&x(this)?this.split(""):D.ToObject(this),r=e.length>>>0;if(!r){return-1}var n=r-1;if(arguments.length>1){n=Math.min(n,D.ToInteger(arguments[1]))}n=n>=0?n:r-Math.abs(n);for(;n>=0;n--){if(n in e&&t===e[n]){return n}}return-1}},$);var B=!{toString:null}.propertyIsEnumerable("toString"),G=function(){}.propertyIsEnumerable("prototype"),H=!F("x","0"),L=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],X=L.length;N(Object,{keys:function $e(t){var e=h(t),r=E(t),n=t!==null&&typeof t==="object",i=n&&x(t);if(!n&&!e&&!r){throw new TypeError("Object.keys called on a non-object")}var a=[];var o=G&&e;if(i&&H||r){for(var u=0;u<t.length;++u){a.push(String(u))}}if(!r){for(var l in t){if(!(o&&l==="prototype")&&F(t,l)){a.push(String(l))}}}if(B){var f=t.constructor,s=f&&f.prototype===t;for(var c=0;c<X;c++){var p=L[c];if(!(s&&p==="constructor")&&F(t,p)){a.push(p)}}}return a}});var Y=Object.keys&&function(){return Object.keys(arguments).length===2}(1,2);var q=Object.keys;N(Object,{keys:function Be(e){if(E(e)){return q(t.slice.call(e))}else{return q(e)}}},!Y);var K=-621987552e5;var Q="-000001";var V=Date.prototype.toISOString&&new Date(K).toISOString().indexOf(Q)===-1;N(Date.prototype,{toISOString:function Ge(){var t,e,r,n,i;if(!isFinite(this)){throw new RangeError("Date.prototype.toISOString called on non-finite value.")}n=this.getUTCFullYear();i=this.getUTCMonth();n+=Math.floor(i/12);i=(i%12+12)%12;t=[i+1,this.getUTCDate(),this.getUTCHours(),this.getUTCMinutes(),this.getUTCSeconds()];n=(n<0?"-":n>9999?"+":"")+("00000"+Math.abs(n)).slice(0<=n&&n<=9999?-4:-6);e=t.length;while(e--){r=t[e];if(r<10){t[e]="0"+r}}return n+"-"+t.slice(0,2).join("-")+"T"+t.slice(2).join(":")+"."+("000"+this.getUTCMilliseconds()).slice(-3)+"Z"}},V);var W=false;try{W=Date.prototype.toJSON&&new Date(NaN).toJSON()===null&&new Date(K).toJSON().indexOf(Q)!==-1&&Date.prototype.toJSON.call({toISOString:function(){return true}})}catch(_){}if(!W){Date.prototype.toJSON=function He(t){var e=Object(this),r=D.ToPrimitive(e),n;if(typeof r==="number"&&!isFinite(r)){return null}n=e.toISOString;if(typeof n!=="function"){throw new TypeError("toISOString property is not callable")}return n.call(e)}}var te=Date.parse("+033658-09-27T01:46:40.000Z")===1e15;var ee=!isNaN(Date.parse("2012-04-04T24:00:00.500Z"))||!isNaN(Date.parse("2012-11-31T23:59:59.000Z"));var re=isNaN(Date.parse("2000-01-01T00:00:00.000Z"));if(!Date.parse||re||ee||!te){Date=function(t){function e(r,n,i,a,o,u,l){var f=arguments.length;if(this instanceof t){var s=f===1&&String(r)===r?new t(e.parse(r)):f>=7?new t(r,n,i,a,o,u,l):f>=6?new t(r,n,i,a,o,u):f>=5?new t(r,n,i,a,o):f>=4?new t(r,n,i,a):f>=3?new t(r,n,i):f>=2?new t(r,n):f>=1?new t(r):new t;s.constructor=e;return s}return t.apply(this,arguments)}var r=new RegExp("^"+"(\\d{4}|[+-]\\d{6})"+"(?:-(\\d{2})"+"(?:-(\\d{2})"+"(?:"+"T(\\d{2})"+":(\\d{2})"+"(?:"+":(\\d{2})"+"(?:(\\.\\d{1,}))?"+")?"+"("+"Z|"+"(?:"+"([-+])"+"(\\d{2})"+":(\\d{2})"+")"+")?)?)?)?"+"$");var n=[0,31,59,90,120,151,181,212,243,273,304,334,365];function i(t,e){var r=e>1?1:0;return n[e]+Math.floor((t-1969+r)/4)-Math.floor((t-1901+r)/100)+Math.floor((t-1601+r)/400)+365*(t-1970)}function a(e){return Number(new t(1970,0,1,0,0,0,e))}for(var o in t){e[o]=t[o]}e.now=t.now;e.UTC=t.UTC;e.prototype=t.prototype;e.prototype.constructor=e;e.parse=function u(e){var n=r.exec(e);if(n){var o=Number(n[1]),u=Number(n[2]||1)-1,l=Number(n[3]||1)-1,f=Number(n[4]||0),s=Number(n[5]||0),c=Number(n[6]||0),p=Math.floor(Number(n[7]||0)*1e3),h=Boolean(n[4]&&!n[8]),v=n[9]==="-"?1:-1,g=Number(n[10]||0),y=Number(n[11]||0),d;if(f<(s>0||c>0||p>0?24:25)&&s<60&&c<60&&p<1e3&&u>-1&&u<12&&g<24&&y<60&&l>-1&&l<i(o,u+1)-i(o,u)){d=((i(o,u)+l)*24+f+g*v)*60;d=((d+s+y*v)*60+c)*1e3+p;if(h){d=a(d)}if(-864e13<=d&&d<=864e13){return d}}return NaN}return t.parse.apply(this,arguments)};return e}(Date)}if(!Date.now){Date.now=function Le(){return(new Date).getTime()}}var ne=i.toFixed&&(8e-5.toFixed(3)!=="0.000"||.9.toFixed(0)!=="1"||1.255.toFixed(2)!=="1.25"||0xde0b6b3a7640080.toFixed(0)!=="1000000000000000128");var ie={base:1e7,size:6,data:[0,0,0,0,0,0],multiply:function Xe(t,e){var r=-1;while(++r<ie.size){e+=t*ie.data[r];ie.data[r]=e%ie.base;e=Math.floor(e/ie.base)}},divide:function Ye(t){var e=ie.size,r=0;while(--e>=0){r+=ie.data[e];ie.data[e]=Math.floor(r/t);r=r%t*ie.base}},numToString:function qe(){var t=ie.size;var e="";while(--t>=0){if(e!==""||t===0||ie.data[t]!==0){var r=String(ie.data[t]);if(e===""){e=r}else{e+="0000000".slice(0,7-r.length)+r}}}return e},pow:function Ke(t,e,r){return e===0?r:e%2===1?Ke(t,e-1,r*t):Ke(t*t,e/2,r)},log:function Qe(t){var e=0;while(t>=4096){e+=12;t/=4096}while(t>=2){e+=1;t/=2}return e}};N(i,{toFixed:function Ve(t){var e,r,n,i,a,o,u,l;e=Number(t);e=e!==e?0:Math.floor(e);if(e<0||e>20){throw new RangeError("Number.toFixed called with invalid number of decimals")}r=Number(this);if(r!==r){return"NaN"}if(r<=-1e21||r>=1e21){return String(r)}n="";if(r<0){n="-";r=-r}i="0";if(r>1e-21){a=ie.log(r*ie.pow(2,69,1))-69;o=a<0?r*ie.pow(2,-a,1):r/ie.pow(2,a,1);o*=4503599627370496;a=52-a;if(a>0){ie.multiply(0,o);u=e;while(u>=7){ie.multiply(1e7,0);u-=7}ie.multiply(ie.pow(10,u,1),0);u=a-1;while(u>=23){ie.divide(1<<23);u-=23}ie.divide(1<<u);ie.multiply(1,1);ie.divide(2);i=ie.numToString()}else{ie.multiply(0,o);ie.multiply(1<<-a,0);i=ie.numToString()+"0.00000000000000000000".slice(2,2+e)}}if(e>0){l=i.length;if(l<=e){i=n+"0.0000000000000000000".slice(0,e-l+2)+i}else{i=n+i.slice(0,l-e)+"."+i.slice(l-e)}}else{i=n+i}return i}},ne);var ae=n.split;if("ab".split(/(?:ab)*/).length!==2||".".split(/(.?)(.?)/).length!==4||"tesst".split(/(s)*/)[1]==="t"||"test".split(/(?:)/,-1).length!==4||"".split(/.?/).length||".".split(/()()/).length>1){(function(){var t=typeof/()??/.exec("")[1]==="undefined";n.split=function(e,r){var n=this;if(typeof e==="undefined"&&r===0){return[]}if(!m(e)){return ae.call(this,e,r)}var i=[],a=(e.ignoreCase?"i":"")+(e.multiline?"m":"")+(e.extended?"x":"")+(e.sticky?"y":""),o=0,l,f,s,c;e=new RegExp(e.source,a+"g");n+="";if(!t){l=new RegExp("^"+e.source+"$(?!\\s)",a)}r=typeof r==="undefined"?-1>>>0:D.ToUint32(r);f=e.exec(n);while(f){s=f.index+f[0].length;if(s>o){i.push(n.slice(o,f.index));if(!t&&f.length>1){f[0].replace(l,function(){for(var t=1;t<arguments.length-2;t++){if(typeof arguments[t]==="undefined"){f[t]=void 0}}})}if(f.length>1&&f.index<n.length){u.apply(i,f.slice(1))}c=f[0].length;o=s;if(i.length>=r){break}}if(e.lastIndex===f.index){e.lastIndex++}f=e.exec(n)}if(o===n.length){if(c||!e.test("")){i.push("")}}else{i.push(n.slice(o))}return i.length>r?i.slice(0,r):i}})()}else if("0".split(void 0,0).length){n.split=function We(t,e){if(typeof t==="undefined"&&e===0){return[]}return ae.call(this,t,e)}}var oe=n.replace;var ue=function(){var t=[];"x".replace(/x(.)?/g,function(e,r){t.push(r)});return t.length===1&&typeof t[0]==="undefined"}();if(!ue){n.replace=function _e(t,e){var r=h(e);var n=m(t)&&/\)[*?]/.test(t.source);if(!r||!n){return oe.call(this,t,e)}else{var i=function(r){var n=arguments.length;var i=t.lastIndex;t.lastIndex=0;var a=t.exec(r)||[];t.lastIndex=i;a.push(arguments[n-2],arguments[n-1]);return e.apply(this,a)};return oe.call(this,t,i)}}}var le=n.substr;var fe="".substr&&"0b".substr(-1)!=="b";N(n,{substr:function tr(t,e){return le.call(this,t<0?(t=this.length+t)<0?0:t:t,e)}},fe);var se=" \n\f\r \xa0\u1680\u180e\u2000\u2001\u2002\u2003"+"\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u2028"+"\u2029\ufeff";var ce="\u200b";var pe="["+se+"]";var he=new RegExp("^"+pe+pe+"*");var ve=new RegExp(pe+pe+"*$");var ge=n.trim&&(se.trim()||!ce.trim());N(n,{trim:function er(){if(typeof this==="undefined"||this===null){throw new TypeError("can't convert "+this+" to object")}return String(this).replace(he,"").replace(ve,"")}},ge);if(parseInt(se+"08")!==8||parseInt(se+"0x16")!==22){parseInt=function(t){var e=/^0[xX]/;return function r(n,i){n=String(n).trim();if(!Number(i)){i=e.test(n)?16:10}return t(n,i)}}(parseInt)}});
|
7
|
-
//# sourceMappingURL=es5-shim.map
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: react.rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
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-
|
11
|
+
date: 2015-05-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: therubyracer
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
@@ -53,33 +53,53 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: react-jsx
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.8.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 0.8.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: sprockets
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 2.2.3
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 3.0.0
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 2.2.3
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: 3.0.0
|
69
89
|
- !ruby/object:Gem::Dependency
|
70
90
|
name: react-source
|
71
91
|
requirement: !ruby/object:Gem::Requirement
|
72
92
|
requirements:
|
73
93
|
- - "~>"
|
74
94
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
95
|
+
version: 0.12.0
|
76
96
|
type: :development
|
77
97
|
prerelease: false
|
78
98
|
version_requirements: !ruby/object:Gem::Requirement
|
79
99
|
requirements:
|
80
100
|
- - "~>"
|
81
101
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
102
|
+
version: 0.12.0
|
83
103
|
- !ruby/object:Gem::Dependency
|
84
104
|
name: opal-rspec
|
85
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,33 +172,35 @@ files:
|
|
152
172
|
- README.md
|
153
173
|
- Rakefile
|
154
174
|
- config.ru
|
155
|
-
-
|
156
|
-
-
|
157
|
-
-
|
158
|
-
-
|
159
|
-
-
|
160
|
-
-
|
161
|
-
-
|
162
|
-
-
|
163
|
-
-
|
164
|
-
-
|
165
|
-
-
|
166
|
-
-
|
167
|
-
-
|
168
|
-
-
|
169
|
-
-
|
170
|
-
-
|
171
|
-
-
|
172
|
-
-
|
173
|
-
-
|
174
|
-
-
|
175
|
-
-
|
176
|
-
-
|
177
|
-
-
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
175
|
+
- examples/basic-jsx/Gemfile
|
176
|
+
- examples/basic-jsx/Gemfile.lock
|
177
|
+
- examples/basic-jsx/config.ru
|
178
|
+
- examples/basic-jsx/example.jsx.rb
|
179
|
+
- examples/basic-jsx/index.html.erb
|
180
|
+
- examples/react-tutorial/Gemfile
|
181
|
+
- examples/react-tutorial/Gemfile.lock
|
182
|
+
- examples/react-tutorial/README.md
|
183
|
+
- examples/react-tutorial/_comments.json
|
184
|
+
- examples/react-tutorial/config.ru
|
185
|
+
- examples/react-tutorial/example.rb
|
186
|
+
- examples/react-tutorial/index.html.erb
|
187
|
+
- examples/react-tutorial/public/base.css
|
188
|
+
- examples/todos/Gemfile
|
189
|
+
- examples/todos/Gemfile.lock
|
190
|
+
- examples/todos/README.md
|
191
|
+
- examples/todos/Rakefile
|
192
|
+
- examples/todos/app/application.rb
|
193
|
+
- examples/todos/app/components/app.react.rb
|
194
|
+
- examples/todos/app/components/footer.react.rb
|
195
|
+
- examples/todos/app/components/todo_item.react.rb
|
196
|
+
- examples/todos/app/components/todo_list.react.rb
|
197
|
+
- examples/todos/app/models/todo.rb
|
198
|
+
- examples/todos/config.ru
|
199
|
+
- examples/todos/index.html.erb
|
200
|
+
- examples/todos/spec/todo_spec.rb
|
201
|
+
- examples/todos/vendor/base.css
|
202
|
+
- examples/todos/vendor/bg.png
|
203
|
+
- examples/todos/vendor/jquery.js
|
182
204
|
- lib/react.rb
|
183
205
|
- lib/react/api.rb
|
184
206
|
- lib/react/callbacks.rb
|
data/example/basic-jsx/config.ru
DELETED
@@ -1,38 +0,0 @@
|
|
1
|
-
# config.ru
|
2
|
-
require 'bundler'
|
3
|
-
Bundler.require
|
4
|
-
|
5
|
-
Opal::Processor.source_map_enabled = true
|
6
|
-
|
7
|
-
opal = Opal::Server.new {|s|
|
8
|
-
s.append_path './'
|
9
|
-
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
|
10
|
-
s.main = 'example'
|
11
|
-
s.debug = true
|
12
|
-
}
|
13
|
-
|
14
|
-
map opal.source_maps.prefix do
|
15
|
-
run opal.source_maps
|
16
|
-
end
|
17
|
-
|
18
|
-
map '/assets' do
|
19
|
-
run opal.sprockets
|
20
|
-
end
|
21
|
-
|
22
|
-
get '/' do
|
23
|
-
<<-HTML
|
24
|
-
<!doctype html>
|
25
|
-
<html>
|
26
|
-
<head>
|
27
|
-
<title>Hello React</title>
|
28
|
-
<script src="/assets/react-with-addons.js"></script>
|
29
|
-
</head>
|
30
|
-
<body>
|
31
|
-
<div id="container"></div>
|
32
|
-
<script src="/assets/example.js"></script>
|
33
|
-
</body>
|
34
|
-
</html>
|
35
|
-
HTML
|
36
|
-
end
|
37
|
-
|
38
|
-
run Sinatra::Application
|
data/example/todos/Gemfile
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
gem 'rake'
|
4
|
-
gem 'opal', :github => 'opal/opal', :ref => '85220f32136c74ac93f1cb721462324a3423cf44'
|
5
|
-
gem 'opal-jquery', :github => 'opal/opal-jquery'
|
6
|
-
gem 'vienna', :github => 'opal/vienna', :ref => '593335cbd7fb99ce471fa720e9b9c849d99b8dda'
|
7
|
-
gem 'opal-haml', :github => 'opal/opal-haml'
|
8
|
-
gem 'opal-rspec', '0.3.0.beta2'
|
9
|
-
gem 'react.rb', '~> 0.0.2'
|
10
|
-
gem 'thin'
|
11
|
-
gem 'react-source'
|
data/example/todos/Gemfile.lock
DELETED
@@ -1,80 +0,0 @@
|
|
1
|
-
GIT
|
2
|
-
remote: git://github.com/opal/opal-haml.git
|
3
|
-
revision: 0bdd3eb53ec03d380e14440a94f779ed7c3741e1
|
4
|
-
specs:
|
5
|
-
opal-haml (0.2.0)
|
6
|
-
haml
|
7
|
-
opal (>= 0.5.0, < 1.0.0)
|
8
|
-
|
9
|
-
GIT
|
10
|
-
remote: git://github.com/opal/opal-jquery.git
|
11
|
-
revision: 1814202085f168176231b877b2b7a967b75b0726
|
12
|
-
specs:
|
13
|
-
opal-jquery (0.1.2)
|
14
|
-
opal (>= 0.5.0, < 1.0.0)
|
15
|
-
|
16
|
-
GIT
|
17
|
-
remote: git://github.com/opal/opal.git
|
18
|
-
revision: 85220f32136c74ac93f1cb721462324a3423cf44
|
19
|
-
ref: 85220f32136c74ac93f1cb721462324a3423cf44
|
20
|
-
specs:
|
21
|
-
opal (0.6.0)
|
22
|
-
source_map
|
23
|
-
sprockets
|
24
|
-
|
25
|
-
GIT
|
26
|
-
remote: git://github.com/opal/vienna.git
|
27
|
-
revision: 593335cbd7fb99ce471fa720e9b9c849d99b8dda
|
28
|
-
ref: 593335cbd7fb99ce471fa720e9b9c849d99b8dda
|
29
|
-
specs:
|
30
|
-
vienna (0.0.2)
|
31
|
-
opal (>= 0.5.0, < 1.0.0)
|
32
|
-
opal-activesupport
|
33
|
-
opal-jquery
|
34
|
-
|
35
|
-
GEM
|
36
|
-
remote: https://rubygems.org/
|
37
|
-
specs:
|
38
|
-
daemons (1.1.9)
|
39
|
-
eventmachine (1.0.3)
|
40
|
-
haml (4.0.5)
|
41
|
-
tilt
|
42
|
-
hike (1.2.3)
|
43
|
-
json (1.8.2)
|
44
|
-
multi_json (1.10.1)
|
45
|
-
opal-activesupport (0.1.0)
|
46
|
-
opal (>= 0.5.0, < 1.0.0)
|
47
|
-
opal-rspec (0.3.0.beta2)
|
48
|
-
opal (>= 0.6.0, < 1.0.0)
|
49
|
-
rack (1.5.2)
|
50
|
-
rake (10.1.1)
|
51
|
-
react-source (0.12.2)
|
52
|
-
react.rb (0.0.2)
|
53
|
-
opal (~> 0.6.0)
|
54
|
-
opal-activesupport
|
55
|
-
source_map (3.0.1)
|
56
|
-
json
|
57
|
-
sprockets (2.12.3)
|
58
|
-
hike (~> 1.2)
|
59
|
-
multi_json (~> 1.0)
|
60
|
-
rack (~> 1.0)
|
61
|
-
tilt (~> 1.1, != 1.3.0)
|
62
|
-
thin (1.6.2)
|
63
|
-
daemons (>= 1.0.9)
|
64
|
-
eventmachine (>= 1.0.0)
|
65
|
-
rack (>= 1.0.0)
|
66
|
-
tilt (1.4.1)
|
67
|
-
|
68
|
-
PLATFORMS
|
69
|
-
ruby
|
70
|
-
|
71
|
-
DEPENDENCIES
|
72
|
-
opal!
|
73
|
-
opal-haml!
|
74
|
-
opal-jquery!
|
75
|
-
opal-rspec (= 0.3.0.beta2)
|
76
|
-
rake
|
77
|
-
react-source
|
78
|
-
react.rb (~> 0.0.2)
|
79
|
-
thin
|
80
|
-
vienna!
|
@@ -1,16 +0,0 @@
|
|
1
|
-
!!!
|
2
|
-
%html(lang="en")
|
3
|
-
%head
|
4
|
-
%meta(charset="utf-8")
|
5
|
-
%meta(http-equiv="X-UA-Compatible" content="IE=edge,chrome=1")
|
6
|
-
%link(rel="stylesheet" href="/vendor/base.css")
|
7
|
-
= javascript_include_tag 'react-with-addons.js'
|
8
|
-
= javascript_include_tag 'application'
|
9
|
-
|
10
|
-
%body
|
11
|
-
%section#todoapp
|
12
|
-
#info
|
13
|
-
%p Double-click to edit a todo
|
14
|
-
%p
|
15
|
-
Part of
|
16
|
-
%a(href="http://todomvc.com") TodoMVC
|