lib/adapt/config/loader.rb in bake-toolkit-2.26.1 vs lib/adapt/config/loader.rb in bake-toolkit-2.27.0

- old
+ new

@@ -16,19 +16,23 @@ Bake::Configs::Checks.symlinkCheck(filename) f = @loader.load(filename) - if f.root_elements.length != 1 or not Metamodel::Adapt === f.root_elements[0] - Bake.formatter.printError("Config file must have exactly one 'Adapt' element as root element", filename) + if f.root_elements.any? { |re| ! Metamodel::Adapt === re } + Bake.formatter.printError("Config file must have only 'Adapt' elements as roots", filename) ExitHelper.exit(1) end - adapt = f.root_elements[0] - configs = adapt.getConfig + configs = [] + f.root_elements.each { |re| configs.concat(re.getConfig) } + AdaptConfig::checkSyntax(configs, filename) + configs + end - Bake::Configs::Checks::commonMetamodelCheck(configs, filename) + def self.checkSyntax(configs, filename) + Bake::Configs::Checks::commonMetamodelCheck(configs, filename, true) configs.each do |c| if not c.extends.empty? Bake.formatter.printError("Attribute 'extends' must not be used in adapt config.",c) ExitHelper.exit(1) @@ -44,11 +48,9 @@ if not ["replace", "remove", "extend"].include?c.type Bake.formatter.printError("Allowed types are 'replace', 'remove' and 'extend'.",c) ExitHelper.exit(1) end end - - configs end def getPotentialAdaptionProjects() potentialAdapts = [] Bake.options.roots.each do |r|