Class: BitbucketPullRequest::Remotes

Inherits:
Object
  • Object
show all
Defined in:
lib/bitbucket-pull-request/remotes.rb

Class Method Summary collapse

Class Method Details

.get_remotes_rawObject



12
13
14
# File 'lib/bitbucket-pull-request/remotes.rb', line 12

def self.get_remotes_raw
  `git remote -v`
end

.remote_pathObject



3
4
5
6
7
8
9
10
# File 'lib/bitbucket-pull-request/remotes.rb', line 3

def self.remote_path
  raw    = self.get_remotes_raw
  origin = raw.match(/^origin\s(.+?)\s\(\w+\)$/) || throw('No remote origin')

  path = origin[1].match(%r{bitbucket\.org/(.+?)\.git})

  path ? path[1] : throw('Only works with bitbucket repositories')
end