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 05a6d44

Browse files
Merge pull request #96 from shakacode/client-refactoring
Client refactoring
2 parents 8c5f1d9 + 57f3bad commit 05a6d44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+631
-564
lines changed

‎.travis.yml‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@ rvm:
55
install:
66
- bundle install
77
- npm install
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-
8+
- cd client && npm run build:client
9+
- npm run build:server
1110
env:
1211
- export RAILS_ENV=test
13-
1412
before_script:
1513
- export DISPLAY=:99.0
1614
- sh -e /etc/init.d/xvfb start

‎Gemfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ gem "rails-html-sanitizer"
3939
# Use Unicorn as the app server
4040
gem "unicorn"
4141

42-
gem "react_on_rails", "~> 0.1.3"
42+
gem "react_on_rails", "~> 0.1.6"
4343
gem "therubyracer"
4444

4545
gem "autoprefixer-rails"

‎Gemfile.lock‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ GEM
206206
raindrops (0.15.0)
207207
rake (10.4.2)
208208
rdoc (4.2.0)
209-
react_on_rails (0.1.3)
209+
react_on_rails (0.1.6)
210210
execjs (~> 2.5)
211211
rails (~> 4.2)
212212
ref (2.0.0)
@@ -351,7 +351,7 @@ DEPENDENCIES
351351
rails-html-sanitizer
352352
rails_12factor
353353
rainbow
354-
react_on_rails (~> 0.1.3)
354+
react_on_rails (~> 0.1.6)
355355
rspec-rails
356356
rubocop
357357
ruby-lint

‎Procfile.dev‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
web: rails s -p 4000
2-
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'
4-
hot: sh -c 'cd client && node server.js'
2+
client: sh -c 'rm app/assets/javascripts/generated/* || true && cd client && npm run build:dev:client'
3+
server: sh -c 'cd client && npm run build:dev:server'
4+
hot: sh -c 'cd client && npm start'

‎README.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ the JS bundle. We've chosen to let Rails handle CSS, SCSS, images, fonts.
102102

103103
```
104104
cd client
105-
$(npm bin)/webpack -w --config webpack.rails.config.js
105+
npm run build:dev
106106
```
107107

108108
`client-bundle.js` is generated and saved to `app/assets/javascripts`. This is included in the
@@ -182,7 +182,7 @@ jQuery and jQuery-ujs are not required within `app/assets/javascript/application
182182
and have been moved under`/client` and managed by npm. The modules are exposed via entry point
183183
by `webpack.common.config.js`.
184184

185-
In `application.js`, it's critical that any libraries that depend on jQuery come after the inclusion
185+
In `application.js`, it's critical that any libraries that depend on jQuery come after the inclusion
186186
of the Webpack bundle, such as the twitter bootstrap javascript.
187187

188188
Please refer to [Considerations for jQuery with Rails and Webpack](http://forum.railsonmaui.com/t/considerations-for-jquery-with-rails-and-webpack/344) for further info.
@@ -260,7 +260,7 @@ Run the tests with `rspec`.
260260
### RubyMine/Webstorm Linting Configuration
261261
* I started out trying to make RubyMine and WebStorm catch and fix linting errors. However, I find
262262
it faster to just do this with the command line. Your mileage may vary.
263-
* Create a custom scope like this for RubyMine, named "Inspection Scope"
263+
* Create a custom scope like this for RubyMine, named "Inspection Scope"
264264

265265
file[react-rails-tutorial]:*/&&!file[react-rails-tutorial]:tmp//*&&!file[react-rails-tutorial]:log//*&&!file[react-rails-tutorial]:client/node_modules//*&&!file[react-rails-tutorial]:client/assets/fonts//*&&!file[react-rails-tutorial]:app/assets/fonts//*&&!file[react-rails-tutorial]:bin//*&&!file[react-rails-tutorial]:app/assets/javascripts//*
266266

@@ -289,7 +289,7 @@ WebStorm opened up to the `client` directory to focus on JSX and Sass files.
289289

290290
# Misc Tips
291291

292-
## Cleanup local branches merged to master
292+
## Cleanup local branches merged to master
293293
```
294294
alias git-cleanup-merged-branches='git branch --merged master | grep -v master | xargs git branch -d'
295295
```

‎app/assets/javascripts/application.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
// Need to be on top to allow Poltergeist test to work with React.
1414
//= require es5-shim/es5-shim
1515

16-
// It is important that generated/client-bundle must be before bootstrap since it is exposing jQuery and jQuery-ujs
17-
//= require generated/client-bundle
16+
// It is important that generated/vendor-bundle must be before bootstrap since it is exposing jQuery and jQuery-ujs
17+
//= require generated/vendor-bundle
18+
//= require generated/app-bundle
19+
1820
//= require bootstrap-sprockets
1921
//= require turbolinks

‎app/controllers/pages_controller.rb‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
class PagesController < ApplicationController
22
def index
3+
@comments = Comment.all
34
end
45
end

‎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', {}, generator_function: true, prerender: true) %>
19+
<%= react_component('App', @comments, generator_function: true, prerender: true) %>

‎client/.eslintrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,4 @@ env:
1313
rules:
1414
indent: [1, 2, { SwitchCase: 1, VariableDeclarator: 2 }]
1515
react/sort-comp: 0
16-
react/jsx-quotes: 0
16+
react/jsx-quotes: 1

‎client/.jscsrc‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{
22
"preset": "airbnb",
33
"fileExtensions": [".js", ".jsx"],
4-
"excludeFiles": ["build/**", "node_modules/**"]
4+
"excludeFiles": ["build/**", "node_modules/**"],
5+
6+
"validateQuoteMarks": null // Issue with JSX quotemarks: https://github.com/jscs-dev/babel-jscs/issues/12
57
}

0 commit comments

Comments
(0)

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