Class: Geet::Services::OpenPr

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

Overview

Open in the browser 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) ⇒ OpenPr

Returns a new instance of OpenPr.



16
17
18
19
20
# File 'lib/geet/services/open_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(delete_branch: false) ⇒ Object



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

def execute(delete_branch: false, **)
  pr = checked_find_branch_pr
  open_file_with_default_application(pr.link)
  pr
end