2018-01-08 16:11:47 +00:00
|
|
|
#: * `aspell-dictionaries`:
|
2017-12-04 16:10:32 +00:00
|
|
|
#: Generates the new dictionaries for the `aspell` formula.
|
|
|
|
|
|
|
|
require "open-uri"
|
|
|
|
require "resource"
|
|
|
|
require "formula"
|
|
|
|
|
2017-12-05 08:58:27 +00:00
|
|
|
dict_url = "https://ftp.gnu.org/gnu/aspell/dict"
|
|
|
|
dict_mirror = "https://ftpmirror.gnu.org/aspell/dict"
|
|
|
|
|
2017-12-04 16:10:32 +00:00
|
|
|
languages = {}
|
|
|
|
|
2018-03-06 09:30:21 +00:00
|
|
|
URI.parse("#{dict_url}/0index.html").open do |content|
|
2017-12-04 16:10:32 +00:00
|
|
|
content.each_line do |line|
|
2019-10-15 07:59:36 +00:00
|
|
|
break if %r{^</table}.match?(line)
|
|
|
|
next unless /^<tr><td><a/.match?(line)
|
2017-12-04 16:10:32 +00:00
|
|
|
|
|
|
|
fields = line.split('"')
|
|
|
|
lang = fields[1]
|
|
|
|
path = fields[3]
|
|
|
|
lang.tr!("-", "_")
|
|
|
|
languages[lang] = path
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2019-06-15 16:26:33 +00:00
|
|
|
resources = languages.map do |lang, path|
|
2017-12-04 16:10:32 +00:00
|
|
|
r = Resource.new(lang)
|
|
|
|
r.owner = Formulary.factory("aspell")
|
|
|
|
r.url "#{dict_url}/#{path}"
|
|
|
|
r.mirror "#{dict_mirror}/#{path}"
|
2019-06-15 16:26:33 +00:00
|
|
|
r
|
|
|
|
end
|
|
|
|
|
2019-10-15 07:59:36 +00:00
|
|
|
resources.each { |r| r.fetch(verify_download_integrity: false) }
|
2019-06-15 16:26:33 +00:00
|
|
|
|
|
|
|
resources.each do |r|
|
2017-12-04 16:10:32 +00:00
|
|
|
puts <<-EOS
|
|
|
|
resource "#{r.name}" do
|
|
|
|
url "#{r.url}"
|
|
|
|
mirror "#{r.mirrors.first}"
|
|
|
|
sha256 "#{r.cached_download.sha256}"
|
|
|
|
end
|
|
|
|
|
|
|
|
EOS
|
|
|
|
end
|