Module: Pronto

Defined in:
lib/pronto.rb,
lib/pronto/cli.rb,
lib/pronto/plugin.rb,
lib/pronto/runner.rb,
lib/pronto/message.rb,
lib/pronto/version.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/rake_task/travis_pull_request.rb

Defined Under Namespace

Modules: Formatter, Plugin, RakeTask Classes: CLI, Message, Runner

Constant Summary collapse

VERSION =
'0.2.4'

Class Method Summary collapse

Class Method Details

.gem_namesObject



33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/pronto.rb', line 33

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.exists?(runner_path)
    end
  end

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

.run(commit = 'master', repo_path = '.', formatter = nil) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/pronto.rb', line 21

def self.run(commit = 'master', repo_path = '.', formatter = nil)
  repo = Rugged::Repository.new(repo_path)
  commit ||= 'master'
  merge_base = repo.merge_base(commit, repo.head.target)
  patches = repo.diff(merge_base, repo.head.target)

  result = run_all_runners(patches, merge_base)

  formatter ||= default_formatter
  formatter.format(result, repo)
end