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

Commit 18cf970

Browse files
committed
Server react.js from gem
1 parent ca6ba80 commit 18cf970

File tree

7 files changed

+59
-5
lines changed

7 files changed

+59
-5
lines changed

example/react-tutorial/Gemfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ source 'https://rubygems.org'
22

33
gem 'react.rb', :path => '../..'
44
gem 'sinatra'
5-
gem 'opal-jquery'
5+
gem 'opal-jquery'
6+
gem 'react-source'

example/react-tutorial/Gemfile.lock

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
PATH
2+
remote: ../..
3+
specs:
4+
react.rb (0.0.1)
5+
opal (~> 0.6.0)
6+
opal-activesupport
7+
8+
GEM
9+
remote: https://rubygems.org/
10+
specs:
11+
hike (1.2.3)
12+
json (1.8.2)
13+
multi_json (1.10.1)
14+
opal (0.6.3)
15+
source_map
16+
sprockets
17+
opal-activesupport (0.1.0)
18+
opal (>= 0.5.0, < 1.0.0)
19+
opal-jquery (0.2.0)
20+
opal (>= 0.5.0, < 1.0.0)
21+
rack (1.6.0)
22+
rack-protection (1.5.3)
23+
rack
24+
react-source (0.12.2)
25+
sinatra (1.4.5)
26+
rack (~> 1.4)
27+
rack-protection (~> 1.4)
28+
tilt (~> 1.3, >= 1.3.4)
29+
source_map (3.0.1)
30+
json
31+
sprockets (2.12.3)
32+
hike (~> 1.2)
33+
multi_json (~> 1.0)
34+
rack (~> 1.0)
35+
tilt (~> 1.1, != 1.3.0)
36+
tilt (1.4.1)
37+
38+
PLATFORMS
39+
ruby
40+
41+
DEPENDENCIES
42+
opal-jquery
43+
react-source
44+
react.rb!
45+
sinatra

example/react-tutorial/config.ru

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,13 @@
22
require 'bundler'
33
Bundler.require
44

5+
require "react/source"
6+
57
Opal::Processor.source_map_enabled = true
68

79
opal = Opal::Server.new {|s|
810
s.append_path './'
11+
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
912
s.main = 'example'
1013
s.debug = true
1114
}
@@ -37,9 +40,9 @@ get '/' do
3740
<head>
3841
<title>Hello React</title>
3942
<link rel="stylesheet" href="base.css" />
40-
<script src="http://cdnjs.cloudflare.com/ajax/libs/react/0.12.2/react.js"></script>
4143
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
4244
<script src="http://cdnjs.cloudflare.com/ajax/libs/showdown/0.3.1/showdown.min.js"></script>
45+
<script src="/assets/react-with-addons.min.js"></script>
4346
<script src="/assets/example.js"></script>
4447
</head>
4548
<body>
@@ -49,4 +52,4 @@ get '/' do
4952
HTML
5053
end
5154

52-
run Sinatra::Application
55+
run Sinatra::Application

example/todos/Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ gem 'opal-haml', :github => 'opal/opal-haml'
88
gem 'opal-rspec', '0.3.0.beta2'
99
gem 'react.rb', :path => "../.."
1010
gem 'thin'
11+
gem 'react-source'

example/todos/Gemfile.lock

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ GEM
5555
opal (>= 0.6.0, < 1.0.0)
5656
rack (1.5.2)
5757
rake (10.1.1)
58+
react-source (0.12.2)
5859
source_map (3.0.1)
5960
json
6061
sprockets (2.12.3)
@@ -77,6 +78,7 @@ DEPENDENCIES
7778
opal-jquery!
7879
opal-rspec (= 0.3.0.beta2)
7980
rake
81+
react-source
8082
react.rb!
8183
thin
8284
vienna!

example/todos/config.ru

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
require 'bundler'
22
Bundler.require
33

4+
require "react/source"
5+
46
run Opal::Server.new { |s|
57
s.append_path 'app'
68
s.append_path 'vendor'
9+
s.append_path File.dirname(::React::Source.bundled_path_for("react-with-addons.js"))
710

811
s.debug = true
912
s.main = 'application'

example/todos/index.html.haml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@
33
%head
44
%meta(charset="utf-8")
55
%meta(http-equiv="X-UA-Compatible" content="IE=edge,chrome=1")
6-
%script{:type => "text/javascript",
7-
:src => "http://fb.me/react-with-addons-0.12.2.min.js"}
86
%link(rel="stylesheet" href="/vendor/base.css")
7+
= javascript_include_tag 'react-with-addons.min.js'
98
= javascript_include_tag 'application'
109

1110
%body

0 commit comments

Comments
 (0)