Class: Geet::Services::CommentPr

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
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.



19
20
21
22
23
# File 'lib/geet/services/comment_pr.rb', line 19

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



32
33
34
35
36
37
# File 'lib/geet/services/comment_pr.rb', line 32

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