adiwg-mdtranslator 0.9.0 → 0.10.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -6
  3. data/adiwg-mdtranslator.gemspec +2 -2
  4. data/bin/mdtranslator +10 -10
  5. data/lib/adiwg/mdtranslator.rb +54 -12
  6. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +87 -7
  7. data/lib/adiwg/mdtranslator/readers/{adiwgJson/adiwgJson_reader.rb → mdJson/mdJson_reader.rb} +13 -4
  8. data/lib/adiwg/mdtranslator/readers/{adiwgJson/adiwgJson_validator.rb → mdJson/mdJson_validator.rb} +18 -10
  9. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_additionalDocumentation.rb +2 -2
  10. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_address.rb +1 -1
  11. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_associatedResource.rb +3 -3
  12. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_boundingBox.rb +1 -1
  13. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_browseGraphic.rb +1 -1
  14. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_citation.rb +5 -5
  15. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_contacts.rb +7 -7
  16. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_coordinates.rb +1 -1
  17. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dataDictionary.rb +53 -0
  18. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_dataQuality.rb +2 -2
  19. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_dateTime.rb +1 -1
  20. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_descriptiveKeyword.rb +2 -2
  21. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_dictionaryInfo.rb +52 -0
  22. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_distributionInfo.rb +4 -4
  23. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domain.rb +62 -0
  24. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_domainItem.rb +42 -0
  25. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entity.rb +92 -0
  26. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityAttribute.rb +91 -0
  27. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityForeignKey.rb +43 -0
  28. data/lib/adiwg/mdtranslator/readers/mdJson/modules_0.9.0/module_entityIndex.rb +42 -0
  29. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_extent.rb +4 -4
  30. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoCoordSystem.rb +1 -1
  31. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geoProperties.rb +4 -4
  32. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_geographicElement.rb +12 -12
  33. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_legalConstraint.rb +1 -1
  34. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_lineString.rb +2 -2
  35. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_lineage.rb +3 -3
  36. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadata.rb +6 -6
  37. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadataExtension.rb +2 -2
  38. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_metadataInfo.rb +8 -8
  39. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_onlineResource.rb +1 -1
  40. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_phone.rb +1 -1
  41. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_point.rb +2 -2
  42. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_polygon.rb +2 -2
  43. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_processStep.rb +4 -4
  44. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resolution.rb +1 -1
  45. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceFormat.rb +1 -1
  46. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceIdentifier.rb +2 -2
  47. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceInfo.rb +16 -16
  48. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceMaintenance.rb +2 -2
  49. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_resourceSpecificUsage.rb +2 -2
  50. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_responsibleParty.rb +2 -2
  51. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_securityConstraint.rb +1 -1
  52. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_source.rb +3 -3
  53. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_spatialReference.rb +1 -1
  54. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_taxonClass.rb +1 -1
  55. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_taxonomy.rb +5 -5
  56. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_temporalElement.rb +4 -4
  57. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_timeInstant.rb +3 -3
  58. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_timePeriod.rb +4 -4
  59. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_verticalElement.rb +1 -1
  60. data/lib/adiwg/mdtranslator/readers/{adiwgJson → mdJson}/modules_0.9.0/module_voucher.rb +2 -2
  61. data/lib/adiwg/mdtranslator/readers/mdJson/readme.md +19 -0
  62. data/lib/adiwg/mdtranslator/version.rb +5 -1
  63. data/lib/adiwg/mdtranslator/writers/iso/classes/class_FCfeatureCatalogue.rb +171 -0
  64. data/lib/adiwg/mdtranslator/writers/{iso19115_2/classes/class_metadata.rb → iso/classes/class_MImetadata.rb} +3 -3
  65. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_address.rb +0 -0
  66. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_aggregateInformation.rb +0 -0
  67. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_boundingPolygon.rb +0 -0
  68. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_browseGraphic.rb +0 -0
  69. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_citation.rb +3 -3
  70. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_contact.rb +1 -1
  71. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_dataIdentification.rb +0 -0
  72. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_dataQuality.rb +0 -0
  73. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_date.rb +0 -0
  74. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_digitalTransferOptions.rb +0 -0
  75. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_distribution.rb +0 -0
  76. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_distributor.rb +0 -0
  77. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_extent.rb +0 -0
  78. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureAttribute.rb +114 -0
  79. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureConstraint.rb +55 -0
  80. data/lib/adiwg/mdtranslator/writers/iso/classes/class_featureType.rb +120 -0
  81. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_format.rb +0 -0
  82. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_genericMetaData.rb +0 -0
  83. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicBoundingBox.rb +0 -0
  84. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicDescription.rb +0 -0
  85. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_geographicElement.rb +0 -0
  86. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_identifier.rb +0 -0
  87. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_keyword.rb +0 -0
  88. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_legalConstraints.rb +0 -0
  89. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_lineString.rb +1 -1
  90. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_lineage.rb +0 -0
  91. data/lib/adiwg/mdtranslator/writers/iso/classes/class_listedValue.rb +68 -0
  92. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_maintenanceInformation.rb +0 -0
  93. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_medium.rb +0 -0
  94. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_metadataExtension.rb +0 -0
  95. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_multiGeometry.rb +3 -3
  96. data/lib/adiwg/mdtranslator/writers/iso/classes/class_multiplicity.rb +44 -0
  97. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_onlineResource.rb +0 -0
  98. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_point.rb +1 -1
  99. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_polygon.rb +2 -2
  100. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_processStep.rb +1 -1
  101. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_referenceIdentifier.rb +0 -0
  102. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_referenceSystem.rb +0 -0
  103. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_resolution.rb +0 -0
  104. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_responsibleParty.rb +1 -1
  105. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_securityConstraints.rb +0 -0
  106. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_source.rb +0 -0
  107. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_standardOrderProcess.rb +0 -0
  108. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_taxonClassification.rb +0 -0
  109. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_taxonSystem.rb +0 -0
  110. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_telephone.rb +0 -0
  111. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_temporalExtent.rb +0 -0
  112. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_timeInstant.rb +1 -1
  113. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_timePeriod.rb +1 -1
  114. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_usage.rb +0 -0
  115. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_useConstraints.rb +0 -0
  116. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_verticalExtent.rb +0 -0
  117. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/classes/class_vouchers.rb +0 -0
  118. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_associationType.rb +0 -0
  119. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_characterSet.rb +0 -0
  120. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_classification.rb +0 -0
  121. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_datatype.rb +0 -0
  122. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_dateType.rb +0 -0
  123. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_initiativeType.rb +0 -0
  124. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_keywordType.rb +0 -0
  125. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_maintenanceFrequency.rb +0 -0
  126. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_mediumFormat.rb +0 -0
  127. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_mediumName.rb +0 -0
  128. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_obligation.rb +0 -0
  129. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_onlineFunction.rb +0 -0
  130. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_presentationForm.rb +0 -0
  131. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_progress.rb +0 -0
  132. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_restriction.rb +0 -0
  133. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_role.rb +0 -0
  134. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_scope.rb +0 -0
  135. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_spatialRepresentationType.rb +0 -0
  136. data/lib/adiwg/mdtranslator/writers/{iso19115_2 → iso}/codelists/code_topicCategory.rb +0 -0
  137. data/lib/adiwg/mdtranslator/writers/iso/units/class_baseUnit.rb +27 -0
  138. data/lib/adiwg/mdtranslator/writers/iso/units/class_conventionalUnit.rb +53 -0
  139. data/lib/adiwg/mdtranslator/writers/iso/units/class_definitionUnit.rb +24 -0
  140. data/lib/adiwg/mdtranslator/writers/iso/units/class_derivedUnit.rb +31 -0
  141. data/lib/adiwg/mdtranslator/writers/iso/units/class_unitsOfMeasure.rb +224 -0
  142. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +28 -0
  143. data/lib/adiwg/mdtranslator/writers/iso19110/readme.md +13 -0
  144. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +1 -1
  145. data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +6 -9
  146. data/test/tc_translation.rb +35 -18
  147. metadata +166 -146
  148. data/lib/adiwg/mdtranslator/readers/adiwgJson/readme.md +0 -19
  149. data/mdtranslator.rb +0 -187
