Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2ab439c

Browse files
Merge pull request #99 from shakacode/bump-react_on_rails
Bump react_on_rails gem version to 1.0.3
2 parents 6351a69 + b042a35 commit 2ab439c

24 files changed

+526
-389
lines changed

‎.gitignore‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
/log/*.log
1616
/tmp
1717
/public/assets
18-
client-bundle.js
19-
client-bundle.js.map
2018
.env
2119
node_modules
2220
npm-debug.log
@@ -27,3 +25,6 @@ vendor/ruby
2725

2826
# RVM gemset
2927
.ruby-gemset
28+
29+
# Generated js bundles
30+
/app/assets/javascripts/generated/*

‎.travis.yml‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,16 @@ rvm:
55
install:
66
- bundle install
77
- npm install
8-
- cd client && $(npm bin)/webpack --config webpack.rails.config.js
8+
- cd client && NODE_ENV=production $(npm bin)/webpack --config webpack.rails.config.js
9+
- NODE_ENV=production $(npm bin)/webpack --config webpack.server.config.js
10+
911
env:
1012
- export RAILS_ENV=test
13+
14+
before_script:
15+
- export DISPLAY=:99.0
16+
- sh -e /etc/init.d/xvfb start
1117
script:
1218
- bundle exec rake db:schema:load
13-
- bundle exec rake
19+
- DRIVER=selenium_firefox bundle exec rake
1420
- bundle exec rake lint

‎Gemfile‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,13 @@ gem "rails-html-sanitizer"
3939
# Use Unicorn as the app server
4040
gem "unicorn"
4141

42-
gem "react_on_rails", "~> 0.1.1"
42+
gem "react_on_rails", "~> 0.1.3"
43+
gem "therubyracer"
4344

4445
gem "autoprefixer-rails"
4546

47+
gem "awesome_print"
48+
4649
# Use Capistrano for deployment
4750
# gem "capistrano-rails", group: :development
4851
group :production do
@@ -84,8 +87,8 @@ group :test do
8487
gem "rspec-rails"
8588
gem "capybara"
8689
gem "capybara-screenshot"
87-
gem "poltergeist"
88-
gem "phantomjs",require: "phantomjs/poltergeist"
90+
gem "selenium-webdriver"
91+
gem "chromedriver-helper"
8992
gem "database_cleaner"
9093
gem "launchy"
9194
end

‎Gemfile.lock‎

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,16 @@ GEM
3737
thread_safe (~> 0.3, >= 0.3.4)
3838
tzinfo (~> 1.1)
3939
addressable (2.3.8)
40+
archive-zip (0.7.0)
41+
io-like (~> 0.3.0)
4042
arel (6.0.2)
4143
ast (2.0.0)
4244
astrolabe (1.3.1)
4345
parser (~> 2.2)
4446
autoprefixer-rails (5.2.1.1)
4547
execjs
4648
json
49+
awesome_print (1.6.1)
4750
binding_of_caller (0.7.2)
4851
debug_inspector (>= 0.0.1)
4952
bootstrap-sass (3.3.5.1)
@@ -74,7 +77,11 @@ GEM
7477
capybara-screenshot (1.0.11)
7578
capybara (>= 1.0, < 3)
7679
launchy
77-
cliver (0.3.2)
80+
childprocess (0.5.6)
81+
ffi (~> 1.0, >= 1.0.11)
82+
chromedriver-helper (1.0.0)
83+
archive-zip (~> 0.7.0)
84+
nokogiri (~> 1.6)
7885
coffee-rails (4.1.0)
7986
coffee-script (>= 2.2.0)
8087
railties (>= 4.0.0, < 5.0)
@@ -106,6 +113,7 @@ GEM
106113
factory_girl (~> 4.5.0)
107114
railties (>= 3.0.0)
108115
fastercsv (1.5.5)
116+
ffi (1.9.10)
109117
foreman (0.78.0)
110118
thor (~> 0.19.1)
111119
globalid (0.3.5)
@@ -116,13 +124,15 @@ GEM
116124
http-cookie (1.0.2)
117125
domain_name (~> 0.5)
118126
i18n (0.7.0)
127+
io-like (0.3.0)
119128
jbuilder (2.3.1)
120129
activesupport (>= 3.0.0, < 5)
121130
multi_json (~> 1.2)
122131
json (1.8.3)
123132
kgio (2.9.3)
124133
launchy (2.4.3)
125134
addressable (~> 2.3)
135+
libv8 (3.16.14.11)
126136
loofah (2.0.2)
127137
nokogiri (>= 1.5.9)
128138
mail (2.6.3)
@@ -137,12 +147,6 @@ GEM
137147
parser (2.2.2.6)
138148
ast (>= 1.1, < 3.0)
139149
pg (0.18.2)
140-
phantomjs (1.9.8.0)
141-
poltergeist (1.6.0)
142-
capybara (~> 2.1)
143-
cliver (~> 0.3.1)
144-
multi_json (~> 1.0)
145-
websocket-driver (>= 0.2.0)
146150
powerpack (0.1.1)
147151
rack (1.6.4)
148152
rack-test (0.6.3)
@@ -180,9 +184,10 @@ GEM
180184
raindrops (0.15.0)
181185
rake (10.4.2)
182186
rdoc (4.2.0)
183-
react_on_rails (0.1.1)
187+
react_on_rails (0.1.3)
184188
execjs (~> 2.5)
185189
rails (~> 4.2)
190+
ref (2.0.0)
186191
rest-client (1.8.0)
187192
http-cookie (>= 1.0.2, < 2.0)
188193
mime-types (>= 1.16, < 3.0)
@@ -219,6 +224,7 @@ GEM
219224
sexp_processor (~> 4.0)
220225
ruby_parser (3.7.0)
221226
sexp_processor (~> 4.1)
227+
rubyzip (1.1.7)
222228
sass (3.4.16)
223229
sass-rails (5.0.3)
224230
railties (>= 4.0.0, < 5.0)
@@ -232,6 +238,11 @@ GEM
232238
sdoc (0.4.1)
233239
json (~> 1.7, >= 1.7.7)
234240
rdoc (~> 4.0)
241+
selenium-webdriver (2.47.1)
242+
childprocess (~> 0.5)
243+
multi_json (~> 1.0)
244+
rubyzip (~> 1.0)
245+
websocket (~> 1.0)
235246
sexp_processor (4.6.0)
236247
simplecov (0.10.0)
237248
docile (~> 1.1.0)
@@ -252,6 +263,9 @@ GEM
252263
term-ansicolor (1.3.2)
253264
tins (~> 1.0)
254265
terminal-table (1.5.2)
266+
therubyracer (0.12.2)
267+
libv8 (~> 3.16.14.0)
268+
ref
255269
thor (0.19.1)
256270
thread_safe (0.3.5)
257271
tilt (1.4.1)
@@ -275,9 +289,7 @@ GEM
275289
binding_of_caller (>= 0.7.2)
276290
railties (>= 4.0)
277291
sprockets-rails (>= 2.0, < 4.0)
278-
websocket-driver (0.6.2)
279-
websocket-extensions (>= 0.1.0)
280-
websocket-extensions (0.1.2)
292+
websocket (1.2.2)
281293
xpath (2.0.0)
282294
nokogiri (~> 1.3)
283295

@@ -286,12 +298,14 @@ PLATFORMS
286298

287299
DEPENDENCIES
288300
autoprefixer-rails
301+
awesome_print
289302
bootstrap-sass (~> 3.3.1)
290303
brakeman
291304
bundler-audit
292305
byebug
293306
capybara
294307
capybara-screenshot
308+
chromedriver-helper
295309
coffee-rails
296310
coveralls
297311
database_cleaner
@@ -301,22 +315,22 @@ DEPENDENCIES
301315
jbuilder
302316
launchy
303317
pg
304-
phantomjs
305-
poltergeist
306318
rails (~> 4.2)
307319
rails-html-sanitizer
308320
rails_12factor
309321
rainbow
310-
react_on_rails (~> 0.1.1)
322+
react_on_rails (~> 0.1.3)
311323
rspec-rails
312324
rubocop
313325
ruby-lint
314326
sass-rails
315327
scss_lint
316328
sdoc
329+
selenium-webdriver
317330
spring
318331
spring-commands-rspec
319332
sqlite3
333+
therubyracer
320334
turbolinks
321335
uglifier (~> 2.7.2)
322336
unicorn

‎Procfile.dev‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
web: rails s -p 4000
22
client: sh -c 'cd client && $(npm bin)/webpack -w --config webpack.rails.config.js'
3+
server: sh -c 'cd client && $(npm bin)/webpack -w --config webpack.server.config.js'
34
hot: sh -c 'cd client && node server.js'

‎app/views/pages/index.html.erb‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@
1616
</li>
1717
</ul>
1818
<hr/>
19-
<%= react_component('App', {}, prerender: false) %>
19+
<%= react_component('App', {}, generator_function: true,prerender: true) %>

‎client/assets/javascripts/App.jsx‎ renamed to ‎client/assets/javascripts/ClientApp.jsx‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,5 @@ const App = () => {
1313
return reactComponent;
1414
};
1515

16-
window.App = App;
17-
1816
// Export is needed for the hot reload server
1917
export default App;
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import React from 'react';
2+
import { Provider } from 'react-redux';
3+
4+
import CommentScreen from './components/CommentScreen';
5+
import CommentStore from './stores/CommentStore';
6+
7+
const App = () => {
8+
const reactComponent = (
9+
<Provider store={CommentStore}>
10+
{() => <CommentScreen />}
11+
</Provider>
12+
);
13+
return reactComponent;
14+
};
15+
16+
// Export is needed for the hot reload server
17+
export default App;

‎client/assets/javascripts/actions/CommentActionCreators.js‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,10 @@ export function submitCommentFailure(error) {
4343

4444
export function fetchComments() {
4545
return dispatch => {
46-
return CommentsManager.fetchComments().then(
47-
comments => dispatch(fetchCommentsSuccess(comments)),
48-
error => dispatch(fetchCommentsFailure(error))
46+
return (
47+
CommentsManager.fetchComments()
48+
.then(res => dispatch(fetchCommentsSuccess(res.data)))
49+
.catch(res => dispatch(fetchCommentsFailure(res.data)))
4950
);
5051
};
5152
}
@@ -57,10 +58,11 @@ function dispatchDecrementAjaxCounter(dispatch) {
5758
export function submitComment(comment) {
5859
return dispatch => {
5960
dispatch(incrementAjaxCounter());
60-
return CommentsManager.submitComment(comment)
61-
.then(
62-
_comment => dispatch(submitCommentSuccess(_comment)),
63-
error => dispatch(submitCommentFailure(error)))
64-
.then(() => dispatchDecrementAjaxCounter(dispatch));
61+
return (
62+
CommentsManager.submitComment(comment)
63+
.then(res => dispatch(submitCommentSuccess(res.data)))
64+
.catch(res => dispatch(submitCommentFailure(res.data)))
65+
.then(() => dispatchDecrementAjaxCounter(dispatch))
66+
);
6567
};
6668
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import App from './ClientApp';
2+
3+
window.App = App;

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /