diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-03 21:54:33 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-06-03 22:10:50 +0300 |
commit | d2b708ac43b0810ea2ce4de196ce46692e536027 (patch) | |
tree | 53eca3126b41fbd59c2e18d54671f9fb5f1d468f /lib/gitlab/ci/config.rb | |
parent | d501850e05ebadcbf2f957cbf35a0ffa6dbe31ff (diff) |
Extract CI config YAML parser to a separate class
With this approach it would be easier to add different sources of
configuration, that we do not necessairly have to be in YAML format.
Diffstat (limited to 'lib/gitlab/ci/config.rb')
-rw-r--r-- | lib/gitlab/ci/config.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/gitlab/ci/config.rb b/lib/gitlab/ci/config.rb index 8f88ccf5bf4..0baefa70f61 100644 --- a/lib/gitlab/ci/config.rb +++ b/lib/gitlab/ci/config.rb @@ -4,13 +4,13 @@ module Gitlab class ParserError < StandardError; end def initialize(config) - @config = YAML.safe_load(config, [Symbol], [], true) + parser = Parser.new(config) - unless @config.is_a?(Hash) - raise ParserError, 'YAML should be a hash' + unless parser.valid? + raise ParserError, 'Invalid configuration format!' end - @config = @config.deep_symbolize_keys + @config = parser.parse end def to_hash |