class PullRequest::Create::Repository
Public Class Methods
new(path, options = {})
click to toggle source
# File lib/pull_request/create/repository.rb, line 4 def initialize(path, options = {}) @path = path @options = options end
Public Instance Methods
current_branch()
click to toggle source
# File lib/pull_request/create/repository.rb, line 17 def current_branch git.current_branch end
git()
click to toggle source
# File lib/pull_request/create/repository.rb, line 13 def git @git ||= ::Git.open(@path, @options) end
logger()
click to toggle source
# File lib/pull_request/create/repository.rb, line 9 def logger ::PullRequest::Create.logger end
remote_urls()
click to toggle source
# File lib/pull_request/create/repository.rb, line 30 def remote_urls git .remotes .map(&:url) end
slug()
click to toggle source
# File lib/pull_request/create/repository.rb, line 21 def slug slug_regex = %r{\A/?(?<slug>.*?)(?:\.git)?\Z} remote_urls.map do |url| uri = GitCloneUrl.parse(url) match = slug_regex.match(uri.path) match[:slug] if match end.compact.first end