Class: Retag::Repo
Instance Attribute Summary collapse
-
#branch ⇒ Object
readonly
Returns the value of attribute branch.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
Instance Method Summary collapse
-
#initialize(repo, branch) ⇒ Repo
constructor
A new instance of Repo.
- #tag!(tag, message: nil) ⇒ Object
Methods included from Utils
Constructor Details
#initialize(repo, branch) ⇒ Repo
Returns a new instance of Repo.
8 9 10 11 12 |
# File 'lib/retag/repo.rb', line 8 def initialize(repo, branch) @repo = repo @branch = branch @gitlab = Gitlab.client end |
Instance Attribute Details
#branch ⇒ Object (readonly)
Returns the value of attribute branch.
6 7 8 |
# File 'lib/retag/repo.rb', line 6 def branch @branch end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/retag/repo.rb', line 6 def name @name end |
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
6 7 8 |
# File 'lib/retag/repo.rb', line 6 def repo @repo end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
6 7 8 |
# File 'lib/retag/repo.rb', line 6 def revision @revision end |
Instance Method Details
#tag!(tag, message: nil) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# 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, ) end |