Sha256: aea8a35f1a2463b49872efef91976a301baea938d36b290ae4e05201906f16e7

Contents?: true

Size: 1008 Bytes

Versions: 7

Compression:

Stored size: 1008 Bytes

Contents

require 'rubygems'
require 'os'
success = true

# MPlayer OSX Extended instead of smplayer... ?
module CheckInstalledMac
 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

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

  raise 'unknown ' + name unless command # double check

  unless system(command + " 1> " + OS.dev_null + " 2>" + OS.dev_null)
     name = 'ImageMagick' if name == 'convert' # special case...
     puts 'lacking dependency! Please install ' + name + ' by running $ sudo port install ' + name
     false
  else
    true
  end

 end
end

if $0 == __FILE__
  for name in ['gocr', 'convert', 'mplayer', 'ffmpeg'] do
    if CheckInstalledMac.check_for_installed name
      puts 'has dep:' + name
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
sensible-cinema-0.23.6 lib/check_installed_mac.rb
sensible-cinema-0.23.5 lib/check_installed_mac.rb
sensible-cinema-0.23.4 lib/check_installed_mac.rb
sensible-cinema-0.23.3 lib/check_installed_mac.rb
sensible-cinema-0.23.2 lib/check_installed_mac.rb
sensible-cinema-0.23.1 lib/check_installed_mac.rb
sensible-cinema-0.23.0 lib/check_installed_mac.rb