class MGit::GitMessageParser

Git interact message parse with git-server

Public Class Methods

new(url) click to toggle source
# File lib/m-git/foundation/git_message_parser.rb, line 7
def initialize(url)
  @url = url
end

Public Instance Methods

__default_parse_msg(msg) click to toggle source
# File lib/m-git/foundation/git_message_parser.rb, line 38
def __default_parse_msg(msg)
  return if msg.nil? || msg.empty?

  key_word = 'error:'
  error_line = msg.split("\n").find {|line|
    # 解析 "error: failed to push some refs..."
    line.include?(key_word)
  }
  msg if error_line
end
parse_code_review_url(input) click to toggle source

@return [String] codereview的url地址 默认无解析

# File lib/m-git/foundation/git_message_parser.rb, line 34
def parse_code_review_url(input)
  nil
end
parse_fetch_msg(input) click to toggle source

@return [String] error message @return [nil] none error

# File lib/m-git/foundation/git_message_parser.rb, line 14
def parse_fetch_msg(input)
  parse_pull_msg(input)
end
parse_pull_msg(input) click to toggle source

@return [String] error message @return [nil] none error

# File lib/m-git/foundation/git_message_parser.rb, line 21
def parse_pull_msg(input)
  __default_parse_msg(input)
end
parse_push_msg(input) click to toggle source

@return [String] error message @return [nil] none error

# File lib/m-git/foundation/git_message_parser.rb, line 28
def parse_push_msg(input)
  __default_parse_msg(input)
end