react_on_rails 6.8.0 → 6.8.1

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: d813add5f006c6deca243a7504707a2cc4e6373c
4
- data.tar.gz: 2d354c343883a102b500f6d7131e6d8b2d72b640
3
+ metadata.gz: dc8f8c909150f3c94e83be4c4bfd84e825719bd9
4
+ data.tar.gz: a781fe780fcbed2447441b0f897f6b8b7dd2a2f1
5
5
  SHA512:
6
- metadata.gz: 2cdec4b31916d1eb5267f71bdd9597dadf898a905234ff6e93879c6760045b99ea4793baea90d01cb0b590f994f82c2fd0dc00bae462d79a7b421f5d4edbc378
7
- data.tar.gz: 783214e29c1f16cc991a9d1e4e9f9a10ddeefa56a1818cb0568538a463d48615e31d46769e1f0d78a0d614dd28f392fe31e7ba2f7361511418e926c75b4734a6
6
+ metadata.gz: b350e72c6b4ab2ea3a634112ec02bbbf4f063301bc8e4ab10c0f7bbfeecf3f7a12f42722f5057c9b57c5e32b67ad1584674342448134b46be2b4e8f558f5a1e7
7
+ data.tar.gz: ad7c94f6049fbce20494dc0be0c0fbaf0cdbbc5bd441dae460df912117e7753ebea44a65ef2dddb402009e82f14e22879fcf25809ce561a7efadea4de5563312
data/.eslintignore CHANGED
@@ -10,3 +10,4 @@ node_package/webpack.config.js
10
10
  **/generated/**
11
11
  **/app/assets/javascripts/application.js
12
12
  **/coverage/**
13
+ **/cable.js
data/.travis.yml CHANGED
@@ -5,7 +5,8 @@ language: ruby
5
5
  rvm:
6
6
  # Ruby 2.0.0 fails due to newer Nokogir
7
7
  # nokogiri-1.7.0.1 requires ruby version >= 2.1.0, which is incompatible with the current version, ruby 2.0.0p648
8
- - 2.1.10
8
+ # Rails 5 requires 2.2
9
+ # - 2.1.10
9
10
  - 2.2.6
10
11
  - 2.3.1
11
12
  services:
@@ -25,7 +26,6 @@ env:
25
26
  - RAILS_ENV=test
26
27
  - DRIVER=selenium_chrome
27
28
  - CHROME_BIN=/usr/bin/google-chrome
28
- - ENABLE_TURBOLINKS_5=TRUE
29
29
  - USE_COVERALLS=TRUE
30
30
 
31
31
  before_install:
@@ -36,11 +36,11 @@ before_install:
36
36
  - "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen scn 1600x1200x16"
37
37
 
38
38
  install:
39
- - nvm install node
39
+ - travis_retry nvm install node
40
40
  - node -v
41
- - npm i -g yarn@0.20.3
42
- - yarn
43
- - bundle install
41
+ - travis_retry npm i -g yarn@0.20.3
42
+ - travis_retry yarn
43
+ - travis_retry bundle install
44
44
  - rake dummy_apps
45
45
  - rake examples
46
46
  - rake node_package
