Skip to content

Commit

Permalink
Squashed commit, details below.
Browse files Browse the repository at this point in the history
build docs immediately

include wraith

add updater script

update README

use wraith with phantomjs

fix updater script

clean up runthedocs and README

add docker version file

verisoning and other improvements
  • Loading branch information
alexfornuto committed Jul 5, 2018
1 parent 8477e69 commit 024b6b0
Show file tree
Hide file tree
Showing 7 changed files with 131 additions and 11 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Expand Up @@ -57,3 +57,6 @@ RUN ./scripts/fix-changelog-index.sh

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Add Versioning
ADD VERSION .
1 change: 1 addition & 0 deletions Gemfile
Expand Up @@ -2,3 +2,4 @@ source 'https://rubygems.org'
gem 'html-proofer'
gem 'bundler'
gem 'rake'
gem 'wraith'
105 changes: 99 additions & 6 deletions README.md
@@ -1,4 +1,6 @@
[![Circle CI](https://circleci.com/gh/pantheon-systems/documentation.svg?style=svg)](https://circleci.com/gh/pantheon-systems/documentation)
[![](https://images.microbadger.com/badges/version/pantheonsystems/documentation:v0.0.1.svg)](https://microbadger.com/images/pantheonsystems/documentation:v0.0.1 "Get your own version badge on microbadger.com")

Pantheon Documentation
======================
https://pantheon.io/docs/
Expand All @@ -22,11 +24,13 @@ Fork and clone this repository. Issue pull requests per document.

If you would like to develop documentation locally and see your work, we offer a Docker containerized solution.

**Prerequisites**
### Prerequisites

- MacOS or Linux system (untested on Bash on Windows)
- Docker

### Install

1. Clone the repository to your project directory:

```bash
Expand All @@ -35,16 +39,18 @@ If you would like to develop documentation locally and see your work, we offer a

OR

git@github.com:pantheon-systems/documentation.git
git clone git@github.com:pantheon-systems/documentation.git
```

2. Pull the Docker image:
1. Pull the Docker image:

```bash
docker image pull pantheonsystems/documentation
```

3. From the project root, run the `runthedocs.sh` script:
### Run

1. From the project root, execute the `runthedocs.sh` script:

```bash
cd documentation
Expand All @@ -53,10 +59,97 @@ If you would like to develop documentation locally and see your work, we offer a

**Note::** This will occupy the terminal in which you invoke the script, providing output when files are changed or loaded. Use **CTRL** + **C** to exit.

The Docker image will mount the `source` directory from the project root, and rebuild when you save changes.
You should see:

```bash
Creating the Docker container...
Container built and running. 👍👍
Building the latest docs...
Detected new or updated files
Generating: 100% (1035 sources / 0.06 seconds)
Converting: 100% (1122 sources / 8.04 seconds)
Formatting: 100% (1122 sources / 2.73 seconds)
Processing completed in 12.20 seconds
Running "watch" task
Waiting...
```

The Docker image will mount the `source` directory from the project root on your computer, and rebuild when you save changes:

```bash
/documentation/source/_docs/getting-support.md was changed. Building...
Detected new or updated files
Generating: 100% (1035 sources / 0.04 seconds)
Converting: 100% (1122 sources / 5.73 seconds)
Formatting: 100% (1122 sources / 2.01 seconds)
Processing completed in 9.05 seconds
```

4. When you're done, run:
1. When you're done, run:

```bash
docker container stop pantheon-docs
```

### Update The Docs

The `pantheon-docs` container mounts the `documentation/source` directory from your computer, so the image remains evergreen as long as the toolset is unchanged. To update your local project with the latest version of the docs, you need only pull them from git:

```bash
git pull origin
```

### Update The App



1. To update the documentation build locally run:

```bash
./updater.sh
```

### Testing

We include several tools to test that new content doesn't break the documentation. Most of these tests are performed automatically by our continuous integration service, but pull requests created from external contributors aren't included in CI tests. If you want to manually test your branch, you can execute the following tests within the Docker container.

#### Merge Conflicts

To check for merge conflict messages accidentally commited into the docs, run the `merge_conflicts.sh` script:

```bash
docker exec pantheon-docs scripts/merge_conflicts.sh
Merge conflict:pass
```
#### [HTMLProofer](https://github.com/gjtorikian/html-proofer)

To make sure all relative links (like `/docs/support/`) are correct, run

```bash
docker exec pantheon-docs htmlproofer --assume-extension ./output_dev/ --disable-external true
```

#### [A11y](https://github.com/addyosmani/a11y)

We use grunt to manage accessibility tests:

```bash
docker exec pantheon-docs node_modules/.bin/grunt test
Running "a11y:dev" (a11y) task

Done, without errors.
```

#### [Wraith](https://github.com/BBC-News/wraith)

Checks for visual regression:

```bash
docker exec pantheon-docs wraith capture wraith.yaml
```

#### [Behat](https://github.com/Behat/Behat)

```bash
docker exec pantheon-docs bin/behat
```
1 change: 1 addition & 0 deletions VERSION
@@ -0,0 +1 @@
0.0.1
13 changes: 10 additions & 3 deletions runthedocs.sh
@@ -1,13 +1,20 @@
#/bin/bash

printf "Creating the Docker container... \n"

# Invoke the docker image with a shared volume for source.
if docker run -p 8000:8000 --name=pantheon-docs -v $(pwd)/source:/documentation/source -dit pantheonsystems/documentation; then
printf "Container built and running \n"
if docker run -p 8000:8000 --name=pantheon-docs -v $(pwd)/source:/documentation/source -dit pantheonsystems/documentation > /dev/null 2>&1; then
printf "Container built and running. 👍👍 \n"
else
printf "Container exists... \n"
printf "Container exists, restarting... \n"
docker container start pantheon-docs
printf "\n"
printf "Container restarted. 👍👍 \n"
fi

printf "Building the latest docs... \n"
docker exec pantheon-docs /documentation/node_modules/.bin/grunt --force > /dev/null
docker exec pantheon-docs /documentation/bin/sculpin generate --env=dev

# Start app script, which invokes grunt, the watch script, and a simple PHP web server
docker exec pantheon-docs /documentation/scripts/app.sh
15 changes: 15 additions & 0 deletions updater.sh
@@ -0,0 +1,15 @@
#/bin/bash

printf "Stopping any running pantheon-docs containers... \n \n"

docker container stop pantheon-docs

printf "Removing old container.. \n \n"

docker container rm pantheon-docs

printf "Pulling latest image... \n \n"

docker image pull pantheonsystems/documentation

printf "\n Done! Execute runthedocs.sh to start the application. \n \n"
4 changes: 2 additions & 2 deletions wraith.yaml
@@ -1,7 +1,7 @@
# Add as many domains as necessary. Key will act as a label
domains:
live: "https://pantheon.io/docs"
local: "http://docs.local:8000/docs"
local: "http://localhost:8000/docs"

# (optional) JavaScript file to execute before taking screenshot of every path.
# Can be used to reload current page with headers specified, or to dynamically
Expand Down Expand Up @@ -34,7 +34,7 @@ screen_widths:
- 1366

# the engine to run Wraith with. Examples: 'phantomjs', 'casperjs', 'slimerjs'
browser: "casperjs"
browser: "phantomjs"

# the directory that your base screenshots will be stored in
history_dir: 'shots_base'
Expand Down

0 comments on commit 024b6b0

Please sign in to comment.