Skip to content
This repository was archived by the owner on Oct 19, 2018. It is now read-only.

Commit cf5df03

Browse files
committed
Update examples
1 parent 9327762 commit cf5df03

File tree

6 files changed

+70
-82
lines changed

6 files changed

+70
-82
lines changed

example/basic-jsx/Gemfile.lock

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
PATH
22
remote: ../..
33
specs:
4-
react.rb (0.1.0)
4+
react.rb (0.2.1)
55
opal (~> 0.6.0)
6-
opal-activesupport
7-
sprockets-es6
8-
therubyracer
6+
opal-activesupport (~> 0)
7+
react-jsx (~> 0.8.0)
8+
sprockets (>= 2.2.3, < 3.0.0)
9+
therubyracer (~> 0)
910

1011
GEM
1112
remote: https://rubygems.org/
1213
specs:
13-
babel-source (4.7.16)
14-
babel-transpiler (0.6.0)
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)
1816
json (1.8.2)
1917
libv8 (3.16.14.7)
18+
multi_json (1.11.0)
2019
opal (0.6.3)
2120
source_map
2221
sprockets
@@ -29,20 +28,24 @@ GEM
2928
rack (1.6.0)
3029
rack-protection (1.5.3)
3130
rack
32-
react-source (0.12.2)
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)
3336
ref (1.0.5)
34-
sinatra (1.4.5)
37+
sinatra (1.4.6)
3538
rack (~> 1.4)
3639
rack-protection (~> 1.4)
37-
tilt (~> 1.3, >= 1.3.4)
40+
tilt (>= 1.3, < 3)
3841
source_map (3.0.1)
3942
json
40-
sprockets (3.0.0.beta.8)
43+
sprockets (2.12.3)
44+
hike (~> 1.2)
45+
multi_json (~> 1.0)
4146
rack (~> 1.0)
42-
sprockets-es6 (0.6.0)
43-
babel-transpiler
44-
sprockets (~> 3.0.0.beta)
45-
therubyracer (0.12.1)
47+
tilt (~> 1.1, != 1.3.0)
48+
therubyracer (0.12.2)
4649
libv8 (~> 3.16.14.0)
4750
ref
4851
tilt (1.4.1)

example/basic-jsx/config.ru

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,10 @@
1-
# config.ru
21
require 'bundler'
32
Bundler.require
43

5-
Opal::Processor.source_map_enabled = true
6-
7-
opal = Opal::Server.new {|s|
4+
run Opal::Server.new {|s|
85
s.append_path './'
96
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
107
s.main = 'example'
8+
s.index_path = 'index.html.erb'
119
s.debug = true
1210
}
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

example/basic-jsx/index.html.erb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html>
3+
<head>
4+
<title>Hello React</title>
5+
<%= javascript_include_tag 'react-with-addons.js' %>
6+
</head>
7+
<body>
8+
<div id="container"></div>
9+
<%= javascript_include_tag 'example' %>
10+
</body>
11+
</html>

example/react-tutorial/Gemfile.lock

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
PATH
22
remote: ../..
33
specs:
4-
react.rb (0.1.0)
4+
react.rb (0.2.1)
55
opal (~> 0.6.0)
6-
opal-activesupport
7-
sprockets-es6
8-
therubyracer
6+
opal-activesupport (~> 0)
7+
react-jsx (~> 0.8.0)
8+
sprockets (>= 2.2.3, < 3.0.0)
9+
therubyracer (~> 0)
910

1011
GEM
1112
remote: https://rubygems.org/
1213
specs:
13-
babel-source (4.7.16)
14-
babel-transpiler (0.6.0)
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)
1816
json (1.8.2)
1917
libv8 (3.16.14.7)
18+
multi_json (1.11.0)
2019
opal (0.6.3)
2120
source_map
2221
sprockets
@@ -27,23 +26,27 @@ GEM
2726
rack (1.6.0)
2827
rack-protection (1.5.3)
2928
rack
30-
react-source (0.13.1)
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)
3134
ref (1.0.5)
3235
sinatra (1.4.6)
3336
rack (~> 1.4)
3437
rack-protection (~> 1.4)
3538
tilt (>= 1.3, < 3)
3639
source_map (3.0.1)
3740
json
38-
sprockets (3.0.0.rc.1)
41+
sprockets (2.12.3)
42+
hike (~> 1.2)
43+
multi_json (~> 1.0)
3944
rack (~> 1.0)
40-
sprockets-es6 (0.6.0)
41-
babel-transpiler
42-
sprockets (~> 3.0.0.beta)
43-
therubyracer (0.12.1)
45+
tilt (~> 1.1, != 1.3.0)
46+
therubyracer (0.12.2)
4447
libv8 (~> 3.16.14.0)
4548
ref
46-
tilt (2.0.1)
49+
tilt (1.4.1)
4750

4851
PLATFORMS
4952
ruby

example/react-tutorial/config.ru

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ Bundler.require
44

55
require "react/source"
66

7-
Opal::Processor.source_map_enabled = true
8-
97
opal = Opal::Server.new {|s|
108
s.append_path './'
119
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
1210
s.main = 'example'
1311
s.debug = true
12+
s.index_path = "index.html.erb"
1413
}
1514

1615
map opal.source_maps.prefix do
@@ -33,23 +32,9 @@ post "/comments.json" do
3332
JSON.generate(comments)
3433
end
3534

36-
get '/' do
37-
<<-HTML
38-
<!doctype html>
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
5338
end
5439

5540
run Sinatra::Application

example/react-tutorial/index.html.erb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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>

0 commit comments

Comments
 (0)