lib/pronto/formatter/github_formatter.rb in pronto-0.6.0 vs lib/pronto/formatter/github_formatter.rb in pronto-0.7.0

- old
+ new

@@ -1,29 +1,17 @@ module Pronto module Formatter - class GithubFormatter - def format(messages, repo, _) - client = Github.new(repo) + class GithubFormatter < CommitFormatter + def client_module + Github + end - commit_messages = messages.uniq.map do |message| - sha = message.commit_sha - body = message.msg - path = message.path - position = message.line.commit_line.position if message.line - - create_comment(client, sha, body, path, position) - end - - "#{commit_messages.compact.count} Pronto messages posted to GitHub" + def pretty_name + 'GitHub' end - private - - def create_comment(client, sha, body, path, position) - comment = Github::Comment.new(sha, body, path, position) - comments = client.commit_comments(sha) - existing = comments.any? { |c| comment == c } - client.create_commit_comment(comment) unless existing + def line_number(message) + message.line.commit_line.position end end end end