class SemVerComponents::GitHostings::Bitbucket

Public Instance Methods

commit_url(git_url, commit_sha) click to toggle source

Get the URL to a given commit sha

Parameters
  • git_url (String): The git URL

  • commit_sha (String): The commit sha

# File lib/sem_ver_components/git_hostings/bitbucket.rb, line 12
def commit_url(git_url, commit_sha)
  "#{public_url(git_url)}/commits/#{commit_sha}"
end
compare_url(git_url, tag_1, tag_2) click to toggle source

Get the URL to compare 2 tags

Parameters
  • git_url (String): The git URL

  • tag_1 (String): The first tag

  • tag_2 (String): The second tag

# File lib/sem_ver_components/git_hostings/bitbucket.rb, line 22
def compare_url(git_url, tag_1, tag_2)
  "#{public_url(git_url)}/compare/commits?targetBranch=refs%2Ftags%2F#{tag_1}&sourceBranch=refs%2Ftags%2F#{tag_2}"
end

Private Instance Methods

public_url(git_url) click to toggle source

Convert the git remote URL to the public URL

Parameters
  • git_url (String): Git remote URL

Result
  • String: The corresponding public URL

# File lib/sem_ver_components/git_hostings/bitbucket.rb, line 34
def public_url(git_url)
  if git_url =~ /^(.+)\/scm\/([^\/]+)\/(.+)$/
    base_url = $1
    project = $2
    repo = $3
    "#{base_url}/projects/#{project}/repos/#{repo}"
  else
    git_url
  end
end