44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/pronto/cli.rb', line 44
def run(path = nil)
gem_names = options[:runner].any? ? options[:runner] : ::Pronto::GemNames.new.to_a
gem_names.each do |gem_name|
require "pronto/#{gem_name}"
end
formatters = ::Pronto::Formatter.get(options[:formatters])
commit = options[:index] ? :index : options[:commit]
repo_workdir = ::Rugged::Repository.discover('.').workdir
messages = Dir.chdir(repo_workdir) do
::Pronto.run(commit, '.', formatters, path)
end
if options[:'exit-code']
error_messages_count = messages.count { |m| m.level != :info }
exit(error_messages_count)
end
rescue Rugged::RepositoryError
puts '"pronto" should be run from a git repository'
end
|