 extend = require 'extend'
 
 module.exports = class ConfigParser
+  merge: (config1, config2) ->
+    extend true, {}, config1, config2
+
   load: (path, config = {}) ->
     newConfig = @_parse path, []
-    extend true, {}, config, newConfig
+    @merge config, newConfig
 
   _parse: (path, included) ->
     return {} if @_isRecursiveInclude path, included


    for includePath in config.include
      includePath = @_buildPathToInclude path, includePath
      config = extend true, {}, config, @_parse(includePath, included)

    delete config.include



  _loadYamlFile: (path) ->
    throw new Error "Config not found: #{path}" if not fs.existsSync path
    return yml.safeLoad fs.readFileSync path, 'utf8'

  _processIncludeDirective: (path, config, included) ->
    return config if not config.include
