Skip to content

Commit 958c197

Browse files
author
Rachel
committed
First pass at wraith, update contribute and readme
- Create wraith.yaml - Compare live and local docs - Include path for one of every content type - Revise Rakefile so that wraith can be individually executed, default task is htmlproofer for circle - gitignore the shots directory (images and galleries generated by wraith) - Edit contribute to align with readme recommendation on building locally - Include steps to run tests indvidually (noted as optional) - Preserve instructions for editing on GH and link to GH doc - Fix readme ol synstax
1 parent 7057ecc commit 958c197

File tree

5 files changed

+186
-62
lines changed

5 files changed

+186
-62
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ composer.phar
1313
node_modules
1414
.vagrant
1515
bin/*
16+
shots/

CONTRIBUTING.md

+18-13
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,6 @@
22

33
Help us create relevant and useful content for developers like yourself. See something you'd like to add or change? We love pull requests!
44

5-
## Before You Start
6-
7-
* If you don't have one already, sign up for a [GitHub account](https://github.com/signup/free).
8-
* Fork the pantheon-systems/documentation repository on GitHub.
9-
Trying to edit or create a file in this repository will create your fork automatically.
10-
* [Clone your fork locally](https://help.github.com/articles/cloning-a-repository/).
11-
* Add our repo as a remote. `git remote add upstream [email protected]:pantheon-systems/documentation.git`.
12-
135
**NOTE**: All contributions must be licensed under [CC-BY-SA](https://creativecommons.org/licenses/by-sa/4.0/). Code snippet contributions must additionally be licensed under [The MIT License](http://opensource.org/licenses/MIT). You must have permission to contribute your work under these terms.
146

157
## Issues - Searching and Creating
@@ -27,12 +19,25 @@ Description: The document currently suggests using XYZ commands, but I get the f
2719

2820
Add labels to issues by clicking the gear in the sidebar on the right. Labels are used to signify priority, category, and to help filter existing issues. For example, if a doc is incorrect, the label 'Doc Defect' should be applied.
2921

30-
## Edit Existing Docs
22+
## Edit and Test Locally Using Vagrant
23+
24+
**Note**: To preserve the accuracy of promised information throughout the docs, search the repository for links to sections that have been renamed and update accordingly.
25+
26+
1. [Use Vagrant](https://github.com/pantheon-systems/documentation#option-1-use-vagrant-recommended) to run the docs site locally.
27+
2. Navigate to your local `documentation` repository and use `git checkout -b <new-branch-name>` to switch to a new branch.
28+
3. Edit/Create docs locally using your favorite text editor (e.g. [Atom](https://atom.io/)), then save the file changes.
29+
4. Verify modifications on the local site <http://docs.local:8000/docs>
30+
5. Test layout or code changes by running `vagrant ssh` and `cd /vagrant`, then execute the following tests individually (optional):
31+
- `grunt`: [a11y](https://github.com/addyosmani/a11y) accessibility audits
32+
- `rake config[wraith.yaml]`: [Wraith](https://github.com/BBC-News/wraith) visual regression tool
33+
- `rake htmlproofer`: [HTML::Proofer](https://github.com/gjtorikian/html-proofer) HTML validation
34+
- `bin/behat`: [Behat](https://github.com/Behat/Behat)
35+
- `scripts/merge_conflicts.sh`: Look for merge conflicts.
36+
6. Commit changes and push to your fork. Issue pull-requests one document/issue at a time.
37+
38+
## Edit on GitHub
3139

32-
1. Search [open issues](https://github.com/pantheon-systems/documentation/issues) to make sure your isn't duplicated.
33-
2. Locally, cd to the `documentation` repository and use `git checkout -b <new-branch-name>` to switch to a new branch.
34-
3. Edit locally, commit changes, and push to your fork.
35-
4. To preserve the accuracy of promised information throughout the docs, search the repository for links to the revised section and update related articles accordingly.
40+
Trying to edit or create a file in this repository will create your fork automatically. Commit changes and issue pull-requests one document/issue at a time. For more information, see [Using Pull Requests](https://help.github.com/articles/using-pull-requests/).
3641

3742
## Keep your Local Updated with Master
3843

README.md

+48-48
Original file line numberDiff line numberDiff line change
@@ -43,52 +43,52 @@ Fork and clone this repository. Issue pull-requests one document at a time.
4343

4444
### Option 2. Install manually
4545
1. Get composer:
46-
If you do not want to install composer globally, please refer to [getcomposer.org instuctions](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
47-
48-
Run the following command to install composer globally:
49-
```
50-
curl -sS https://getcomposer.org/installer | php
51-
mv composer.phar /usr/local/bin/composer
52-
```
53-
54-
**Note**: Run the `mv` command with sudo if it fails.
55-
3. Install dependencies:
56-
From within the `documentation` repo, run the following command to install all needed dependencies:
57-
```
58-
composer install
59-
```
60-
4. Start your local server:
61-
If you do not want to install sculpin globally, you can use the following commands to start your local server:
62-
```
63-
./vendor/bin/sculpin generate --server
64-
```
65-
Visit your docs site at: <http://localhost:8000/docs>
66-
67-
In order to globally execute sculpin, run the following commands:
68-
```
69-
curl -O https://download.sculpin.io/sculpin.phar
70-
sudo chmod +x sculpin.phar
71-
mv sculpin.phar /usr/local/bin/sculpin
72-
```
73-
74-
Build sculpin and run a local instance:
75-
76-
```
77-
sculpin generate --server
78-
```
79-
Visit your docs site at: <http://localhost:8000/docs>
80-
81-
82-
Finally, you can tell sculpin to watch the docs directory and automatically
83-
regenerate anything changed:
84-
```
85-
sculpin generate --server --watch
86-
```
87-
If you use --watch and see it constantly running, regenerating, drop --watch
88-
until you identify and resolve the problem.
46+
If you do not want to install composer globally, please refer to [getcomposer.org instuctions](https://getcomposer.org/doc/00-intro.md#installation-linux-unix-osx).
47+
48+
Run the following command to install composer globally:
49+
```
50+
curl -sS https://getcomposer.org/installer | php
51+
mv composer.phar /usr/local/bin/composer
52+
```
53+
54+
**Note**: Run the `mv` command with sudo if it fails.
55+
2. Install dependencies:
56+
From within the `documentation` repo, run the following command to install all needed dependencies:
57+
```
58+
composer install
59+
```
60+
3. Start your local server:
61+
If you do not want to install sculpin globally, you can use the following commands to start your local server:
62+
```
63+
./vendor/bin/sculpin generate --server
64+
```
65+
Visit your docs site at: <http://localhost:8000/docs>
66+
67+
In order to globally execute sculpin, run the following commands:
68+
```
69+
curl -O https://download.sculpin.io/sculpin.phar
70+
sudo chmod +x sculpin.phar
71+
mv sculpin.phar /usr/local/bin/sculpin
72+
```
73+
74+
Build sculpin and run a local instance:
75+
76+
```
77+
sculpin generate --server
78+
```
79+
Visit your docs site at: <http://localhost:8000/docs>
80+
81+
82+
Finally, you can tell sculpin to watch the docs directory and automatically
83+
regenerate anything changed:
84+
```
85+
sculpin generate --server --watch
86+
```
87+
If you use --watch and see it constantly running, regenerating, drop --watch
88+
until you identify and resolve the problem.
8989
5. Images
90-
For images to render on your local environment you need to apply these commands from within the `documentation` directory:
91-
```
92-
$ cd output_dev
93-
$ ln -s ./ source
94-
```
90+
For images to render on your local environment you need to apply these commands from within the `documentation` directory:
91+
```
92+
$ cd output_dev
93+
$ ln -s ./ source
94+
```

Rakefile

+61-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,69 @@
11
require 'html/proofer'
2+
require "wraith/save_images"
3+
require "wraith/crop"
4+
require "wraith/spider"
5+
require "wraith/folder"
6+
require "wraith/thumbnails"
7+
require "wraith/compare_images"
8+
require "wraith/gallery"
29

310
task default: %w[htmlproofer]
4-
11+
desc "Run htmlproofer"
512
task :htmlproofer do
613
HTML::Proofer.new("./output_prod", {
714
:disable_external => true,
815
}).run
916
end
17+
18+
@config = ("wraith.yaml")
19+
20+
desc "Execute wraith on two sites with a config you specify"
21+
task :config, [:yaml] do |_t, custom|
22+
custom.with_defaults(:yaml => "config")
23+
@config = "#{custom[:yaml]}"
24+
Rake::Task["wraithdefault"].invoke
25+
end
26+
27+
task :wraithdefault => [:reset_shots_folder, :check_for_paths, :setup_folders, :save_images, :crop_images, :compare_images, :generate_thumbnails, :generate_gallery] do
28+
puts "Done!"
29+
end
30+
31+
task :reset_shots_folder do
32+
reset = Wraith::FolderManager.new(@config)
33+
reset.clear_shots_folder
34+
end
35+
36+
task :setup_folders do
37+
create = Wraith::FolderManager.new(@config)
38+
create.create_folders
39+
end
40+
41+
task :compare_images do
42+
compare = Wraith::CompareImages.new(@config)
43+
compare.compare_images
44+
end
45+
46+
task :check_for_paths do
47+
spider = Wraith::Spidering.new(@config)
48+
spider.check_for_paths
49+
end
50+
51+
task :save_images do
52+
@save_images = Wraith::SaveImages.new(@config)
53+
@save_images.save_images
54+
end
55+
56+
task :crop_images do
57+
crop = Wraith::CropImages.new(@config)
58+
crop.crop_images
59+
end
60+
61+
task :generate_thumbnails do
62+
thumbs = Wraith::Thumbnails.new(@config)
63+
thumbs.generate_thumbnails
64+
end
65+
66+
task :generate_gallery do
67+
gallery = Wraith::GalleryGenerator.new(@config, false)
68+
gallery.generate_gallery
69+
end

wraith.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Add as many domains as necessary. Key will act as a label
2+
domains:
3+
live: "https://pantheon.io/docs"
4+
local: "http://docs.local:8000/docs"
5+
6+
# (optional) JavaScript file to execute before taking screenshot of every path.
7+
# Can be used to reload current page with headers specified, or to dynamically
8+
# AJAX in content, or all manner of other uses!
9+
#before_capture: 'javascript/global.js'
10+
11+
# Type page URL paths below, here are a couple of examples.
12+
# They should exist for all of the domains you've specified above.
13+
paths:
14+
home: /
15+
article-index: /articles
16+
single-article: /articles/going-live
17+
subdir-index: /articles/local
18+
guide-index: /guides
19+
single-guide: /guides/visual-diff-with-wraith
20+
changelog-index: /changelog
21+
single-changelog: /changelog/2015-10-October
22+
23+
# amount of fuzz ImageMagick will use when comparing images. A higher fuzz makes the comparison less strict.
24+
fuzz: '20%'
25+
26+
# the maximum acceptable level of difference (in %) between two images.
27+
# Wraith considers it a failure if an image diff goes above this threshold.
28+
threshold: 5
29+
30+
# screen widths (and optional height) to resize the browser to before taking the screenshot
31+
screen_widths:
32+
- 320
33+
- 600x768
34+
- 768
35+
- 1024
36+
- 1280
37+
38+
# the engine to run Wraith with. Examples: 'phantomjs', 'casperjs', 'slimerjs'
39+
browser: "casperjs"
40+
41+
# the directory that your base screenshots will be stored in
42+
history_dir: 'shots_base'
43+
44+
# the directory that your latest screenshots will be stored in
45+
directory: 'shots'
46+
47+
gallery:
48+
template: 'slideshow_template' # 'basic_template' (default)
49+
thumb_width: 200
50+
thumb_height: 200
51+
52+
# choose how results are displayed in the gallery (default is `alphanumeric` if omitted)
53+
# Different screen widths are always grouped together.
54+
# Options:
55+
# alphanumeric - all paths (with or without a difference) are shown, sorted by path
56+
# diffs_first - all paths (with or without a difference) are shown, sorted by difference size (largest first)
57+
# diffs_only - only paths with a difference are shown, sorted by difference size (largest first)
58+
mode: diffs_first

0 commit comments

Comments
 (0)