Sha256: a933bad8304bbf812b380dc1235ae2ae98c8ba7166d8210427b25107f58c96c0

Contents?: true

Size: 1.02 KB

Versions: 2

Compression:

Stored size: 1.02 KB

Contents

#!/usr/bin/env ruby

$:.unshift(File.dirname(__FILE__) + '/../lib/') unless
  $:.include?(File.dirname(__FILE__) + '/../lib/') ||
  $:.include?(File.expand_path(File.dirname(__FILE__) + '/../lib/'))

require 'tailor'

def usage
  puts "Usage:"
  puts "\t#{__FILE__} [directory with .rb files]"
  puts "\t -OR-"
  puts "\t#{__FILE__} [single .rb file]"
end

if ARGV[0].nil?
  puts usage
else
  begin
    path_to_check = ARGV[0]
    
    # Check to make sure we got a file or directory
    unless File.file?(path_to_check) or File.directory?(path_to_check)
      raise "Invalid file or directory: #{path_to_check}"
    end

    if File.file?(path_to_check)
      files_and_problems = Tailor.check_file path_to_check
    elsif File.directory?(path_to_check)
      # Check the requested files/dirs for problems
      files_and_problems = Tailor.check path_to_check
    end

    # Print summary of the problems we found
    Tailor.print_report files_and_problems
  rescue Exception => ex
    puts ex.message
    puts ex.backtrace
    puts
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tailor-0.1.3 bin/tailor
tailor-0.1.2 bin/tailor