data/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ 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
+
9
+ ## [6.8.1] - 2017-03-21
10
+ ### Fixed
11
+ - Fixed error "The node you're attempting to unmount was rendered by another copy of React." [#706](https://github.com/shakacode/react_on_rails/issues/706) when navigating to cached page using Turbolinks [#763](https://github.com/shakacode/react_on_rails/pull/763) by [szyablitsky](https://github.com/szyablitsky).
12
+
8
13
  ## [6.8.0] - 2017-03-06
9
14
  ## Added
10
15
  - Converted to Webpack v2 for generators, tests, and all example code. [#742](https://github.com/shakacode/react_on_rails/pull/742) by [justin808](https://github.com/justin808).
@@ -29,7 +34,7 @@ Commenting out this line addresses the issue:
29
34
 
30
35
  ```
31
36
  config.i18n_dir = Rails.root.join("client", "app", "libs", "i18n")
32
- ```
37
+ ```
33
38
 
34
39
  ### Added
35
40
  - 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).
@@ -484,7 +489,8 @@ Best done with Object destructing:
484
489
  ##### Fixed
485
490
  - Fix several generator related issues.
486
491
 
487
- [Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.8.0...master
492
+ [Unreleased]: https://github.com/shakacode/react_on_rails/compare/6.8.1...master
493
+ [6.8.1]: https://github.com/shakacode/react_on_rails/compare/6.8.0...6.8.1
488
494
  [6.8.0]: https://github.com/shakacode/react_on_rails/compare/6.7.2...6.8.0
489
495
  [6.7.2]: https://github.com/shakacode/react_on_rails/compare/6.7.1...6.7.2
490
496
  [6.7.1]: https://github.com/shakacode/react_on_rails/compare/6.7.0...6.7.1
data/CONTRIBUTING.md CHANGED
@@ -44,7 +44,8 @@ When making doc changes, we want the change to work on both the gitbook and the
44
44
  ## To run tests:
45
45
  * After updating code via git, to prepare all examples and run all tests:
46
46
 
47
- ```
47
+ ```sh
48
+ cd react_on_rails/
48
49
  bundle && yarn && rake examples:prepare_all && rake node_package && rake
49
50
  ```
50
51
 
@@ -72,9 +73,17 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
72
73
  * /spec/react_on_rails/dummy-for-generators
73
74
 
74
75
  # Configuring your test app to use your local fork
76
+ You can test the `react-on-rails` gem using your own external test app or the gem's internal `spec/dummy` app. The `spec/dummy` app is an example of the various setup techniques you can use with the gem.
77
+ ```
78
+ ├── test
79
+ | └── client
80
+ └── react_on_rails
81
+ └── spec
82
+ └── dummy
83
+ ```
75
84
 
76
- ## Ruby Gem
77
- If you want to test the gem with an application before you release a new version of the gem, you can specify the path to your local version via your test app's Gemfile:
85
+ ## Testing the Ruby Gem
86
+ If you want to test the ruby parts of the gem with an application before you release a new version of the gem, you can specify the path to your local version via your test app's Gemfile:
78
87
 
79
88
  ```ruby
80
89
  gem "react_on_rails", path: "../path-to-react-on-rails"
@@ -82,22 +91,31 @@ gem "react_on_rails", path: "../path-to-react-on-rails"
82
91
 
83
92
  Note that you will need to bundle install after making this change, but also that **you will need to restart your Rails application if you make any changes to the gem**.
84
93
 
85
- ## NPM for react-on-rails
86
- First, be **sure** to build the NPM package
94
+ ## Testing the Node package for react-on-rails
95
+ In addition to testing the Ruby parts out, you can also test the node package parts of the gem with an external application. First, be **sure** to build the NPM package:
87
96
 
88
97
  ```sh
98
+ cd react_on_rails/
89
99
  yarn
90
100
  yarn run build
91
101
  ```
92
102
 
93
- Use a relative path in your `package.json`, like this:
103
+ Install the local package by using a relative path in your test/client app's `package.json`, like this:
94
104
  ```sh
95
- cd client
96
- yarn add "react-on-rails@../../react_on_rails"
105
+ cd test/client
106
+ npm i --save 'react-on-rails@../path-to-react-on-rails'
97
107
  ```
108
+ _Note: You must use npm here till yarn stops preferring cached packages over local. see [issue #2649](https://github.com/yarnpkg/yarn/issues/2649)_
98
109
 
99
110
  When you use a relative path, be sure to run the above `yarn` command whenever you change the node package for react-on-rails.
100
111
 
112
+ #### Example: Testing NPM changes with the dummy app
113
+ 1. Add `console.log('Hello!')` [here](https://github.com/shakacode/react_on_rails/blob/master/node_package/src/clientStartup.js#L181) in `react_on_rails/node_package/src/clientStartup.js` to confirm we're getting an update to the node package.
114
+ 2. Run the install script `npm run install-react-on-rails` in `react_on_rails/spec/dummy` to copy over our changes to the dummy app. Alternatively, you can run `npm i --save 'file:../../../'` in `react_on_rails/spec/dummy/client`. Our NPM changes are now available in the dummy app.
115
+ 3. Refresh the browser if the server is already running or start the server using `foreman start` from `react_on_rails/spec/dummy` and navigate to `http://localhost:5000/`. You will now see the `Hello!` message printed in the browser's console.
116
+
117
+ _Note: running `npm i` automatically builds the npm package before installing. However, when using yarn you will need to run `yarn run build` in the root directory before the install script. This will be updated when yarn issue #2649 (above) is resolved._
118
+
101
119
  # Development Setup for Gem and Node Package Contributors
102
120
 
103
121
  ## Checklist before Committing
@@ -119,11 +137,13 @@ yarn global add phantomjs
119
137
  Note this *must* be installed globally for the dummy test project rspec runner to see it properly.
120
138
 
121
139
  ### Local Node Package
122
- Because the example and dummy apps rely on the react-on-rails node package, they should link directly to your local version to pick up any changes you may have made to that package. To achieve this, switch to the test app's root directory and run this command below which runs something like [this script](spec/dummy/package.json#L14)
140
+ Because the example and dummy apps rely on the react-on-rails node package, they should link directly to your local version to pick up any changes you may have made to that package. To achieve this, switch to the dummy app's root directory and run this command below which runs something like [this script](spec/dummy/package.json#L14)
123
141
 
124
142
  ```sh
143
+ cd react_on_rails/spec/dummy
125
144
  yarn run install-react-on-rails
126
145
  ```
146
+ _Note: this runs npm under the hood as explained in **Test NPM for react-on-rails** section above_
127
147
 
128
148
  From now on, the example and dummy apps will use your local node_package folder as the react-on-rails node package. This will also be done automatically for you via the `rake examples:prepare_all` rake task.
129
149
 
@@ -141,9 +161,9 @@ From now on, the example and dummy apps will use your local node_package folder
141
161
  ### Install NPM dependencies and build the NPM package for react-on-rails
142
162
 
143
163
  ```sh
144
- cd <top level>
164
+ cd react_on_rails/
145
165
  yarn
146
- npm build
166
+ yarn build
147
167
  ```
148
168
 
149
169
  Or run this which builds the yarn package, then the webpack files for spec/dummy, and runs tests in
@@ -153,40 +173,40 @@ spec/dummy.
153
173
  ```sh
154
174
  # Optionally change default selenium_firefox driver
155
175
  export DRIVER=poltergeist
156
- cd <top level>
176
+ cd react_on_rails/
157
177
  yarn run dummy:spec
158
178
  ```
159
179
 
160
180
  ### Run NPM JS tests
161
181
 
162
182
  ```sh
163
- cd <top level>
183
+ cd react_on_rails/
164
184
  yarn test
165
185
  ```
166
186
 
167
187
  ### Run spec/dummy tests
168
188
 
169
189
  ```sh
170
- cd spec/dummy
190
+ cd react_on_rails/spec/dummy
171
191
  rspec
172
192
  ```
173
193
 
174
194
  Eventually, we may have JS tests:
175
195
 
176
196
  ```sh
177
- cd spec/dummy/client
197
+ cd react_on_rails/spec/dummy/client
178
198
  yarn run test
179
199
  ```
180
200
 
181
201
  ### Run most tests and linting
182
202
 
183
203
  ```sh
184
- cd <top level>
185
- npm run check
204
+ cd react_on_rails/
205
+ yarn run check
186
206
  ```
187
207
 
188
208
  ### Starting the Dummy App
189
- To run the test app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start`. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.
209
+ To run the dummy app, it's **CRITICAL** to not just run `rails s`. You have to run `foreman start`. If you don't do this, then `webpack` will not generate a new bundle, and you will be seriously confused when you change JavaScript and the app does not change. If you change the webpack configs, then you need to restart foreman. If you change the JS code for react-on-rails, you need to run `yarn run build`. Since the react-on-rails package should be sym linked, you don't have to `yarn react-on-rails` after every change.
190
210
 
191
211
  ### RSpec Testing
192
212
  Run `rake` for testing the gem and `spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `spec/dummy`.
@@ -195,7 +215,7 @@ If you run `rspec` at the top level, you'll see this message: `require': cannot
195
215
 
196
216
  After running a test, you can view the coverage results SimpleCov reports by opening `coverage/index.html`.
197
217
 
198
- To test `spec/dummy` against Turbolinks 5, install the gem by running `ENABLE_TURBOLINKS_5=TRUE bundle install` in the `spec/dummy` directory before running `rake`.
218
+ To test `spec/dummy` against Turbolinks 2, install the gem by running `ENABLE_TURBOLINKS_2=TRUE bundle install` in the `spec/dummy` directory before running `rake`. Turbolinks 5 is the default.
199
219
 
200
220
  Run `rake -T` or `rake -D` to see testing options.
201
221
 
data/Gemfile CHANGED
@@ -22,10 +22,10 @@ gem "sdoc", "~> 0.4.0", group: :doc
22
22
  gem "spring"
23
23
  gem "sqlite3"
24
24
  gem "mini_racer"
25
- if ENV["ENABLE_TURBOLINKS_5"].nil? || ENV["ENABLE_TURBOLINKS_5"].strip.empty?
26
- gem "turbolinks", "2.5.3"
27
- else
25
+ if ENV["ENABLE_TURBOLINKS_2"].nil? || ENV["ENABLE_TURBOLINKS_2"].strip.empty?
28
26
  gem "turbolinks", "~> 5.0"
27
+ else
28
+ gem "turbolinks", "2.5.3"
29
29
  end
30
30
  gem "uglifier", ">= 2.7.2"
31
31
  gem "web-console", "~> 2.0", group: :development
@@ -35,7 +35,8 @@ gem "rspec-rails"
35
35
  gem "rspec-retry"
36
36
  gem "capybara"
37
37
  gem "capybara-screenshot"
38
- gem "capybara-webkit"
38
+ # Trouble installing on Sierra
39
+ # gem "capybara-webkit"
39
40
  gem "chromedriver-helper"
40
41
  gem "launchy"
41
42
  gem "poltergeist"
@@ -157,7 +157,7 @@ module.exports = {
157
157
  })
158
158
  ],
