From aeccba8dbedb18d5fa28a453435825e766da4979 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 6 Jul 2014 22:46:00 -0500 Subject: [PATCH] Fix brew-aspell-dictionaries --- .../cmd/brew-aspell-dictionaries.rb | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Library/Contributions/cmd/brew-aspell-dictionaries.rb b/Library/Contributions/cmd/brew-aspell-dictionaries.rb index 4816f72394..2a5f8ccb58 100755 --- a/Library/Contributions/cmd/brew-aspell-dictionaries.rb +++ b/Library/Contributions/cmd/brew-aspell-dictionaries.rb @@ -4,8 +4,7 @@ require 'formula' dict_url = "http://ftpmirror.gnu.org/aspell/dict" dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict" - -resources = {} +languages = {} open("#{dict_url}/0index.html") do |content| content.each_line do |line| @@ -15,22 +14,23 @@ open("#{dict_url}/0index.html") do |content| fields = line.split('"') lang, path = fields[1], fields[3] lang.gsub!("-", "_") - resources[lang] = path + languages[lang] = path end end -resources.each_pair do |lang, path| - r = Resource.new(lang, "#{dict_url}/#{path}") - r.owner = Formula.factory('aspell') - - nostdout { r.fetch } - +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 '#{lang}' do - url '#{dict_url}/#{path}' - mirror '#{dict_mirror}/#{path}' - sha1 '#{r.cached_download.sha1}' - end + resource "#{r.name}" do + url "#{r.url}" + mirror "#{r.mirrors.first}" + sha1 "#{r.cached_download.sha1}" + end -EOS + EOS end