Skip to content

Commit 41311b6

Browse files
committed
Update CONTRIBUTING.md and related files
1 parent 8e47c79 commit 41311b6

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

CONTRIBUTING.md

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ When making doc changes, we want the change to work on both the gitbook and the
4444
## To run tests:
4545
* After updating code via git, to prepare all examples and run all tests:
4646

47-
```
47+
```sh
48+
cd react_on_rails/
4849
bundle && yarn && rake examples:prepare_all && rake node_package && rake
4950
```
5051

@@ -72,9 +73,16 @@ It's critical to configure your IDE/editor to ignore certain directories. Otherw
7273
* /spec/react_on_rails/dummy-for-generators
7374

7475
# 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+
└── react_on_rails
80+
└── spec
81+
└── dummy
82+
```
7583

7684
## 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+
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:
7886

7987
```ruby
8088
gem "react_on_rails", path: "../path-to-react-on-rails"
@@ -86,13 +94,14 @@ Note that you will need to bundle install after making this change, but also tha
8694
First, be **sure** to build the NPM package
8795

8896
```sh
97+
cd react_on_rails/
8998
yarn
9099
yarn run build
91100
```
92101

93-
Use a relative path in your `package.json`, like this:
102+
Use a relative path in your test app's `package.json`, like this:
94103
```sh
95-
cd client
104+
cd test/client
96105
yarn add "react-on-rails@../../react_on_rails"
97106
```
98107

@@ -119,9 +128,10 @@ yarn global add phantomjs
119128
Note this *must* be installed globally for the dummy test project rspec runner to see it properly.
120129

121130
### 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)
131+
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)
123132

124133
```sh
134+
cd react_on_rails/spec/dummy
125135
yarn run install-react-on-rails
126136
```
127137

@@ -141,9 +151,9 @@ From now on, the example and dummy apps will use your local node_package folder
141151
### Install NPM dependencies and build the NPM package for react-on-rails
142152

143153
```sh
144-
cd <top level>
154+
cd react_on_rails/
145155
yarn
146-
npm build
156+
yarn build
147157
```
148158

149159
Or run this which builds the yarn package, then the webpack files for spec/dummy, and runs tests in
@@ -153,40 +163,40 @@ spec/dummy.
153163
```sh
154164
# Optionally change default selenium_firefox driver
155165
export DRIVER=poltergeist
156-
cd <top level>
166+
cd react_on_rails/
157167
yarn run dummy:spec
158168
```
159169

160170
### Run NPM JS tests
161171

162172
```sh
163-
cd <top level>
173+
cd react_on_rails/
164174
yarn test
165175
```
166176

167177
### Run spec/dummy tests
168178

169179
```sh
170-
cd spec/dummy
180+
cd react_on_rails/spec/dummy
171181
rspec
172182
```
173183

174184
Eventually, we may have JS tests:
175185

176186
```sh
177-
cd spec/dummy/client
187+
cd react_on_rails/spec/dummy/client
178188
yarn run test
179189
```
180190

181191
### Run most tests and linting
182192

183193
```sh
184-
cd <top level>
185-
npm run check
194+
cd react_on_rails/
195+
yarn run check
186196
```
187197

188198
### 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.
199+
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.
190200

191201
### RSpec Testing
192202
Run `rake` for testing the gem and `spec/dummy`. Otherwise, the `rspec` command only works for testing within the sample apps, like `spec/dummy`.

spec/dummy/client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"build:dev:server": "webpack -w --config webpack.server.rails.build.config.js",
7575
"build:server": "webpack --config webpack.server.rails.build.config.js",
7676
"hot-assets": "babel-node server-rails-hot.js",
77-
"install-react-on-rails": "yarn 'file:../../..'"
77+
"install-react-on-rails": "CLIENT_PATH=$(pwd) && cd ../../../ && yarn && cd $CLIENT_PATH && yarn add 'file:../../..'"
7878
},
7979
"author": "",
8080
"license": "ISC"

0 commit comments

Comments
 (0)