react_on_rails 6.7.1 → 6.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0c58c7ed04a4a64f4e0215a9d409f8628a66a988
4
- data.tar.gz: a12a656c9a33e5f6c3fbdb71e4f0811a60b99ad5
3
+ metadata.gz: 2f90e045e3a38a60fd6d8c18a5fdc0f4394aa823
4
+ data.tar.gz: 20a924ea4c4c26fb07fb142a5735b3375e793299
5
5
  SHA512:
6
- metadata.gz: ac418a4fc783db738ced2316c41e8f4031dcfd01eb50bf3afe0cce47470362ac0d212384a93be4a6d566cd110d2027205e7bd4fc840ee8c9b5952366fc26b749
7
- data.tar.gz: a26293687d1ff59f02287ff5fb469b907f5eff5325d62833e2df1899d4bff6a2bf2d781826ffd4dda8b7ef6d1dd95f7207633bc9f069a4964283fefe72442b27
6
+ metadata.gz: 702935c99d5931284d920de52796f9479225055506a8833f525ac2e9fb7a4072aaf43277a5ce18ee3378ae6a0c9bdc1abeb06dc450b99253b6ac0d753129cde6
7
+ data.tar.gz: 1ea4f4477fac7e352ab972ea141fbbbcf5c0fde0d730063adaaa3daee8d363003154786f26ef46095992f796a0a4c9d8902b78ed2354b29f02453cda01783981
data/CHANGELOG.md CHANGED
@@ -5,9 +5,28 @@ Contributors: please follow the recommendations outlined at [keepachangelog.com]
5
5
 
6
6
  ## [Unreleased]
7
7
  *Please add entries here for your pull requests.*
