lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb in adiwg-mdtranslator-2.4.0 vs lib/adiwg/mdtranslator/readers/mdJson/mdJson_reader.rb in adiwg-mdtranslator-2.5.0
- old
+ new
@@ -19,12 +19,12 @@
# Stan Smith 2013-08-23 split out metadata to module_metadata
# Stan Smith 2013-08-19 split out contacts to module_contacts
# Stan Smith 2013-08-09 original script
require 'json'
+require 'rubygems'
require_relative 'mdJson_validator'
-require_relative 'version'
require_relative 'modules/module_mdJson'
module ADIWG
module Mdtranslator
module Readers
@@ -86,11 +86,11 @@
hResponseObj[:readerStructurePass] = false
return {}
end
# schema - 2.0.0 =< requested version =< current version
- currentVersion = ADIWG::Mdtranslator::Readers::MdJson::VERSION
+ currentVersion = Gem::Specification.find_by_name('adiwg-mdjson_schemas').version.to_s
hResponseObj[:readerVersionRequested] = requestedVersion
hResponseObj[:readerVersionUsed] = currentVersion
aCurVersion = currentVersion.split('.')
aReqVersion = requestedVersion.split('.')
approved = false
@@ -98,10 +98,12 @@
if aReqVersion[1] <= aCurVersion[1]
approved = true
end
end
unless approved
+ approvedVersion = aCurVersion[0] + '.0.0'
hResponseObj[:readerStructureMessages] << "mdJson schema version '#{requestedVersion}' is not supported"
+ hResponseObj[:readerStructureMessages] << "mdJson versions '#{approvedVersion}' to '#{currentVersion}' are supported"
hResponseObj[:readerStructurePass] = false
return {}
end
# validate file against mdJson schema definition