Skip to content

Instantly share code, notes, and snippets.

@pete-otaqui
Created February 16, 2010 09:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pete-otaqui/305402 to your computer and use it in GitHub Desktop.
Save pete-otaqui/305402 to your computer and use it in GitHub Desktop.
Prototype spider which uses 'bbc_standards' to test a whole website
# Prototype spider which uses 'bbc_standards' to test a whole website
require 'rubygems'
require 'anemone'
require 'bbc_standards'
require 'term/ansicolor'
class String
include Term::ANSIColor
end
Anemone.crawl("http://pal.sandbox.dev.bbc.co.uk/") do |anemone|
anemone.on_every_page do |page|
begin
validator = BBCStandards::Validator.new(page.body)
if ( validator.errors.size > 0 ) then
puts "#{page.url} - #{validator.errors.size} errors found!".red
validator.errors.each do |error|
puts " * #{error.message}".red.bold
end
else
puts page.url.green
end
rescue
puts "#{page.url} - Failed to get page".yellow
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment