class Retag::Repo
Attributes
branch[R]
name[R]
repo[R]
revision[R]
Public Class Methods
new(repo, branch)
click to toggle source
# File lib/retag/repo.rb, line 8 def initialize(repo, branch) @repo = repo @branch = branch @gitlab = Gitlab.client end
Public Instance Methods
tag!(tag, message: nil)
click to toggle source
# File lib/retag/repo.rb, line 14 def tag!(tag, message: nil) begin result = @gitlab.tag(name, tag) if result.to_h.dig('commit', 'short_id').to_s == revision # Success: tag with same revision already exists return true end rescue Gitlab::Error::NotFound # Success: there is no such tag end @gitlab.create_tag(name, tag, revision, message) end
Private Instance Methods
remote_refs(repo, branch)
click to toggle source
# File lib/retag/repo.rb, line 51 def remote_refs repo, branch cmd!("git ls-remote #{repo} #{branch}", capture: true).split("\n").select{|line| line.strip.end_with?("/#{branch}") }.first end