PageRenderTime 24ms CodeModel.GetById 12ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/lib/rails_best_practices/command.rb

http://github.com/flyerhzm/rails_best_practices
Ruby | 17 lines | 14 code | 2 blank | 1 comment | 3 complexity | aceea916a0a2e360f11ed59a24d11ff4 MD5 | raw file
 1# frozen_string_literal: true
 2
 3require 'optparse'
 4options = RailsBestPractices::OptionParser.parse!
 5if !ARGV.empty? && !File.exist?(ARGV.first)
 6  puts "#{ARGV.first} doesn't exist"
 7  exit 1
 8end
 9
10if options['generate']
11  RailsBestPractices::Analyzer.new(ARGV.first).generate
12else
13  analyzer = RailsBestPractices::Analyzer.new(ARGV.first, options)
14  analyzer.analyze
15  analyzer.output
16  exit !analyzer.runner.errors.empty? ? 1 : 0
17end