hets.rb revision a837d007b255d7a6cca7994e1e555aba95ce41cc
require 'date'
end
# Set hets environment variables for when the wrapper script is not used.
end
end
end
# Checks Hets installation compatibility by its version date
#
# * *Args* :
# * - +minimum_date+ -> Minimum working hets version date
# * *Returns* :
# * - true if hets version minimum date prior or equal to actual hets version date
# * - false otherwise
# Read Hets version minimum date
raise HetsConfigDateFormatError, 'Could not read hets version minimum date in YAML' unless minimum_date
# Read Hets version date
end
raise HetsVersionDateFormatError, 'Could not read hets version date in output of `hets -V`' unless version_date
# Return true if minimum date is prior or equal to version date
return minimum_date <= version_date
end
return path if File.exists? path
end
end
end
# Runs hets with input_file and returns XML output file path.
@@config ||= Config.new
command = "#{@@config.path} -o xml --full-signatures -v2 #{output_path} '#{input_file}' 2>&1"
Rails.logger.debug command
# Executes command with low priority
# Exclude usage message if exit status equals 2
if $?.exitstatus == 2 and output.include? 'Usage:'
end
# Raise error if exit status different from 0
if $?.exitstatus != 0 or output.starts_with? '*** Error'
end
end
# Traverses a directory for ontologies with supported extensions recursively,
# yielding their path.
EXTENSIONS.each do |extension|
end
end
# Traverses a directory recursively, importing ontology file with supported
# extension.
#
# @param user [User] the user that imports the ontology files
# @param dir [String] the path to the ontology library
#
end
# Imports an ontology in demand of a user.
#
# @param user [User] the user that imports the ontology file
# @param file_path [String] the path to the ontology file
# @param extension [String] the extension of the ontology file
#
o = Ontology.new
# TODO Use custom ontology iris detached from the local file system
o.iri = "file://#{path}"
return
end
end
end