159
159
  module: {
160
- loaders: [
160
+ rules: [
161
161
  {
162
162
  test: /\.jsx?$/,
163
163
  loader: 'babel-loader',
@@ -165,16 +165,24 @@ module.exports = {
165
165
  },
166
166
  {
167
167
  test: require.resolve('react'),
168
- loader: 'imports?shim=es5-shim/es5-shim&sham=es5-shim/es5-sham',
168
+ use: {
169
+ loader: 'imports-loader',
170
+ options: {
171
+ shim: 'es5-shim/es5-shim',
172
+ sham: 'es5-shim/es5-sham',
173
+ },
174
+ }
169
175
  },
170
176
  {
171
177
  // The important stuff
172
178
  test: /\.(jpg|jpeg|png)(\?.*)?$/, // Load only .jpg .jpeg, and .png files
173
- loader: 'file-loader',
174
- query: {
175
- name: '[name][md5:hash].[ext]', // Name of bundled asset
176
- outputPath: 'webpack-assets/', // Output location for assets. Final: `app/assets/webpack/webpack-assets/`
177
- publicPath: '/assets/webpack-assets/' // Endpoint asset can be found at on Rails server
179
+ use: {
180
+ loader: 'file-loader',
181
+ options: {
182
+ name: '[name][md5:hash].[ext]', // Name of bundled asset
183
+ outputPath: 'webpack-assets/', // Output location for assets. Final: `app/assets/webpack/webpack-assets/`
184
+ publicPath: '/assets/webpack-assets/' // Endpoint asset can be found at on Rails server
185
+ }
178
186
  }
179
187
  }
180
188
  ]
@@ -94,7 +94,7 @@ TURBO: reactOnRailsPageLoaded
94
94
 
95
95
  Turbolinks 5:
96
96
  ```
97
- TURBO: WITH TURBOLINKS 5: document turbolinks:before-render and turbolinks:load handlers installed. (program)
97
+ TURBO: WITH TURBOLINKS 5: document turbolinks:before-render and turbolinks:render handlers installed. (program)
98
98
  TURBO: reactOnRailsPageLoaded
99
99
  ```
100
100
 
@@ -1,3 +1,3 @@
1
1
  module ReactOnRails
2
- VERSION = "6.8.0".freeze
2
+ VERSION = "6.8.1".freeze
3
3
  end
data/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-on-rails",
3
- "version": "6.8.0",
3
+ "version": "6.8.1",
4
4
  "description": "react-on-rails JavaScript for react_on_rails Ruby gem",
5
5
  "main": "node_package/lib/ReactOnRails.js",
6
6
  "directories": {
@@ -8,9 +8,9 @@ namespace :dummy_apps do
8
8
  sh_in_dir(dummy_app_dir, "yarn install --mutex network")
9
9
  end
10
10
 
11
- task :dummy_app_with_turbolinks_5 do
11
+ task :dummy_app_with_turbolinks_2 do
12
12
  dummy_app_dir = File.join(gem_root, "spec/dummy")
13
- bundle_install_with_turbolinks_5_in(dummy_app_dir)
13
+ bundle_install_with_turbolinks_2_in(dummy_app_dir)
14
14
  sh_in_dir(dummy_app_dir, "yarn install --mutex network")
15
15
  end
16
16
 
@@ -32,11 +32,11 @@ namespace :run_rspec do
32
32
  bundle_install_in(dummy_app_dir)
33
33
  end
34
34
 
35
- desc "Runs dummy respec with turbolinks 5"
36
- task dummy_turbolinks_5: ["dummy_apps:dummy_app_with_turbolinks_5"] do
35
+ desc "Runs dummy respec with turbolinks 2"
36
+ task dummy_turbolinks_2: ["dummy_apps:dummy_app_with_turbolinks_2"] do
37
37
  clean_gen_assets(spec_dummy_dir)
38
38
  run_tests_in(spec_dummy_dir, env_vars:
39
- "ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile")
39
+ "ENABLE_TURBOLINKS_2=TRUE BUNDLE_GEMFILE=#{dummy_app_dir}/Gemfile")
40
40
  end
41
41
 
42
42
  # Dynamically define Rake tasks for each example app found in the examples directory
@@ -62,7 +62,7 @@ namespace :run_rspec do
62
62
  end
63
63
 
64
64
  desc "run all tests no examples"
65
- task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_5, :empty, :js_tests] do
65
+ task all_but_examples: [:gem, :dummy, :dummy_no_turbolinks, :dummy_turbolinks_2, :empty, :js_tests] do
66
66
  puts "Completed all RSpec tests"
67
67
  end
68
68
 
@@ -28,8 +28,8 @@ module ReactOnRails
28
28
  sh_in_dir(dir, "DISABLE_TURBOLINKS=TRUE bundle install")
29
29
  end
30
30
 
31
- def bundle_install_with_turbolinks_5_in(dir)
32
- sh_in_dir(dir, "ENABLE_TURBOLINKS_5=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install")
31
+ def bundle_install_with_turbolinks_2_in(dir)
32
+ sh_in_dir(dir, "ENABLE_TURBOLINKS_2=TRUE BUNDLE_GEMFILE=#{dir}/Gemfile bundle install")
33
33
  end
34
34
 
35
35
  # Runs bundle exec using that directory's Gemfile
@@ -42,17 +42,4 @@ 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
- )
58
45
  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.8.0
4
+ version: 6.8.1
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-06 00:00:00.000000000 Z
11
+ date: 2017-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: connection_pool
@@ -437,12 +437,7 @@ homepage: https://github.com/shakacode/react_on_rails
437
437
  licenses:
438
438
  - MIT
439
439
  metadata: {}
440
- post_install_message: "\n React on Rails installed! See https://github.com/shakacode/react_on_rails
441
- for documentation\n and source code.\n\n You can email contact@shakacode.com
442
- for support questions or access to our public slack room.\n\n For custom application
443
- development work or coaching on integrating React with Rails,\n visit http://www.shakacode.com\n\n
444
- \ For more information on the generators, run:\n rails generate react_on_rails:install
445
- --help\n "
440
+ post_install_message:
446
441
  rdoc_options: []
447
442
  require_paths:
448
443
  - lib