Sha256: cefae3f72c9d8a8a586a6509871e6656bf8cbec04682d85f7e1a7a94b94a2671
Contents?: true
Size: 1.67 KB
Versions: 6
Compression:
Stored size: 1.67 KB
Contents
#!/usr/bin/env ruby STDOUT.sync = true $:.unshift File.join(File.dirname(__FILE__), *%w{ .. lib }) require 'html/proofer' require 'mercenary' require "rubygems" Mercenary.program(:htmlproof) do |p| p.version Gem::Specification::load(File.join(File.dirname(__FILE__), "..", "html-proofer.gemspec")).version p.description "Test your rendered HTML files to make sure they're accurate." p.syntax 'htmlproof PATH [options]' p.description "Runs the HTML-Proofer suite on the files in PATH" p.option 'ext', '--ext EXT', 'The extension of your HTML files (default: `.html`)' p.option 'swap', '--swap regex:string,[regex:string,...]', Array, 'Array containing key-value pairs of `RegExp:String`. It transforms links that match `RegExp` into `String`' p.option 'ignore', '--ignore link1,[link2,...]', Array, 'Array of Strings containing `href`s that are safe to ignore (default: `mailto`)' p.option 'disable_external', '--disable_external', 'Disables the external link checker (default: `false`)' p.option 'verbose', '--verbose', 'Enables more verbose logging.' p.action do |args, opts| args = ["."] if args.empty? path = args.first options = {} options[:ext] = opts["ext"] unless opts["ext"].nil? unless opts["swap"].nil? options[:href_swap] = {} opts["swap"].each do |s| pair = s.split(":") options[:href_swap][%r{#{pair[0]}}] = pair[1] end end options[:href_ignore] = opts["ignore"] unless opts["ignore"].nil? options[:disable_external] = opts["disable_external"] unless opts["disable_external"].nil? options[:verbose] = opts["verbose"] unless opts["verbose"].nil? HTML::Proofer.new(path, options).run end end
Version data entries
6 entries across 6 versions & 1 rubygems