Module: CheckInstalledMac

Defined in:
lib/check_installed_mac.rb

Class Method Summary collapse

Class Method Details

.check_for_installed(name) ⇒ Object

should output an error message…


10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/check_installed_mac.rb', line 10

def self.check_for_installed name
 if name == 'mencoder'
   output = `mencoder --fail 2>&1`
   if output =~ /mencoder/i
     # success, it is installed
     return true
   else
     # fall through
   end
 end

 # check for the others generically

 command = {"gocr" => "gocr --help", "convert" => "convert --help", "ffmpeg" => "ffmpeg -version", "mplayer" => "mplayer"}[name]

 raise 'unknown ' + name unless command # sanity check

 unless system("/opt/rdp_project_local/bin/#{command} 1>/dev/null 2>&1")
    name = 'ImageMagick' if name == 'convert' # special case...
    puts 'lacking dependency! Please install ' + name + ' by installing the contrib pkg from the website'
    false
 else
   true
 end

end