Sha256: 162393bb0441b5eaa1d3284b689dc2fb01c59867fac966da186554f304454d02
Contents?: true
Size: 765 Bytes
Versions: 1
Compression:
Stored size: 765 Bytes
Contents
require "cohesion/version" require 'cobweb' Dir["tasks/**/*.rake"].each { |ext| load ext } if defined?(Rake) module Cohesion class Check def self.site(url) errors = [] failures = [] CobwebCrawler.new(:cache => 600, :cache_type => :full, :crawl_linked_external => true).crawl(url) do |page| print page[:url] if page[:status_code] > 399 puts " [#{page[:status_code]}] \e[31m\u2717\e[0m" failures << page else puts " \e[32m\u2713\e[0m" end end if failures.count == 0 puts "All links working!" else puts "Failed urls:" failures.map{|f| puts " - #{f[:url]} [ #{f[:status_code]} ]"} end puts failures end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cohesion-0.0.2 | lib/cohesion.rb |