class RailsBestPractices::CLI
Public Class Methods
run(argv)
click to toggle source
Run analyze with ruby code @param [Array] argv command argments @return [Boolean] return true, if there is no violation. @example
RailsBestPractices::CLI.run(['-d', '-o', 'path/to/file'])
# File lib/rails_best_practices/cli.rb, line 10 def self.run(argv) options = OptionParser.parse!(argv) if !argv.empty? && !File.exist?(argv.first) raise Errno::ENOENT, "#{argv.first} doesn't exist" end analyzer = Analyzer.new(argv.first, options) analyzer.analyze analyzer.output analyzer.runner.errors.empty? end