Module: Pronto

Defined in:
lib/pronto.rb,
lib/pronto/cli.rb,
lib/pronto/github.rb,
lib/pronto/gitlab.rb,
lib/pronto/plugin.rb,
lib/pronto/runner.rb,
lib/pronto/message.rb,
lib/pronto/version.rb,
lib/pronto/git/line.rb,
lib/pronto/git/patch.rb,
lib/pronto/git/patches.rb,
lib/pronto/git/repository.rb,
lib/pronto/formatter/formatter.rb,
lib/pronto/formatter/json_formatter.rb,
lib/pronto/formatter/text_formatter.rb,
lib/pronto/formatter/github_formatter.rb,
lib/pronto/formatter/gitlab_formatter.rb,
lib/pronto/rake_task/travis_pull_request.rb,
lib/pronto/formatter/checkstyle_formatter.rb,
lib/pronto/formatter/github_pull_request_formatter.rb

Defined Under Namespace

Modules: Formatter, Git, Plugin, RakeTask Classes: CLI, Github, Gitlab, Message, Runner

Constant Summary collapse

VERSION =
'0.4.0'

Class Method Summary collapse

Class Method Details

.gem_namesObject



41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/pronto.rb', line 41

def self.gem_names
  gems = Gem::Specification.find_all.select do |gem|
    if gem.name =~ /^pronto-/
      true
    elsif gem.name != 'pronto'
      runner_path = File.join(gem.full_gem_path, "lib/pronto/#{gem.name}.rb")
      File.exist?(runner_path)
    end
  end

  gems.map { |gem| gem.name.sub(/^pronto-/, '') }
      .uniq
      .sort
end

.run(commit = 'master', repo_path = '.', formatter = Formatter::TextFormatter.new, file = nil) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/pronto.rb', line 26

def self.run(commit = 'master', repo_path = '.',
             formatter = Formatter::TextFormatter.new, file = nil)
  commit ||= 'master'

  repo = Git::Repository.new(repo_path)
  options = { paths: [file] } if file
  patches = repo.diff(commit, options)

  result = run_all_runners(patches)

  puts formatter.format(result, repo)

  result
end