Class: Modelist::CLI

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

Instance Method Summary collapse

Instance Method Details

#circular(*args) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/modelist/cli.rb', line 28

def circular(*args)
  # load Rails environment
  require './config/environment'
  require 'modelist/circular_ref_checker'
  args.each {|a| puts "Unsupported option: #{args.delete(a)}" if a.to_s.starts_with?('-')}
  exit ::Modelist::CircularRefChecker.test_models(*args) ? 0 : 1
end

#paths(*args) ⇒ Object



46
47
48
49
50
51
# File 'lib/modelist/cli.rb', line 46

def paths(*args)
  # load Rails environment
  require './config/environment'      
  args.each {|a| puts "Unsupported option: #{args.delete(a)}" if a.to_s.starts_with?('-')}
  exit ::Modelist::PathFinder.find_all(*args) ? 0 : 1
end

#required(*args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/modelist/cli.rb', line 17

def required(*args)
  # load Rails environment
  require './config/environment'
  require 'modelist/analyst'
  args.each {|a| puts "Unsupported option: #{args.delete(a)}" if a.to_s.starts_with?('-')}
  Modelist::Analyst.find_required_models(*args)
  exit 0
end

#search(*args) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/modelist/cli.rb', line 37

def search(*args)
  # load Rails environment
  require './config/environment'
  require 'modelist/searcher'
  args.each {|a| puts "Unsupported option: #{args.delete(a)}" if a.to_s.starts_with?('-')}
  exit ::Modelist::Searcher.find_all(*args) ? 0 : 1
end

#test(*args) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/modelist/cli.rb', line 8

def test(*args)
  # load Rails environment
  require './config/environment'
  require 'modelist/tester'
  args.each {|a| puts "Unsupported option: #{args.delete(a)}" if a.to_s.starts_with?('-')}
  exit ::Modelist::Tester.test_models(*args) ? 0 : 1
end