Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 21:06:05 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-24 21:06:05 +0300
commit2ed368929ab5094fec5da8038f723463596a80cf (patch)
treeaec98d50349b0e9a490db0099253b801b2d1a9ea /lib/gitlab/ci/config/external/mapper.rb
parentf1a5755898e865428c923587402fd965b601c4ea (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/ci/config/external/mapper.rb')
-rw-r--r--lib/gitlab/ci/config/external/mapper.rb25
1 files changed, 8 insertions, 17 deletions
diff --git a/lib/gitlab/ci/config/external/mapper.rb b/lib/gitlab/ci/config/external/mapper.rb
index aff5c5b9651..5f7694e2cc6 100644
--- a/lib/gitlab/ci/config/external/mapper.rb
+++ b/lib/gitlab/ci/config/external/mapper.rb
@@ -21,14 +21,9 @@ module Gitlab
DuplicateIncludesError = Class.new(Error)
TooManyIncludesError = Class.new(Error)
- def initialize(values, project:, sha:, user:, expandset:)
- raise Error, 'Expanded needs to be `Set`' unless expandset.is_a?(Set)
-
+ def initialize(values, context)
@locations = Array.wrap(values.fetch(:include, []))
- @project = project
- @sha = sha
- @user = user
- @expandset = expandset
+ @context = context
end
def process
@@ -43,7 +38,9 @@ module Gitlab
private
- attr_reader :locations, :project, :sha, :user, :expandset
+ attr_reader :locations, :context
+
+ delegate :expandset, to: :context
# convert location if String to canonical form
def normalize_location(location)
@@ -68,11 +65,11 @@ module Gitlab
end
# We scope location to context, as this allows us to properly support
- # relative incldues, and similarly looking relative in another project
+ # relative includes, and similarly looking relative in another project
# does not trigger duplicate error
scoped_location = location.merge(
- context_project: project,
- context_sha: sha)
+ context_project: context.project,
+ context_sha: context.sha)
unless expandset.add?(scoped_location)
raise DuplicateIncludesError, "Include `#{location.to_json}` was already included!"
@@ -88,12 +85,6 @@ module Gitlab
matching.first
end
-
- def context
- strong_memoize(:context) do
- External::File::Base::Context.new(project, sha, user, expandset)
- end
- end
end
end
end