Class: Deodorant::Gerrit
- Inherits:
-
Object
- Object
- Deodorant::Gerrit
- Defined in:
- lib/deodorant/gerrit.rb
Instance Method Summary collapse
-
#initialize(gerry: nil, git_client: nil) ⇒ Gerrit
constructor
A new instance of Gerrit.
- #parse_change_id(commit_message:) ⇒ Object
-
#squash_and_push(base_sha:, head_sha:, commit_message:) ⇒ Object
def push_comments(comms:) end.
Constructor Details
#initialize(gerry: nil, git_client: nil) ⇒ Gerrit
Returns a new instance of Gerrit.
6 7 8 9 10 11 12 13 |
# File 'lib/deodorant/gerrit.rb', line 6 def initialize(gerry: nil, git_client: nil) @git_client = git_client || Repo.default_git_client @gerry = gerry || Gerry.new( URI.parse(@git_client.remote('gerrit').url).host, Config.gerrit_username, Config.gerrit_password ) end |
Instance Method Details
#parse_change_id(commit_message:) ⇒ Object
27 28 29 |
# File 'lib/deodorant/gerrit.rb', line 27 def parse_change_id(commit_message:) change_id = %r{Change-Id: (\d*\w*)$}.match().captures.first end |
#squash_and_push(base_sha:, head_sha:, commit_message:) ⇒ Object
def push_comments(comms:) end
18 19 20 21 22 23 24 25 |
# File 'lib/deodorant/gerrit.rb', line 18 def squash_and_push(base_sha:, head_sha:, commit_message:) @git_client.checkout head_sha @git_client.reset base_sha @git_client.add(all: true) @git_client.commit() @git_client.push('gerrit', 'HEAD:refs/for/master') parse_change_id(commit_message: @git_client.log.first.) end |