lib/aws/cfn/compiler/mixins/parse.rb in aws-cfn-compiler-0.9.4 vs lib/aws/cfn/compiler/mixins/parse.rb in aws-cfn-compiler-0.9.5

- old
+ new

@@ -1,8 +1,10 @@ require 'rubygems/dependency' require 'semverse' require 'awesome_print' +require 'aws/cfn/dsl/version' +require 'aws/cfn/decompiler/version' module Aws module Cfn module Compiler module Parse @@ -22,11 +24,11 @@ reqs.each do |name,args| requirement(name,args) end end rescue Exception => e - # pass ... abort! e + abort! e end end def requirement(name, *args) @@ -42,16 +44,32 @@ raise "Unsupported class #{args.class.name} for #{args.ai}" end version,constraint = case name when /Compiler/ [Aws::Cfn::Compiler::VERSION,constraint] + when /^(DeCompiler|Decompiler)/ + [Aws::Cfn::DeCompiler::VERSION,constraint] + when /^(Dsl|DSL)/ + [Aws::Cfn::Dsl::VERSION,constraint] + when /Gems/ + constraint.map { |h| + h.map { |k,v| + ver = eval "#{k}::VERSION" + semver = ::Semverse::Version.new(ver) + raise "The constraint failed: #{k} #{v} (Found #{ver})" unless ::Semverse::Constraint.new(v).satisfies?(semver) + } + } + return + when /Template/ + @logger.warn "Template constraint check supported but not implemented in version #{VERSION}: #{constraint}" + return # when /MinVersion/ # [Aws::Cfn::Compiler::VERSION,">= #{constraint}"] else raise "#{name} constraint not supported" end - raise "The constraint failed: #{name} #{constraint}" unless ::Semverse::Constraint.new(constraint).satisfies?(::Semverse::Version.new(version)) + raise "The constraint failed: #{name} #{constraint} (Found #{version})" unless ::Semverse::Constraint.new(constraint).satisfies?(::Semverse::Version.new(version)) end # noinspection RubyGlobalVariableNamingConvention def parse_section(section,spec=nil)