Class: Pronto::CLI

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.is_thor_reserved_word?(word, type) ⇒ Boolean

Returns:

  • (Boolean)

9
10
11
12
# File 'lib/pronto/cli.rb', line 9

def is_thor_reserved_word?(word, type)
  return false if word == 'run'
  super
end

Instance Method Details

#listObject


60
61
62
# File 'lib/pronto/cli.rb', line 60

def list
  puts ::Pronto.gem_names
end

#run(path = nil) ⇒ Object


44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/pronto/cli.rb', line 44

def run(path = nil)
  gem_names = options[:runner].any? ? options[:runner] : ::Pronto.gem_names
  gem_names.each do |gem_name|
    require "pronto/#{gem_name}"
  end

  formatter = ::Pronto::Formatter.get(options[:formatter])
  commit = options[:index] ? :index : options[:commit]
  messages = ::Pronto.run(commit, '.', formatter, path)
  exit(messages.count) if options[:'exit-code']
rescue Rugged::RepositoryError
  puts '"pronto" should be run from a git repository'
end

#versionObject


67
68
69
# File 'lib/pronto/cli.rb', line 67

def version
  puts "Pronto version #{::Pronto::VERSION}"
end