Sha256: 1db45bd0f927ecdcca1cc2a0402bfcff47e04b1f83b895f1c66df4c25f710509

Contents?: true

Size: 624 Bytes

Versions: 10

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

module RailsBestPractices
  class CLI
    # 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'])
    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
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rails_best_practices-1.23.2 lib/rails_best_practices/cli.rb
rails_best_practices-1.23.1 lib/rails_best_practices/cli.rb
rails_best_practices-1.23.0 lib/rails_best_practices/cli.rb
rails_best_practices-1.22.1 lib/rails_best_practices/cli.rb
rails_best_practices-1.22.0 lib/rails_best_practices/cli.rb
rails_best_practices-1.21.0 lib/rails_best_practices/cli.rb
rails_best_practices-1.20.1 lib/rails_best_practices/cli.rb
rails_best_practices-1.20.0 lib/rails_best_practices/cli.rb
rails_best_practices-1.19.5 lib/rails_best_practices/cli.rb
rails_best_practices-1.19.4 lib/rails_best_practices/cli.rb