Sha256: b4364755bc45b060f3f723d1a4cc9a68ff543df0c4c23e8cdb453b5038815a3e
Contents?: true
Size: 1.37 KB
Versions: 8
Compression:
Stored size: 1.37 KB
Contents
#!/usr/bin/env ruby STDOUT.sync = true require './lib/html/proofer' require 'mercenary' Mercenary.program(:htmlproof) do |p| # p.version HTML::Proofer::VERSION p.description "Test your rendered HTML files to make sure they're accurate." p.syntax 'htmlproof run PATH [options]' p.command(:run) do |c| c.syntax "htmlproof run PATH" c.description "Runs the HTML-Proofer suite on the files in PATH" c.option 'ext', '--ext EXT', String, 'The extension of your HTML files (default: `.html`)' c.option 'swap', '--swap regex:string,[regex:string,...]', Array, 'Array containing key-value pairs of `RegExp:String`. It transforms links that match `RegExp` into `String`' c.option 'ignore', '--ignore link1,[link2,...]', Array, 'Array of Strings containing `href`s that are safe to ignore (default: `mailto`)' c.action do |args, opts| raise "`run` requires a PATH indicating a directory of files to check" if args.empty? 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? HTML::Proofer.new(args[0], options).run end end p.default_command(:run) end
Version data entries
8 entries across 8 versions & 1 rubygems