summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2015-04-21 11:58:45 +0200
committerDouwe Maan <douwe@gitlab.com>2015-04-24 14:49:22 +0200
commitc0116926c743818b2593474946abb40b56d8fefa (patch)
tree9c6d57d7d45f922bef051f2e46a04f1d5b9f7527 /lib
parent164a29df86f70910ac0bc6bd29f0fe6f4037b56e (diff)
downloadgitlab-ce-c0116926c743818b2593474946abb40b56d8fefa.tar.gz
Rename namespace_regex to namespace_path_regex.
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/markdown/cross_project_reference.rb2
-rw-r--r--lib/gitlab/markdown/user_reference_filter.rb2
-rw-r--r--lib/gitlab/reference_extractor.rb2
-rw-r--r--lib/gitlab/regex.rb8
4 files changed, 7 insertions, 7 deletions
diff --git a/lib/gitlab/markdown/cross_project_reference.rb b/lib/gitlab/markdown/cross_project_reference.rb
index c436fabd658..261fc0feb0e 100644
--- a/lib/gitlab/markdown/cross_project_reference.rb
+++ b/lib/gitlab/markdown/cross_project_reference.rb
@@ -3,7 +3,7 @@ module Gitlab
# Common methods for ReferenceFilters that support an optional cross-project
# reference.
module CrossProjectReference
- NAMING_PATTERN = Gitlab::Regex::NAMESPACE_REGEX_STR
+ NAMING_PATTERN = Gitlab::Regex::NAMESPACE_PATH_REGEX_STR
PROJECT_PATTERN = "(?<project>#{NAMING_PATTERN}/#{NAMING_PATTERN})"
# Given a cross-project reference string, get the Project record
diff --git a/lib/gitlab/markdown/user_reference_filter.rb b/lib/gitlab/markdown/user_reference_filter.rb
index 5fc8ed55fe2..d7885fdeefd 100644
--- a/lib/gitlab/markdown/user_reference_filter.rb
+++ b/lib/gitlab/markdown/user_reference_filter.rb
@@ -22,7 +22,7 @@ module Gitlab
end
# Pattern used to extract `@user` user references from text
- USER_PATTERN = /@(?<user>#{Gitlab::Regex::NAMESPACE_REGEX_STR})/
+ USER_PATTERN = /@(?<user>#{Gitlab::Regex::NAMESPACE_PATH_REGEX_STR})/
def call
replace_text_nodes_matching(USER_PATTERN) do |content|
diff --git a/lib/gitlab/reference_extractor.rb b/lib/gitlab/reference_extractor.rb
index 949dd5d26b1..1d6df9a29f1 100644
--- a/lib/gitlab/reference_extractor.rb
+++ b/lib/gitlab/reference_extractor.rb
@@ -85,7 +85,7 @@ module Gitlab
private
- NAME_STR = Gitlab::Regex::NAMESPACE_REGEX_STR
+ NAME_STR = Gitlab::Regex::NAMESPACE_PATH_REGEX_STR
PROJ_STR = "(?<project>#{NAME_STR}/#{NAME_STR})"
REFERENCE_PATTERN = %r{
diff --git a/lib/gitlab/regex.rb b/lib/gitlab/regex.rb
index 0571574aa4f..e5f5482a223 100644
--- a/lib/gitlab/regex.rb
+++ b/lib/gitlab/regex.rb
@@ -2,13 +2,13 @@ module Gitlab
module Regex
extend self
- NAMESPACE_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze
+ NAMESPACE_PATH_REGEX_STR = '(?:[a-zA-Z0-9_\.][a-zA-Z0-9_\-\.]*[a-zA-Z0-9_\-]|[a-zA-Z0-9_])'.freeze
- def namespace_regex
- @namespace_regex ||= /\A#{NAMESPACE_REGEX_STR}\z/.freeze
+ def namespace_path_regex
+ @namespace_path_regex ||= /\A#{NAMESPACE_PATH_REGEX_STR}\z/.freeze
end
- def namespace_regex_message
+ def namespace_path_regex_message
"can contain only letters, digits, '_', '-' and '.'. " \
"Cannot start with '-' or end in '.'." \
end