Sha256: c16ff4eb8286dd9ab0ecee4b7e8a44d6370fe725fbc97da477d223103c81fd76
Contents?: true
Size: 1.01 KB
Versions: 2
Compression:
Stored size: 1.01 KB
Contents
#!/usr/bin/env ruby # frozen_string_literal: true # USAGE: # $ verify_redirects --help # for dev purposes require 'bundler/setup' if ENV['VERIFY_REDIRECTS_GEM_DEV'] require 'verify_redirects' require 'verify_redirects/cli' options = VerifyRedirects::CLI.parse(argv: ARGV, name: 'verify_redirects') input_path = options[:input] || fail(ArgumentError, '--input required - CSV file path must be provided') output_path = options[:output] || input_path.gsub(/\.csv/, '-redirect-results.csv') debug = options.fetch(:debug, false) VerifyRedirects.configure { |c| c.debug = debug } VerifyRedirects.from_csv(input_path: input_path, output_path: output_path) do |result| unless result.success loc_part = if result.redirected_to "instead redirected to #{result.redirected_to}" else "didn't redirect" end puts "[FAILED] #{result.start_url} should redirect to #{result.expected_redirect} but #{loc_part}." end end puts puts "Wrote output to: #{output_path}"
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
verify_redirects-0.2.1 | exe/verify_redirects |
verify_redirects-0.2.0 | exe/verify_redirects |