Sha256: 930e9f144c333f0bebf9f7c4d048b80ee200eaf686117ebd4ae2bd5cfdccd049
Contents?: true
Size: 1.26 KB
Versions: 2
Compression:
Stored size: 1.26 KB
Contents
#!/usr/bin/env ruby $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require 'broken_link_finder' require 'thor' class BrokenLinkFinderCLI < Thor desc 'crawl [URL]', 'Find broken links at the URL' option :recursive, type: :boolean, aliases: [:r], desc: 'Crawl the entire site.' option :sort_by_link, type: :boolean, aliases: [:l], desc: 'Makes report more concise if there are more pages crawled than broken links found. Use with -r on medium/large sites.' option :verbose, type: :boolean, aliases: [:v], desc: 'Display all ignored links.' option :concise, type: :boolean, aliases: [:c], desc: 'Display only a summary of broken links.' def crawl(url) url = "http://#{url}" unless url.start_with?('http') sort_by = options[:sort_by_link] ? :link : :page broken_verbose = options[:concise] ? false : true ignored_verbose = options[:verbose] ? true : false finder = BrokenLinkFinder::Finder.new(sort: sort_by) options[:recursive] ? finder.crawl_site(url) : finder.crawl_page(url) finder.pretty_print_link_report( broken_verbose: broken_verbose, ignored_verbose: ignored_verbose ) rescue Exception => ex puts "An error has occurred: #{ex.message}" end end BrokenLinkFinderCLI.start(ARGV)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
broken_link_finder-0.8.1 | exe/broken_link_finder |
broken_link_finder-0.8.0 | exe/broken_link_finder |