Class: Corkscrew::Git

Inherits:
Object
  • Object
show all
Defined in:
lib/corkscrew.rb

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Git

Returns a new instance of Git.



5
6
7
# File 'lib/corkscrew.rb', line 5

def initialize(hash)
  @hash = hash
end

Instance Method Details

#openObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/corkscrew.rb', line 9

def open
  if url_base.nil?
    $stderr.puts "It's not a github repository."
    exit 1
  end
  merge_commits = branchs.map { |branch| candidate(branch) }.flatten.uniq
  number = merge_commits.map { |merge_commit| pr_number(merge_commit) }.compact.min

  if number.nil?
    $stderr.puts "PR number.was not found."
    exit 1
  end
  `open #{url_base}/pull/#{number}`
end