lib/adiwg/mdtranslator/writers/mdWriters.rb in adiwg-mdtranslator-1.0.0rc1 vs lib/adiwg/mdtranslator/writers/mdWriters.rb in adiwg-mdtranslator-1.0.0rc2

- old
+ new

@@ -1,31 +1,45 @@ # MdTranslator - controller for evaluating and directing writers # History: # Stan Smith 2014-12-11 original script # Stan Smith 2012-12-16 generalized handleWriter to use :writerName +# Stan Smith 2015-03-04 changed method of setting $WriterNS module ADIWG module Mdtranslator module Writers def self.handleWriter(intObj) + # this is a temp fix until the directory structure is changed + if $response[:writerName] == 'iso' + $response[:writerPass] = false + $response[:writerMessages] << 'Writer not called - see following message(s):\n' + $response[:writerMessages] << "Writer name 'iso' is not supported." + return false + end + # use writer name to load and initiate requested writer # build directory path for writer from writerName writerDir = File.join(path_to_resources, $response[:writerName]) if File.directory?(writerDir) + # if directory path exists, build writer file name and then require it writerFile = File.join(writerDir, $response[:writerName] + '_writer') require writerFile + writerClassName = $response[:writerName].clone + writerClassName[0] = writerClassName[0].upcase + $WriterNS = ADIWG::Mdtranslator::Writers.const_get(writerClassName) # pass internal object to requested writer $response[:writerOutput] = $WriterNS.startWriter(intObj) - return $response + else # directory path was not found - $response[:writerValidationPass] = false - $response[:readerValidationMessages] << "Writer name '#{$response[:writerName]}' is not supported." + $response[:writerPass] = false + $response[:writerMessages] << 'Writer not called - see following message(s):\n' + $response[:writerMessages] << "Writer name '#{$response[:writerName]}' is not supported." return false end end