Class: Geet::Services::CommentPr

Inherits:
Object
  • Object
show all
Includes:
Helpers::OsHelper, Helpers::ServicesWorkflowHelper
Defined in:
lib/geet/services/comment_pr.rb

Overview

Add a comment to the PR for the current branch.

Constant Summary collapse

DEFAULT_GIT_CLIENT =
Geet::Utils::GitClient.new

Instance Method Summary collapse

Methods included from Helpers::ServicesWorkflowHelper

#checked_find_branch_pr

Methods included from Helpers::OsHelper

#execute_command, #open_file_with_default_application

Constructor Details

#initialize(repository, out: $stdout, git_client: DEFAULT_GIT_CLIENT) ⇒ CommentPr

Returns a new instance of CommentPr.



16
17
18
19
20
# File 'lib/geet/services/comment_pr.rb', line 16

def initialize(repository, out: $stdout, git_client: DEFAULT_GIT_CLIENT)
  @repository = repository
  @out = out
  @git_client = git_client
end

Instance Method Details

#execute(comment, open_browser: false) ⇒ Object



22
23
24
25
26
27
# File 'lib/geet/services/comment_pr.rb', line 22

def execute(comment, open_browser: false, **)
  pr = checked_find_branch_pr
  pr.comment(comment)
  open_file_with_default_application(pr.link) if open_browser
  pr
end