Skip to content

Commit

Permalink
Update local install instructions and add add more verbose instructio…
Browse files Browse the repository at this point in the history
…ns when node versions don't match (#7847)

Updates the contributing README to clarify install instructions for a local environment and what the successful script looks like. Suggests updates to the setup script to provide more instructions if nvm install fails in the bash script.
  • Loading branch information
gwwar authored Jul 10, 2018
1 parent 6b746e0 commit 86c2d1e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 7 deletions.
35 changes: 34 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,44 @@ To test the plugin, or to contribute to it, you can clone this repository and bu

### Local Environment

First, you need a WordPress Environment to run the plugin on. The quickest way to get up and running is to use the provided docker setup. Just install [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/) on your machine and run `./bin/setup-local-env.sh`.
First, you need a WordPress Environment to run the plugin on. The quickest way to get up and running is to use the provided docker setup. Install [docker](https://www.docker.com/) and [docker-compose](https://docs.docker.com/compose/) by following the most recent instructions on the docker site.

In the folder of your preference, clone this project and enter the working directory:
```bash
git clone [email protected]:WordPress/gutenberg.git
cd gutenberg
```

Then, run a setup script to check if docker and node are configured properly and starts the local WordPress instance. You may need to run this script multiple times if prompted.
```
./bin/setup-local-env.sh
```

If everything was successful, you'll see the following ascii art:
```
Welcome to...
,⁻⁻⁻· . |
| ،⁓’. . |--- ,---. ,---. |---. ,---. ,---. ,---.
| | | | | |---' | | | | |---' | | |
`---' `---' `---’ `---’ ' ` `---' `---’ ` `---|
`---'
```

The WordPress installation should be available at `http://localhost:8888` (username: `admin`, password: `password`).
Inside the "docker" directory, you can use any docker command to interact with your containers. If this port is in use, you can override it in your `docker-compose.override.yml` file. If you're running [e2e tests](https://wordpress.org/gutenberg/handbook/reference/testing-overview/#end-to-end-testing), this change will be used correctly.

To bring down this local WordPress instance later run:
```
docker-compose down
```

If you'd like to see your changes reflected in this local WordPress instance, run:
```
npm install
npm run dev
```

Alternatively, you can use your own local WordPress environment and clone this repository right into your `wp-content/plugins` directory.

Next, open a terminal (or if on Windows, a command prompt) and navigate to the repository you cloned. Now type `npm install` to get the dependencies all set up. Then you can type `npm run dev` in your terminal or command prompt to keep the plugin building in the background as you work on it.
Expand Down
8 changes: 2 additions & 6 deletions bin/install-node-nvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,8 @@ fi

# Check if the current node version is up to date.
if [ "$TRAVIS" != "true" ] && [ "$(nvm current)" != "$(nvm version-remote --lts)" ]; then
echo -en $(status_message "Updating Node..." )
nvm install >/dev/null 2>&1
echo ' done!'

echo -e $(warning_message "A new node version was installed, please run this command to use it:" )
echo -e $(warning_message "$(action_format "nvm use")" )
echo -e $(warning_message "Node version does not match the latest long term support version. Please run this command to install and use it:" )
echo -e $(warning_message "$(action_format "nvm install")" )
echo -e $(warning_message "After that, re-run the setup script to continue." )
exit 1
fi
Expand Down

0 comments on commit 86c2d1e

Please sign in to comment.