bin/mdtranslator in adiwg-mdtranslator-0.9.0 vs bin/mdtranslator in adiwg-mdtranslator-0.10.2
- old
+ new
@@ -24,11 +24,11 @@
'mdtranslator translate' provides command line access to the ADIWG metadata translator
with options to select the input file reader, select writer output format, show empty tags
in XML outputs, and choose level of validation for JSON inputs.
LONGDESC
# define cli options
- method_option :reader, :aliases => '-r', :desc => 'Name of reader to read your input', :default => 'adiwgJson'
+ method_option :reader, :aliases => '-r', :desc => 'Name of reader to read your input', :default => 'mdJson'
method_option :writer, :aliases => '-w', :desc => 'Name of writer to create your metadata, or leave blank to validate input only'
method_option :validate, :aliases => '-v', :desc => 'Specify level of validation to be performed', :enum => %w{none normal strict}, :default => 'normal'
method_option :showAllTags, :aliases => '-s', :desc => 'Include tags for unused attributes', :type => :boolean, :default => false
method_option :messages, :aliases => '-m', :desc => 'On error return messages as formatted text or json object', :enum => %w{json text}, :default => 'text'
method_option :returnObject, :aliases => '-o', :desc => 'Return full JSON object generated by translator', :type => :boolean, :default => false
@@ -58,34 +58,34 @@
if options[:writer].nil?
# if no writer was specified the input was being validated only,
# ...no writer output will have been generated,
# ...and the return will be a string unless json was requested
if options[:messages] == 'json'
- $stdout.write mdReturn.to_json
+ $stdout.puts mdReturn.to_json
return
else
- $stdout.write 'Success'
+ $stdout.puts 'Success'
return
end
else
# a writer was specified,
# output is expected from the translator's writer
if mdReturn[:writerPass]
# writer output was generated
# ...return the writer output in its native format unless json was requested
if options[:returnObject]
- $stdout.write mdReturn.to_json
+ $stdout.puts mdReturn.to_json
return
else
- $stdout.write mdReturn[:writerOutput].to_s
+ $stdout.puts mdReturn[:writerOutput].to_s
return
end
else
# the writer failed or generated warnings to be reported
# ...return the messages as a string unless json was requested
if options[:messages] == 'json'
- $stdout.write mdReturn.to_json
+ $stdout.puts mdReturn.to_json
return
else
# build a string with messages issues from parser and validator
s = ''
s += "Failed\n"
@@ -98,11 +98,11 @@
i += 1
s += "\nMessage: #{i}\n"
s += message + "\n"
end
- $stdout.write s
+ $stdout.puts s
return
end
end
end
@@ -113,11 +113,11 @@
# if no writer was specified the input was being validated only,
# ...no writer output will have been generated,
# ...and return is always expected to be a string
if options[:messages] == 'json'
- $stdout.write mdReturn.to_json
+ $stdout.puts mdReturn.to_json
return
else
# build a string with messages issues from parser and validator
s = ''
s += "Failed\n"
@@ -150,11 +150,11 @@
s += message.to_s + "\n"
end
end
end
- $stdout.write s
+ $stdout.puts s
return
end
end
@@ -163,10 +163,10 @@
desc 'version', %q{Returns the version of mdTranslator}
long_desc <<-LONGDESC
'mdtranslator version' returns the version number for mdTranslator
LONGDESC
def version
- $stdout.write ADIWG::Mdtranslator::VERSION
+ $stdout.puts ADIWG::Mdtranslator::VERSION
end
Mdtranslator.start(ARGV)
end