gitlab-org--gitlab-foss/lib/gitlab/ci/config.rb
2016-06-07 14:23:47 +02:00

30 lines
610 B
Ruby

module Gitlab
module Ci
class Config
class LoaderError < StandardError; end
delegate :valid?, :errors, to: :@global
##
# Temporary delegations that should be removed after refactoring
#
delegate :before_script, to: :@global
def initialize(config)
loader = Loader.new(config)
unless loader.valid?
raise LoaderError, 'Invalid configuration format!'
end
@config = loader.load
@global = Node::Global.new(@config)
@global.process!
end
def to_hash
@config
end
end
end
end