Last active
August 29, 2015 14:08
-
-
Save AbeHandler/4e284e3305b04fd755a8 to your computer and use it in GitHub Desktop.
osd check
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
osd = false | |
# Check for all dependencies, and note their absence. | |
dirs = ENV['PATH'].split(File::PATH_SEPARATOR) | |
DEPENDENCIES.each_key do |dep| | |
dirs.each do |dir| | |
if File.executable?(File.join(dir, dep.to_s)) | |
DEPENDENCIES[dep] = true | |
if dep.to_s == 'tesseract' #if the tesseract dependency is found | |
val = %x[ #{'tesseract --list-langs'} 2>&1 >/dev/null ] #check for the osd plugin. | |
if val =~ /\bosd\b/ #osd will be listed in tesseract --listlangs | |
osd = true | |
end | |
end | |
break | |
end | |
end | |
end | |
DEPENDENCIES[:osd] = osd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment