6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/checker/cli.rb', line 6
def execute
if ARGV.size == 0
modules = get_modules_to_check
else
if ARGV[0] == "install"
Checker::Installator.install!
elsif ARGV[0] == "help"
Checker::Helper.show_help!
elsif ARGV[0] == "modules"
Checker::Helper.show_modules!(self.available_modules)
else
modules = ARGV.map(&:downcase)
end
end
if modules.empty? || modules.include?('all')
modules = available_modules
end
check_module_availability(modules) do |result|
puts "Modules not available: #{result.join(", ")}.\n"
puts "Available: all, #{available_modules.join(", ")}\n"
puts "Check your git config checker.check\n"
exit 1
end
module_instances = []
files = modified_files
modules.each do |mod|
klass = "Checker::Modules::#{mod.downcase.capitalize}".constantize
module_instances << klass.new(files.dup)
end
files_checked = module_instances.map(&:files_to_check).flatten.uniq
puts "[ CHECKER #{Checker::VERSION} - #{files_checked.size} files ]".light_blue
results = module_instances.map(&:check)
exit (results.all_true? ? 0 : 1)
end
|