summaryrefslogtreecommitdiff
path: root/app/models/protected_tag.rb
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 15:17:24 +0100
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 17:19:53 +0100
commit65f3d5062f081d8f8ebf727a3408650d90ec9711 (patch)
tree0246397bd1a234ce9f34b9145321a1c4e40c1cd4 /app/models/protected_tag.rb
parenta7c71c7f292c9cdf892f7d33dfb52d7e16af28e6 (diff)
downloadgitlab-ce-65f3d5062f081d8f8ebf727a3408650d90ec9711.tar.gz
Extract ProtectedRef Concern
Diffstat (limited to 'app/models/protected_tag.rb')
-rw-r--r--app/models/protected_tag.rb31
1 files changed, 1 insertions, 30 deletions
diff --git a/app/models/protected_tag.rb b/app/models/protected_tag.rb
index d307549aa49..301fe2092e9 100644
--- a/app/models/protected_tag.rb
+++ b/app/models/protected_tag.rb
@@ -1,39 +1,10 @@
class ProtectedTag < ActiveRecord::Base
include Gitlab::ShellAdapter
-
- belongs_to :project
- validates :name, presence: true
- validates :project, presence: true
+ include ProtectedRef
has_many :push_access_levels, dependent: :destroy
validates :push_access_levels, length: { is: 1, message: "are restricted to a single instance per protected tag." }
accepts_nested_attributes_for :push_access_levels
-
- def commit
- project.commit(self.name)
- end
-
- def self.matching(tag_name, protected_tags: nil)
- ProtectedRefMatcher.matching(ProtectedTag, tag_name, protected_refs: protected_tags)
- end
-
- def matching(branches)
- ref_matcher.matching(branches)
- end
-
- def matches?(tag_name)
- ref_matcher.matches?(tag_name)
- end
-
- def wildcard?
- ref_matcher.wildcard?
- end
-
- private
-
- def ref_matcher
- @ref_matcher ||= ProtectedRefMatcher.new(self)
- end
end