require 'formula' class AspellLang < Formula def install aspell = Formula.factory 'aspell' system "./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 'ftp://ftp.gnu.org/gnu/aspell/aspell-0.60.6.tar.gz' homepage 'http://aspell.net/' md5 'bc80f0198773d5c05086522be67334eb' fails_with_llvm "Segmentation fault during linking." 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 - broken_dictionaries.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(', ')} The dictionaries for the following languages seem to be broken: #{broken_dictionaries.join(', ')} EOS end end def broken_dictionaries %w( br cy el fr gv nl tr wa) end # BEGIN generated with brew-aspell-dictionaries class Aspell_af