class Atlassian::Stash::RepoInfo
Public Class Methods
create(config, url = get_remote_url)
click to toggle source
# File lib/atlassian/stash/repo_info.rb, line 40 def self.create (config, url = get_remote_url) if m = url.match(/\/([a-zA-Z~][a-zA-Z0-9_\-]*)\/([[:alnum:]][\w\-\.]*).git$/) return RepoInfo.new(config, m[1], m[2]) end raise "Repository does not seem to be hosted in Stash; Remote url: " + url end
new(config, projectKey, slug)
click to toggle source
# File lib/atlassian/stash/repo_info.rb, line 6 def initialize(config, projectKey, slug) @config = config @projectKey = projectKey @slug = slug end
Public Instance Methods
projectKey()
click to toggle source
# File lib/atlassian/stash/repo_info.rb, line 12 def projectKey @projectKey end
repoPath()
click to toggle source
# File lib/atlassian/stash/repo_info.rb, line 20 def repoPath uri = URI.parse(@config["stash_url"]) repoPath = uri.path + '/projects/' + @projectKey + '/repos/' + @slug repoPath end
repoUrl(suffix, branch)
click to toggle source
# File lib/atlassian/stash/repo_info.rb, line 26 def repoUrl(suffix, branch) uri = URI.parse(@config["stash_url"]) path = repoPath + (suffix.nil? ? '' : '/' + suffix) uri.path = path if (!branch.nil? and !branch.empty?) q = uri.query || '' q = q + (q.empty? ? '' : '&') + 'at=' + branch unless branch.nil? uri.query = q end uri.to_s end
slug()
click to toggle source
# File lib/atlassian/stash/repo_info.rb, line 16 def slug @slug end