diff options
| author | Mike McQuaid | 2014-09-20 14:33:59 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2014-09-24 15:22:51 -0700 |
| commit | 5be03060eab6faa37dd9345d38befaff60919d2b (patch) | |
| tree | 1f2aceef06dbbab058eb4a5b1cec8e75246d00d9 /Library | |
| parent | 3fc691d4e5fa6ea568643b89b28346ef9303346b (diff) | |
| download | homebrew-5be03060eab6faa37dd9345d38befaff60919d2b.tar.bz2 | |
brew-aspell-dictionaries: make a developer command
Diffstat (limited to 'Library')
| -rwxr-xr-x | Library/Contributions/cmd/brew-aspell-dictionaries.rb | 36 | ||||
| -rwxr-xr-x | Library/Homebrew/cmd/aspell-dictionaries.rb | 40 |
2 files changed, 40 insertions, 36 deletions
diff --git a/Library/Contributions/cmd/brew-aspell-dictionaries.rb b/Library/Contributions/cmd/brew-aspell-dictionaries.rb deleted file mode 100755 index 2a5f8ccb5..000000000 --- a/Library/Contributions/cmd/brew-aspell-dictionaries.rb +++ /dev/null @@ -1,36 +0,0 @@ -require 'open-uri' -require 'resource' -require 'formula' - -dict_url = "http://ftpmirror.gnu.org/aspell/dict" -dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict" -languages = {} - -open("#{dict_url}/0index.html") do |content| - content.each_line do |line| - break if %r{^</table} === line - next unless /^<tr><td><a/ === line - - fields = line.split('"') - lang, path = fields[1], fields[3] - lang.gsub!("-", "_") - languages[lang] = path - end -end - -languages.inject([]) do |resources, (lang, path)| - r = Resource.new(lang) - r.owner = Formulary.factory("aspell") - r.url "#{dict_url}/#{path}" - r.mirror "#{dict_mirror}/#{path}" - resources << r -end.each(&:fetch).each do |r| - puts <<-EOS - resource "#{r.name}" do - url "#{r.url}" - mirror "#{r.mirrors.first}" - sha1 "#{r.cached_download.sha1}" - end - - EOS -end diff --git a/Library/Homebrew/cmd/aspell-dictionaries.rb b/Library/Homebrew/cmd/aspell-dictionaries.rb new file mode 100755 index 000000000..82f25fec7 --- /dev/null +++ b/Library/Homebrew/cmd/aspell-dictionaries.rb @@ -0,0 +1,40 @@ +require 'open-uri' +require 'resource' +require 'formula' + +module Homebrew + def aspell_dictionaries + dict_url = "http://ftpmirror.gnu.org/aspell/dict" + dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict" + languages = {} + + open("#{dict_url}/0index.html") do |content| + content.each_line do |line| + break if %r{^</table} === line + next unless /^<tr><td><a/ === line + + fields = line.split('"') + lang, path = fields[1], fields[3] + lang.gsub!("-", "_") + languages[lang] = path + end + end + + languages.inject([]) do |resources, (lang, path)| + r = Resource.new(lang) + r.owner = Formulary.factory("aspell") + r.url "#{dict_url}/#{path}" + r.mirror "#{dict_mirror}/#{path}" + resources << r + end.each(&:fetch).each do |r| + puts <<-EOS + resource "#{r.name}" do + url "#{r.url}" + mirror "#{r.mirrors.first}" + sha1 "#{r.cached_download.sha1}" + end + + EOS + end + end +end |
