Sha256: 9f65c5b4379ae86409048ccd0a33c20cd3e377152989738a19b559aa46f6e59b

Contents?: true

Size: 1 KB

Versions: 2

Compression:

Stored size: 1 KB

Contents

require 'optparse'


options = {}
OptionParser.new do |opts|
  opts.banner = "Usage: rails_best_practices [options]"
  
  opts.on("-d", "--debug", "Debug mode") do
    options['debug'] = true
  end

  ['vendor', 'spec', 'test', 'stories'].each do |pattern|
    opts.on("--#{pattern}", "include #{pattern} files") do
      options[pattern] = true
    end
  end
  
  opts.on_tail('-v', '--version', 'Show this version') do
    puts File.read(File.dirname(__FILE__) + '/../../VERSION')
    exit
  end

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

  opts.parse!
end

runner = RailsBestPractices::Core::Runner.new
runner.set_debug if options['debug']

files = RailsBestPractices::analyze_files(ARGV, options)
files.each { |file| runner.check_file(file) }

runner.errors.each {|error| puts error}
puts "\nPlease go to http://rails-bestpractices.com to see more useful Rails Best Practices."
if runner.errors.size > 0
  puts "\nFound #{runner.errors.size} errors."
end

exit runner.errors.size

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails_best_practices-0.4.0 lib/rails_best_practices/command.rb
rails_best_practices-0.3.27 lib/rails_best_practices/command.rb