Sha256: cf34c5782b0a4c125c4d39271b0e33306608525b4c0f123a1a481a32c4c3b749

Contents?: true

Size: 1.14 KB

Versions: 4

Compression:

Stored size: 1.14 KB

Contents

#!/usr/bin/env ruby

lib = File.expand_path('../../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

require 'optparse'
require 'redpen_ruby'

args = ARGV

options = OptionParser.new do |opts|
  opts.banner = "Usage: #{opts.program_name} /path/to/config.xml /path/to/target_file"
  opts.separator ""
  opts.separator "Common options:"

  opts.on_tail("-h", "--help", "Show this message") do
    puts opts
    exit
  end
  opts.on_tail("--version", "Show version") do
    puts RedpenRuby::VERSION
    exit
  end
end

args = ['-h'] if args.empty?
options.parse!(args)

config = args.shift.strip
unless config
  puts "You must provide an config file"
  exit
end

target = args.shift.strip
unless target
  puts "You must provide an target file"
  exit
end

print "\nChecking...."
validation = RedpenRuby.check(config, target)

if validation.valid?
  puts "Congratulations! This is a valid document. Checking by RedPen CLI v#{validation.redpen_version}"
  puts
  puts validation.messages
else
  puts "FAILED!"
  puts
  puts "This is not a valid document. Checking by RedPen CLI v#{validation.redpen_version}"
  puts
  puts validation.messages
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redpen_ruby-0.4 bin/redpen_ruby
redpen_ruby-0.3 bin/redpen_ruby
redpen_ruby-0.2 bin/redpen_ruby
redpen_ruby-0.1 bin/redpen_ruby