Skip to content

Instantly share code, notes, and snippets.

@AbeHandler
Last active August 29, 2015 14:08
Show Gist options
  • Save AbeHandler/4e284e3305b04fd755a8 to your computer and use it in GitHub Desktop.
Save AbeHandler/4e284e3305b04fd755a8 to your computer and use it in GitHub Desktop.
osd check
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