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:
Diffstat (limited to 'lib/gitlab/ci/config/external/file/base.rb')
-rw-r--r--lib/gitlab/ci/config/external/file/base.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/gitlab/ci/config/external/file/base.rb b/lib/gitlab/ci/config/external/file/base.rb
index ee4ea9bbb1d..2ac6656a703 100644
--- a/lib/gitlab/ci/config/external/file/base.rb
+++ b/lib/gitlab/ci/config/external/file/base.rb
@@ -8,20 +8,26 @@ module Gitlab
class Base
include Gitlab::Utils::StrongMemoize
- attr_reader :location, :opts, :errors
+ attr_reader :location, :params, :context, :errors
YAML_WHITELIST_EXTENSION = /.+\.(yml|yaml)$/i.freeze
- def initialize(location, opts = {})
- @location = location
- @opts = opts
+ Context = Struct.new(:project, :sha)
+
+ def initialize(params, context)
+ @params = params
+ @context = context
@errors = []
validate!
end
+ def matching?
+ location.present?
+ end
+
def invalid_extension?
- !::File.basename(location).match(YAML_WHITELIST_EXTENSION)
+ location.nil? || !::File.basename(location).match?(YAML_WHITELIST_EXTENSION)
end
def valid?