Class: GitTopic::Commands::Publish

Inherits:
Object
  • Object
show all
Defined in:
lib/git_topic/commands/publish.rb

Overview

Publish command creates pull request from description.

Instance Method Summary collapse

Constructor Details

#initialize(client, repo, branch_name, base) ⇒ Publish

Returns a new instance of Publish.



9
10
11
12
13
14
# File 'lib/git_topic/commands/publish.rb', line 9

def initialize(client, repo, branch_name, base)
  @client = client
  @repo = repo
  @branch_name = branch_name
  @base = base
end

Instance Method Details

#executeObject



16
17
18
19
20
21
22
# File 'lib/git_topic/commands/publish.rb', line 16

def execute
  head = @branch_name
  response = create_pull_request(@repo, @base, head)
  puts response[:html_url]
rescue StandardError => ex
  STDERR.puts ex.message
end