require 'formula' class AspellLang < Formula def install aspell = Formula.factory 'aspell' system "PATH=$PATH:#{aspell.prefix}/bin; ./configure --vars ASPELL=#{aspell.prefix}/bin/aspell PREZIP=#{aspell.prefix}/bin/prezip" system "PATH=$PATH:#{aspell.prefix}/bin; make install" end end class Aspell < Formula url 'http://ftpmirror.gnu.org/aspell/aspell-0.60.6.1.tar.gz' homepage 'http://aspell.net/' md5 'e66a9c9af6a60dc46134fdacf6ce97d7' fails_with_llvm "Segmentation fault during linking.", :build => 2334 def options [ ['--lang=XX,...', "Install dictionary for language XX where XX is the country code, e.g.: --lang=en,es\n\tAvailable country codes: #{available_languages.join(', ')}"], ['--all', "Install all available dictionaries"] ] end def install system "./configure", "--prefix=#{prefix}" system "make install" languages = [] if ARGV.include?('--all') languages << available_languages.to_a else ARGV.options_only.select { |v| v =~ /--lang=/ }.uniq.each do |opt| languages << opt.split('=')[1].split(',') end end languages.flatten.each do |lang| begin formula = Object.const_get("Aspell_" + lang).new rescue opoo "Unknown language: #{lang}" next end formula.brew { formula.install } end end # TODO remove when options works properly def caveats; <<-EOS.undent Dictionaries are not automatically installed, please specify the languages for which you want dictionaries to be installed with the --lang option, e.g: % brew install aspell --lang=en,es For the following languages aspell dictionaries are available: #{available_languages.join(', ')} EOS end end # BEGIN generated with brew-aspell-dictionaries class Aspell_af