Class: Pronto::Formatter::GitFormatter

Inherits:
Base
  • Object
show all
Defined in:
lib/pronto/formatter/git_formatter.rb

Direct Known Subclasses

CommitFormatter, PullRequestFormatter

Instance Method Summary collapse

Methods inherited from Base

#config, name

Instance Method Details

#client_moduleObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/pronto/formatter/git_formatter.rb', line 16

def client_module
  raise NotImplementedError
end

#format(messages, repo, patches) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/pronto/formatter/git_formatter.rb', line 4

def format(messages, repo, patches)
  client = client_module.new(repo)
  existing = existing_comments(messages, client, repo)
  comments = new_comments(messages, patches)
  additions = remove_duplicate_comments(existing, comments)
  submit_comments(client, additions)
  
  approve_pull_request(comments.count, additions.count, client) if defined?(self.approve_pull_request)

  "#{additions.count} Pronto messages posted to #{pretty_name} (#{existing.count} existing)"
end

#pretty_nameObject

Raises:

  • (NotImplementedError)


20
21
22
# File 'lib/pronto/formatter/git_formatter.rb', line 20

def pretty_name
  raise NotImplementedError
end