8
+ ## [6.7.2] - 2017-03-05
9
+ ### Improved
10
+ - Improve i18n Integration with a better error message if the value of the i18n directory is invalid. [#748](https://github.com/shakacode/react_on_rails/pull/748) by [justin808](https://github.com/justin808).
11
+
12
+ ## [6.7.1] - 2017-02-28
13
+ No changes other than a test fix.
8
14
 
9
15
  ## [6.7.0] - 2017-02-28
10
16
 
17
+ ### IMPORTANT
18
+ - If you installed 6.6.0, you will need to comment out the line matching i18n_dir unless you are using this feature. 6.7.1 will give you an error like:
19
+
20
+ ```
21
+ Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/build_1444a5bb9dd16ddb2561c7aff40f0fc7/my-app-816d31e9896edd90cecf1402acd002c724269333/client/app/libs/i18n/translations.js
22
+ ```
23
+
24
+ Commenting out this line addresses the issue:
25
+
26
+ ```
27
+ config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n")
28
+ ```
29
+
11
30
  ### Added
12
31
  - Allow using rake task to generate javascript locale files. The test helper automatically creates the localization files when needed. [#717](https://github.com/shakacode/react_on_rails/pull/717) by [JasonYCHuang](https://github.com/JasonYCHuang).
13
32
 
@@ -190,7 +209,7 @@ Here is the addition to the generated config file:
190
209
  - Support for Node.js server side rendering. See [#380](https://github.com/shakacode/react_on_rails/pull/380) by [alleycat](https://github.com/alleycat-at-git) and [doc](https://github.com/shakacode/react_on_rails/blob/master/docs/additional-reading/node-server-rendering.md)
191
210
 
192
211
  ##### Removed
193
- - Generator removals to simplify installer. See [#363](https://github.com/shakacode/react_on_rails/pull/363) by [jbhatab](https://github.com/jbhatab).
212
+ - Generator removals to simplify installer. See [#364](https://github.com/shakacode/react_on_rails/pull/364) by [jbhatab](https://github.com/jbhatab).
194
213
  - Removed options for heroku, boostrap, and the linters from generator.
195
214
  - Removed install for the Webpack Dev Server, as we can now do hot reloading with Rails, so the complexity of this feature is not justified. Nevertheless, the setup of React on Rails still supports this setup, just not with the generator.
196
215
  - Documentation added for removed installer options.
@@ -461,7 +480,9 @@ Best done with Object destructing:
461
480
  ##### Fixed
462
481
  - Fix several generator related issues.
463
482
 
464
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.7.0...master
483
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.7.2...master
484
+ [6.7.2]: https://github.com/shakacode/react_on_rails/compare/6.7.1...6.7.2
485
+ [6.7.1]: https://github.com/shakacode/react_on_rails/compare/6.7.0...6.7.1
465
486
  [6.7.0]: https://github.com/shakacode/react_on_rails/compare/6.6.0...6.7.0
466
487
  [6.6.0]: https://github.com/shakacode/react_on_rails/compare/6.5.1...6.6.0
467
488
  [6.5.1]: https://github.com/shakacode/react_on_rails/compare/6.5.0...6.5.1
data/PROJECTS.md CHANGED
@@ -22,11 +22,15 @@
22
22
 
23
23
  ## Open Source Projects Live
24
24
  * [github.com/empirical-org/Empirical-Core](https://github.com/empirical-org/Empirical-Core): [Quill.org](https://quill.org/) Provides free tools to make your students better writers.
25
+ * **[Coderwall](https://coderwall.com/)**: The latest development and design tips, tools, and projects from our developer community. Source at [github.com/coderwall/coderwall-next](https://github.com/coderwall/coderwall-next)
26
+ * [department-of-veterans-affairs/caseflow](https://github.com/department-of-veterans-affairs/caseflow): Caseflow is a web application that enables the tracking and processing of appealed claims at the Board of Veterans' Appeals.
25
27
 
26
28
  ## Demos and Tutorials
27
29
  * [reactrails.com](http://www.reactrails.com), source code [github.com/shakacode/react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial/)
28
30
  * [Relay Rails Blog](https://github.com/gauravtiwari/relay-rails-blog): Tutorial to learn Relay with Rails.
29
- * [Hot Module Replacement with react_on_rails](https://medium.com/@hrishio/lesson-5-hot-module-replacement-for-react-in-rails-using-the-react-on-rails-gem-643c5b01f3d7#.ehevxok16) : Step-by-step tutorial for a quick basic set up of hot asset reloading with HMR in a Rails 5 app. [Code on Github](https://github.com/learnetto/calreact-hmr)
31
+ * [Hot Module Replacement with react_on_rails](https://medium.com/@hrishio/lesson-5-hot-module-replacement-for-react-in-rails-using-the-react-on-rails-gem-643c5b01f3d7#.ehevxok16) : Step-by-step tutorial for a quick basic set up of hot asset reloading with HMR in a Rails 5 app. [Code on Github](https://github.com/learnetto/calreact-hmr).....
32
+
33
+ ## Per Github.
30
34
 
31
35
  --------
32
36
 
data/README.md CHANGED
@@ -47,6 +47,7 @@ For more testimonials, see [Live Projects](PROJECTS.md) and [Kudos](./KUDOS.md).
47
47
  * [284 Ruby Rogues: React on Rails with Justin Gordon and Rob Wise](https://devchat.tv/ruby-rogues/284-rr-react-on-rails-with-justin-gordon-and-rob-wise)
48
48
 
49
49
  # NEWS
50
+ * 2017-03-02: Demo of internationalization (i18n) is live at [reactrails.com](https://www.reactrails.com/). Docs [here](docs/basics/i18n.md).
50
51
  * 2017-02-28: See [discussions here on Webpacker](https://github.com/rails/webpacker/issues/139) regarding how Webpacker will allow React on Rails to avoid using the asset pipeline in the near future.
51
52
  * 2017-02-28: Upgrade to Webpack v2 or use the `--bail` option in your webpack script for test and production builds. See the discussion on [PR #730](https://github.com/shakacode/react_on_rails/pull/730).
52
53
  * 2016-11-03: Spoke at [LA Ruby: "React on Rails: Why, What, and How?"](http://www.meetup.com/laruby/events/234825187/). [Video and pictures in this article](https://blog.shakacode.com/my-react-on-rails-talk-at-the-la-ruby-rails-meetup-november-10-2016-eaaa83aff800#.ej6h4eglp).
data/SUMMARY.md CHANGED
@@ -6,6 +6,7 @@
6
6
  + [Rails View Rendering from Inline JavaScript](./docs/additional-reading/rails_view_rendering_from_inline_javascript.md)
7
7
  + [RSpec Configuration](./docs/additional-reading/rspec-configuration.md)
8
8
  + [Turbolinks](./docs/additional-reading/turbolinks.md)
9
+ + [React on Rails Internationalization (I18n)](https://github.com/shakacode/react_on_rails/blob/master/docs/basics/i18n.md)
9
10
 
10
11
  ### **Javascript**
11
12
  + [Node Dependencies, NPM, and Yarn](./docs/additional-reading/node-dependencies-and-npm.md)
@@ -42,3 +42,8 @@ This technique involves customization of the webpack config files to generate CS
42
42
  1. You can use [CSS modules](https://github.com/css-modules/css-modules), which is super compelling once you seen the benefits.
43
43
  1. You can do hot reloading of your assets. Thus, you do not have to refresh your web page to see asset change, including changing styles.
44
44
  1. You can run your client code on a mocked out express server for super fast prototyping. In other words, your client application can somewhat more easily be move to a different application server.
45
+
46
+ #### Updates 2017-03-04 Regarding CSS handled by Webpack
47
+ * See article [Best practices for CSS and CSS Modules using Webpack](https://forum.shakacode.com/t/best-practices-for-css-and-css-modules-using-webpack/799).
48
+ * In the near future, all docs will be updated to Webpack v2 and probably recommended to move all CSS handling to Webpack v2 for advanced users. In the near term, global CSS handled by Rails will be best for simple projects. Another data point is that Rails is moving in direction of handling JavaScript, but not CSS, with [Webpacker](https://github.com/rails/webpacker).
49
+
data/docs/basics/i18n.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Here's a summary of adding the I18n functionality.
4
4
 
5
- You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) and [PR #340](https://github.com/shakacode/react-webpack-rails-tutorial/pull/340) for a complete example.
5
+ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/react-webpack-rails-tutorial) and [PR #340](https://github.com/shakacode/react-webpack-rails-tutorial/pull/340), [commmited](https://github.com/shakacode/react-webpack-rails-tutorial/commit/ef369ed9d922aea5116ca7e50208169fd7831389) for a complete example.
6
6
 
7
7
  1. Add `react-intl` & `intl` to `client/package.json`, and remember to `bundle && yarn install`.
8
8
 
@@ -15,40 +15,23 @@ You can refer to [react-webpack-rails-tutorial](https://github.com/shakacode/rea
15
15
  }
16
16
  ```
17
17
 
18
- 2. In `client/webpack.client.base.config.js`, set `react-intl` as an entry point.
19
-
20
- ```js
21
- module.exports = {
22
- ...
23
- entry: {
24
- ...
25
- vendor: [
26
- ...
27
- 'react-intl',
28
- ],
29
- ...
30
- ```
31
-
32
- 3. `react-intl` requires locale files in json format. React on Rails will help you to generate or update `translations.js` & `default.js` automatically after you configured the following settings.
18
+ 2. Add `config.i18n_dir` in `config/initializers/react_on_rails.rb`
33
19
 
34
- > `translations.js`: All your locales in json format.
35
- >
36
- > `default.js`: Default settings in json format.
37
- >
38
- > You can add them to `.gitignore` and `.eslintignore`.
39
-
40
- Update settings in `config/initializers/react_on_rails.rb` to what you need:
20
+ `react-intl` requires locale files in json format. React on Rails will generate `translations.js` & `default.js` automatically after you configured your `config.i18n_dir` in `config/initializers/react_on_rails.rb`.
41
21
 
42
22
  ```ruby
43
23
  # Replace the following line to the location where you keep translation.js & default.js.
44
24
  config.i18n_dir = Rails.root.join("PATH_TO", "YOUR_JS_I18N_FOLDER")
45
25
  ```
26
+
27
+ `translations.js`: All your locales in json format.
28
+ `default.js`: Default settings in json format.
46
29
 
30
+ 3. Add `translations.js` and `default.js` to your `.gitignore` and `.eslintignore`.
31
+
47
32
  4. Javascript locale files must be generated before `yarn build`.
48
33
 
49
- Once you setup `config.i18n_dir` as in the previous step, react_on_rails will help you to do this for testing and for production deployments. For development, you should adjust your Procfiles so that they run `bundle exec rake react_on_rails:locale` before running the `yarn run build:development` (webpack watch process)
50
-
51
- If you create your own Procfile files, you must add `bundle exec rake react_on_rails:locale` before `yarn build`.
34
+ Once you setup `config.i18n_dir` as in the previous step, react_on_rails will automatically do this for testing (if using the `ReactOnRails::TestHelper.configure_rspec_to_compile_assets` and for production deployments if using the [default precompile rake hook](../additional-reading/heroku-deployment.md). For development, you should adjust your startup scripts (Procfiles) so that they run `bundle exec rake react_on_rails:locale` before running any webpack watch process (`yarn run build:development`).
52
35
 
53
36
  5. In React, you need to initialize `react-intl`, and set parameters for it.
54
37
 
data/docs/tutorial.md CHANGED
@@ -1,18 +1,14 @@
1
1
  # React on Rails Basic Tutorial
2
2
 
3
- This tutorial setups up a new Rails app with **React on Rails**, demonstrating Rails + React + Redux + Server Rendering.
3
+ This tutorial setups up a new Rails app with **React on Rails**, demonstrating Rails + React + Redux + Server Rendering. It is updated to 6.7.1.
4
4
 
5
5
  After finishing this tutorial you will get application that can do the following (live on Heroku):
6
6
 
7
7
  ![example](https://cloud.githubusercontent.com/assets/371302/17368567/111cc722-596b-11e6-9b72-ac5967a60e42.gif)
8
8
 
9
9
  You can find here:
10
- * [Source code for this app](https://github.com/dzirtusss/hello-react-on-rails)
11
- * [Live on Heroku](https://hello-react-on-rails.herokuapp.com/)
12
-
13
- Old version of this app is here:
14
- * [Source code](https://github.com/justin808/test-react-on-rails-3)
15
- * [Live on Heroku](https://shakacode-react-on-rails.herokuapp.com/hello_world)
10
+ * [Source code for this app in PR, using the --redux option](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/15) and [for Heroku](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/16).
11
+ * [Live on Heroku](https://react-on-rails-redux-generator.herokuapp.com/)
16
12
 
17
13
  By the time you read this, the latest may have changed. Be sure to check the versions here:
18
14
 
@@ -69,7 +65,7 @@ git add -A
69
65
  git commit -m "Initial commit"
70
66
  ```
71
67
 
72
- update dependencies and generate empty app via `react_on_rails:install`. If you haven't done first git commit it will generate error and you just need to commit.
68
+ update dependencies and generate empty app via `react_on_rails:install` or `react_on_rails:install --redux`. You need to first git commit your files before running the generator, or else it will generate an error.
73
69
 
74
70
  ```
75
71
  bundle
@@ -181,6 +177,32 @@ root "hello_world#index"
181
177
 
182
178
  ![09](https://cloud.githubusercontent.com/assets/20628911/17465018/1f3b685e-5cf4-11e6-93f8-105fc48517d0.png)
183
179
 
180
+ Next, configure your app for Puma, per the [instructions on Heroku](https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server).
181
+
182
+ `Procfile`
183
+ ```
184
+ web: bundle exec puma -C config/puma.rb
185
+ ```
186
+
187
+ `config/puma.rb`
188
+ ```rb
189
+ workers Integer(ENV['WEB_CONCURRENCY'] || 2)
190
+ threads_count = Integer(ENV['RAILS_MAX_THREADS'] || 5)
191
+ threads threads_count, threads_count
192
+
193
+ preload_app!
194
+
195
+ rackup DefaultRackup
196
+ port ENV['PORT'] || 3000
197
+ environment ENV['RACK_ENV'] || 'development'
198
+
199
+ on_worker_boot do
200
+ # Worker specific setup for Rails 4.1+
201
+ # See: https://devcenter.heroku.com/articles/deploying-rails-applications-with-the-puma-web-server#on-worker-boot
202
+ ActiveRecord::Base.establish_connection
203
+ end
204
+ ```
205
+
184
206
  Then after all changes are done don't forget to commit them with git and finally you can push your app to Heroku!
185
207
 
186
208
  ```
@@ -191,9 +213,11 @@ git push heroku master
191
213
 
192
214
  ![10](https://cloud.githubusercontent.com/assets/20628911/17465017/1f38fbaa-5cf4-11e6-8d86-a3d91e3878e0.png)
193
215
 
194
- Here it is:
216
+ ## Links
217
+ These are updated for 6.7.1:
195
218
 
196
- * [Source code for this sample app](https://github.com/dzirtusss/hello-react-on-rails)
219
+ * [PR for using the generator with the Redux option](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/15)
220
+ * [PR showing the changes to deploy to Heroku](https://github.com/shakacode/react_on_rails-test-new-redux-generation/pull/16)
197
221
  * [Live on Heroku](https://hello-react-on-rails.herokuapp.com/)
198
222
 
199
223
  Feedback is greatly appreciated! As are stars on github! If you want personalized help, don't hesitate to get in touch with us at [contact@shakacode.com](mailto:contact@shakacode.com).
@@ -62,7 +62,8 @@ ReactOnRails.configure do |config|
62
62
  ################################################################################
63
63
  # I18N OPTIONS
64
64
  ################################################################################
65
- # Replace the following line to the location where you keep translation.js & default.js.
65
+ # Replace the following line to the location where you keep translation.js & default.js for use
66
+ # by the npm packages react-intl. Be sure this directory exists!
66
67
  # config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n")
67
68
 
68
69
  ################################################################################
@@ -11,6 +11,16 @@ module ReactOnRails
11
11
  configure_generated_assets_dirs_deprecation
12
12
  ensure_generated_assets_dir_present
13
13
  ensure_server_bundle_js_file_has_no_path
14
+ check_i18n_directory_exists
15
+ end
16
+
17
+ def self.check_i18n_directory_exists
18
+ return unless @configuration.i18n_dir.present?
19
+ return if Dir.exist?(@configuration.i18n_dir)
20
+
21
+ raise "Error configuring /config/react_on_rails.rb: invalid value for `config.i18n_dir`. "\
22
+ "Directory does not exist: #{@configuration.i18n_dir}. Set to value to nil or comment it "\
23
+ "out if not using this i18n with React on Rails."
14
24
  end
15
25
 
16
26
  def self.ensure_generated_assets_dir_present
@@ -3,6 +3,7 @@ require "erb"
3
3
  module ReactOnRails
4
4
  class LocalesToJs
5
5
  def initialize
6
+ return unless i18n_dir.present?
6
7
  return unless obsolete?
7
8
  @translations, @defaults = generate_translations
8
9
  convert
@@ -38,7 +39,8 @@ module ReactOnRails
38
39
  end
39
40
 
40
41
  def locale_files
41
- @locale_files ||= Rails.application.config.i18n.load_path
42
+ @locale_files ||=
43
+ (Rails.application && Rails.application.config.i18n.load_path).presence
42
44
  end
43
45
 
44
46
  def i18n_dir
@@ -27,9 +27,7 @@ module ReactOnRails
27
27
  # Be sure we don't do this again.
28
28
  self.class.has_been_run = true
29
29
 
30
- if ReactOnRails.configuration.i18n_dir.present? && Rails.application.present?
31
- ReactOnRails::LocalesToJs.new
32
- end
30
+ ReactOnRails::LocalesToJs.new
33
31
 
34
32
  stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files
35
33
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ReactOnRails
3
- VERSION = "6.7.1".freeze
3
+ VERSION = "6.7.2".freeze
4
4
  end
@@ -7,8 +7,6 @@ This task generates javascript locale files: `translations.js` & `default.js` an
7
7
  the "ReactOnRails.configuration.i18n_dir".
8
8
  DESC
9
9
  task locale: :environment do
10
- if ReactOnRails.configuration.i18n_dir.present?
11
- ReactOnRails::LocalesToJs.new
12
- end
10
+ ReactOnRails::LocalesToJs.new
13
11
  end
14
12
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "6.7.1",
3
+ "version": "6.7.2",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -42,4 +42,17 @@ Gem::Specification.new do |s|
42
42
  s.add_development_dependency "binding_of_caller"
43
43
  s.add_development_dependency "awesome_print"
44
44
  s.add_development_dependency "gem-release"
45
+
46
+ s.post_install_message = %(
47
+ React on Rails installed! See https://github.com/shakacode/react_on_rails for documentation
48
+ and source code.
49
+
50
+ You can email contact@shakacode.com for support questions or access to our public slack room.
51
+
52
+ For custom application development work or coaching on integrating React with Rails,
53
+ visit http://www.shakacode.com
54
+
55
+ For more information on the generators, run:
56
+ rails generate react_on_rails:install --help
57
+ )
45
58
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react_on_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.7.1
4
+ version: 6.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Gordon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -435,7 +435,12 @@ homepage: https://github.com/shakacode/react_on_rails
435
435
  licenses:
436
436
  - MIT
437
437
  metadata: {}
438
- post_install_message:
438
+ post_install_message: "\n React on Rails installed! See https://github.com/shakacode/react_on_rails
439
+ for documentation\n and source code.\n\n You can email contact@shakacode.com
440
+ for support questions or access to our public slack room.\n\n For custom application
441
+ development work or coaching on integrating React with Rails,\n visit http://www.shakacode.com\n\n
442
+ \ For more information on the generators, run:\n rails generate react_on_rails:install
443
+ --help\n "
439
444
  rdoc_options: []
440
445
  require_paths:
441
446
  - lib