summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-03-02 15:00:00 +0100
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2019-03-02 15:00:00 +0100
commiteb2966fadd10428d04fadf3d4f673b55f94c1c3a (patch)
treec0c8ef79d8772dbe0018ba1e35a63ffc01dbecda
parentdc7d0249d5c172c3c3befda55ccca9b6f2d0203f (diff)
downloadgitlab-ce-eb2966fadd10428d04fadf3d4f673b55f94c1c3a.tar.gz
Move ref slug helper to HasRef module
-rw-r--r--app/models/ci/bridge.rb1
-rw-r--r--app/models/ci/build.rb11
-rw-r--r--app/models/concerns/has_ref.rb11
3 files changed, 12 insertions, 11 deletions
diff --git a/app/models/ci/bridge.rb b/app/models/ci/bridge.rb
index 5450d40ea95..f570403615b 100644
--- a/app/models/ci/bridge.rb
+++ b/app/models/ci/bridge.rb
@@ -5,6 +5,7 @@ module Ci
include Ci::Processable
include Importable
include AfterCommitQueue
+ include HasRef
include Gitlab::Utils::StrongMemoize
belongs_to :project
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 65962fba14d..f2369191b76 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -398,17 +398,6 @@ module Ci
options&.dig(:environment, :on_stop)
end
- # 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
- def ref_slug
- Gitlab::Utils.slugify(ref.to_s)
- end
-
##
# Variables in the environment name scope.
#
diff --git a/app/models/concerns/has_ref.rb b/app/models/concerns/has_ref.rb
index e0a48a930cb..413cd36dcaa 100644
--- a/app/models/concerns/has_ref.rb
+++ b/app/models/concerns/has_ref.rb
@@ -14,4 +14,15 @@ module HasRef
Gitlab::Git::TAG_REF_PREFIX + ref.to_s
end
end
+
+ # 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
+ def ref_slug
+ Gitlab::Utils.slugify(ref.to_s)
+ end
end