BBC-News/wraith — pull request #170 by DaveBlooman (2014-08-08 14:59:14+00:00)
Title: History feature

Add the ability to script the separate jobs of wraith to enable running against a single URL. This can then allow for historical capture of shots. This may be used to capture from different URL's but containing the same data e.g `localhost:8080/test_route` and `www.bbc.co.uk/news/uk-11111111`

This PR just ensures that the absent of a domain doesn't stop the task from running

## Example script

```ruby
require 'wraith'

@config = 'config.yaml'
@config2 = 'config2.yaml'

wraith = Wraith::CLI.new

def history(config)
wraith.reset_shots(config)
wraith.setup_folders(config)
wraith.save_images(config)
end

def latest(config)
wraith.save_images(config)
wraith.crop_images(config)
wraith.compare_images(config)
wraith.generate_thumbnails(config)
wraith.generate_gallery(config)
end

# Capture historical shots from new release, e.g Live

history(@config)

# Capture the latest copy after code changes and compare after each push/committ

latest(@config2)

```

## Example config with one domain
```yaml

#Headless browser option
browser:
webkit: "phantomjs"

#If you want to have multiple snapping files, set the file name here
snap_file: "javascript/snap.js"

# Type the name of the directory that shots will be stored in
directory:
- 'shots'

# Add only 2 domains, key will act as a label
domains:
english: "http://www.bbc.co.uk/news"

#Type screen widths below, here are a couple of examples
screen_widths:
- 320
- 600
- 768
- 1024
- 1280

#Type page URL paths below, here are a couple of examples
paths:
home: /
uk_index: /uk

#Amount of fuzz ImageMagick will use
fuzz: '20%'

```