@@ -1,19 +0,0 @@
1
-
2
- ## adiwgJson
3
-
4
- ### Supported versions
5
-
6
- > 0.8.0
7
-
8
- ### Reader for ADIwg JSON metadata format
9
-
10
- The adiwgJson format is a simple JSON format for documenting and exchanging information
11
- about scientific projects and data. The Alaska Data Integration working group (ADIwg) wrote the
12
- standard to support translation to complex standards such as the ISO 19115-2 Geographic Metadata standard
13
- and FGDC's Content Standard for Digital Geospatial Metadata. The adiwgJson standard
14
- remains independent of any published standards while comprehensive enough to support translation
15
- to many. The adiwgJson standard is also a convenient format to exchange directly with other organizations as
16
- the JSON structure is easier read and ingest by many programming languages.
17
-
18
- The adiwg format is fully documented on the interactive
19
- [adiwgJson Viewer](http://jlblcc.github.io/json-schema-viewer/) website.
@@ -1,187 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # ADIwg mdTranslator - Thor CLI for mdtranslator
3
-
4
- # History:
5
- # Stan Smith 2014-07-15 original script
6
- # Stan Smith 2014-09-02 changed name to mdtranslator
7
- # Stan Smith 2014-09-21 coded cli to 0.8.0 api
8
- # Stan Smith 2014-10-09 added version command to the CLI
9
-
10
- # uncomment next 2 lines during development to run from code (not gem) ....
11
- lib = File.expand_path('lib')
12
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
13
-
14
- require 'thor'
15
- require 'adiwg-mdtranslator'
16
-
17
- class Mdtranslator < Thor
18
-
19
- # exit_on_failure added to exit with code 1 if thor cannot complete task
20
- # such as if required parameters are missing
21
- def self.exit_on_failure?
22
- true
23
- end
24
-
25
- # basic cli description
26
- desc 'translate [FILE]', %q{Pass JSON string or filename plus parameters to mdtranslator translate}
27
- long_desc <<-LONGDESC
28
- 'mdtranslator translate' provides command line access to the ADIWG metadata translator
29
- with options to select the input file reader, select writer output format, show empty tags
30
- in XML outputs, and choose level of validation for JSON inputs.
31
- LONGDESC
32
- # define cli options
33
- method_option :reader, :aliases => '-r', :desc => 'Name of reader to read your input', :default => 'adiwgJson'
34
- method_option :writer, :aliases => '-w', :desc => 'Name of writer to create your metadata, or leave blank to validate input only'
35
- method_option :validate, :aliases => '-v', :desc => 'Specify level of validation to be performed', :enum => %w{none normal strict}, :default => 'normal'
36
- method_option :showAllTags, :aliases => '-s', :desc => 'Include tags for unused attributes', :type => :boolean, :default => false
37
- method_option :messages, :aliases => '-m', :desc => 'On error return messages as formatted text or json object', :enum => %w{json text}, :default => 'text'
38
- method_option :returnObject, :aliases => '-o', :desc => 'Return full JSON object generated by translator', :type => :boolean, :default => false
39
-
40
- # accept command and options
41
- def translate(file)
42
-
43
- # test to see if file parameter is a local file
44
- # if not ... it is assumed to be a json string
45
- if File.exist?(file)
46
- # read file
47
- my_file = File.open(file, 'r')
48
- fileObj = my_file.read
49
- my_file.close
50
- else
51
- fileObj = file
52
- end
53
-
54
- # for testing parameters
55
- # puts 'reader: ' + options[:reader]
56
- # puts 'writer: ' + options[:writer]
57
- # puts 'validation level: ' + options[:validate]
58
- # puts 'showAllTags: ' + options[:showAllTags].to_s
59
- # puts 'message format: ' + options[:messages]
60
- # puts 'return object format: ' + options[:returnObject]
61
- # require 'pp'
62
- # pp fileObj
63
-
64
- # call mdtranslator
65
- mdReturn = ADIWG::Mdtranslator.translate(fileObj, options[:reader], options[:writer],
66
- options[:validate], options[:showAllTags])
67
-
68
- # determine return content and type of return ...
69
- if mdReturn[:readerStructurePass] && mdReturn[:readerValidationPass]
70
-
71
- # no problem was found with the input file
72
- if options[:writer].nil?
73
- # if no writer was specified the input was being validated only,
74
- # ...no writer output will have been generated,
75
- # ...and the return will be a string unless json was requested
76
- if options[:messages] == 'json'
77
- $stdout.write mdReturn.to_json
78
- return
79
- else
80
- $stdout.write 'Success'
81
- return
82
- end
83
- else
84
- # a writer was specified,
85
- # output is expected from the translator's writer
86
- if mdReturn[:writerPass]
87
- # writer output was generated
88
- # ...return the writer output in its native format unless json was requested
89
- if options[:returnObject]
90
- $stdout.write mdReturn.to_json
91
- return
92
- else
93
- $stdout.write mdReturn[:writerOutput].to_s
94
- return
95
- end
96
- else
97
- # the writer failed or generated warnings to be reported
98
- # ...return the messages as a string unless json was requested
99
- if options[:messages] == 'json'
100
- $stdout.write mdReturn.to_json
101
- return
102
- else
103
- # build a string with messages issues from parser and validator
104
- s = ''
105
- s += "Failed\n"
106
- s += "Writer failed to generate output or issued significant warnings\n"
107
- s += "See following messages for further information\n"
108
-
109
- # post structure messages
110
- i = 0
111
- mdReturn[:writerMessages].each do |message|
112
- i += 1
113
- s += "\nMessage: #{i}\n"
114
- s += message + "\n"
115
- end
116
-
117
- $stdout.write s
118
- return
119
-
120
- end
121
- end
122
- end
123
-
124
- else
125
-
126
- # problems were found with the input file
127
-
128
- # if no writer was specified the input was being validated only,
129
- # ...no writer output will have been generated,
130
- # ...and return is always expected to be a string
131
- if options[:messages] == 'json'
132
- $stdout.write mdReturn.to_json
133
- return
134
- else
135
- # build a string with messages issues from parser and validator
136
- s = ''
137
- s += "Failed\n"
138
- s += "Input failed to pass either file structure validation or content does not match schema\n"
139
- s += "See following messages for further information\n"
140
-
141
- # post structure messages
142
- if mdReturn[:readerStructurePass]
143
- s += "Success - Input structure is valid\n"
144
- else
145
- s += "Fail - Structure of input file is invalid - see following message(s):\n"
146
- i = 0
147
- mdReturn[:readerStructureMessages].each do |message|
148
- i += 1
149
- s += "\nMessage: #{i}\n"
150
- s += message.to_s + "\n"
151
- end
152
- end
153
-
154
- # post validator messages
155
- unless mdReturn[:readerValidationPass].nil?
156
- if mdReturn[:readerValidationPass]
157
- s += "Success - Input content passes schema definition\n"
158
- else
159
- s += "Fail - Input content did not pass schema validation - see following message(s):\n"
160
- i = 0
161
- mdReturn[:readerValidationMessages].each do |message|
162
- i += 1
163
- s += "\nMessage: #{i}\n"
164
- s += message.to_s + "\n"
165
- end
166
- end
167
- end
168
-
169
- $stdout.write s
170
- return
171
-
172
- end
173
- end
174
-
175
- end
176
-
177
- desc 'version', %q{Returns the version of mdTranslator}
178
- long_desc <<-LONGDESC
179
- 'mdtranslator version' returns the version number for mdTranslator
180
- LONGDESC
181
- def version
182
- $stdout.write ADIWG::Mdtranslator::VERSION
183
- end
184
-
185
- Mdtranslator.start(ARGV)
186
-
187
- end