Fix brew-aspell-dictionaries
This commit is contained in:
parent
3952a4acc6
commit
aeccba8dbe
@ -4,8 +4,7 @@ require 'formula'
|
|||||||
|
|
||||||
dict_url = "http://ftpmirror.gnu.org/aspell/dict"
|
dict_url = "http://ftpmirror.gnu.org/aspell/dict"
|
||||||
dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict"
|
dict_mirror = "http://ftp.gnu.org/gnu/aspell/dict"
|
||||||
|
languages = {}
|
||||||
resources = {}
|
|
||||||
|
|
||||||
open("#{dict_url}/0index.html") do |content|
|
open("#{dict_url}/0index.html") do |content|
|
||||||
content.each_line do |line|
|
content.each_line do |line|
|
||||||
@ -15,22 +14,23 @@ open("#{dict_url}/0index.html") do |content|
|
|||||||
fields = line.split('"')
|
fields = line.split('"')
|
||||||
lang, path = fields[1], fields[3]
|
lang, path = fields[1], fields[3]
|
||||||
lang.gsub!("-", "_")
|
lang.gsub!("-", "_")
|
||||||
resources[lang] = path
|
languages[lang] = path
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
resources.each_pair do |lang, path|
|
languages.inject([]) do |resources, (lang, path)|
|
||||||
r = Resource.new(lang, "#{dict_url}/#{path}")
|
r = Resource.new(lang)
|
||||||
r.owner = Formula.factory('aspell')
|
r.owner = Formulary.factory("aspell")
|
||||||
|
r.url "#{dict_url}/#{path}"
|
||||||
nostdout { r.fetch }
|
r.mirror "#{dict_mirror}/#{path}"
|
||||||
|
resources << r
|
||||||
|
end.each(&:fetch).each do |r|
|
||||||
puts <<-EOS
|
puts <<-EOS
|
||||||
resource '#{lang}' do
|
resource "#{r.name}" do
|
||||||
url '#{dict_url}/#{path}'
|
url "#{r.url}"
|
||||||
mirror '#{dict_mirror}/#{path}'
|
mirror "#{r.mirrors.first}"
|
||||||
sha1 '#{r.cached_download.sha1}'
|
sha1 "#{r.cached_download.sha1}"
|
||||||
end
|
end
|
||||||
|
|
||||||
EOS
|
EOS
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user