Class: ActiveRecord::DataIntegrity::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/active_record/data_integrity/cli.rb

Overview

CLI application class

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



10
11
12
# File 'lib/active_record/data_integrity/cli.rb', line 10

def options
  @options
end

Instance Method Details

#check(_args = ARGV) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/active_record/data_integrity/cli.rb', line 17

def check(_args = ARGV)
  @options = Options.new(options)
  require_rails

  results = cops.map do |cop_class|
    ActiveRecord::Base.descendants.each do |model|
      cop_class.new(model).call
    end
  end

  ActiveRecord::DataIntegrity::Collector.render

  exit(1) if results.include?(false)
end

#versionObject



34
35
36
# File 'lib/active_record/data_integrity/cli.rb', line 34

def version
  puts ActiveRecord::DataIntegrity::VERSION
end