Sha256: a5677beb3dce3d3ecd1dcf742e8efe985de499124a6a9f65e23a33446efd48e2

Contents?: true

Size: 899 Bytes

Versions: 7

Compression:

Stored size: 899 Bytes

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("-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}
if runner.errors.size > 0
  puts "\ngo to http://wiki.github.com/flyerhzm/rails_best_practices to see how to solve these errors."
  puts "\nFound #{runner.errors.size} errors."
end

exit runner.errors.size

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
rails_best_practices-0.3.22 lib/rails_best_practices/command.rb
rails_best_practices-0.3.21 lib/rails_best_practices/command.rb
rails_best_practices-0.3.20 lib/rails_best_practices/command.rb
rails_best_practices-0.3.19 lib/rails_best_practices/command.rb
rails_best_practices-0.3.18 lib/rails_best_practices/command.rb
rails_best_practices-0.3.17 lib/rails_best_practices/command.rb
rails_best_practices-0.3.16 lib/rails_best_practices/command.rb