Module: Ci::HasRef
- Extended by:
- ActiveSupport::Concern
- Defined in:
- app/models/concerns/ci/has_ref.rb
Instance Method Summary collapse
- #branch? ⇒ Boolean
- #git_ref ⇒ Object
-
#ref_slug ⇒ Object
A slugified version of the build ref, suitable for inclusion in URLs and domain names.
Instance Method Details
#branch? ⇒ Boolean
10 11 12 |
# File 'app/models/concerns/ci/has_ref.rb', line 10 def branch? !tag? && !merge_request? end |
#git_ref ⇒ Object
14 15 16 17 18 19 20 |
# File 'app/models/concerns/ci/has_ref.rb', line 14 def git_ref if branch? Gitlab::Git::BRANCH_REF_PREFIX + ref.to_s elsif tag? Gitlab::Git::TAG_REF_PREFIX + ref.to_s end end |
#ref_slug ⇒ Object
A slugified version of the build ref, suitable for inclusion in URLs and domain names. Rules:
* Lowercased
* Anything not matching [a-z0-9-] is replaced with a -
* Maximum length is 63 bytes
* First/Last Character is not a hyphen
29 30 31 |
# File 'app/models/concerns/ci/has_ref.rb', line 29 def ref_slug Gitlab::Utils.slugify(ref.to_s) end |