Sha256: ee74a83eed25dc6d715b32fda861f54296c502c5c0779cd2127990d6eb4f3b72
Contents?: true
Size: 838 Bytes
Versions: 1
Compression:
Stored size: 838 Bytes
Contents
namespace :cohesion do desc 'cohesion rake task' task :check, :url do | t, args | if args[:url].nil? puts puts "Usage: rake cohesion:check[url] (eg: check_links[\"http://rubyonrails.org/\"])" else errors = [] failures = [] CobwebCrawler.new(:cache => 600, :cache_type => :full, :crawl_linked_external => true).crawl(args[: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 puts if failures.count == 0 puts "All links working!" else puts "Failed urls:" failures.map{|f| puts " - #{f[:url]} [ #{f[:status_code]} ]"} puts end end puts end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
cohesion-0.0.1 | lib/tasks/check.rake |