downloader.rb: enable cache files

* tool/downloader.rb (Downloader::Unicode.download): enable cache
  files when index.html has not been modified since the previous
  download, even if beta version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2019-04-17 07:35:29 +00:00
Родитель c576f14039
Коммит ffbcf9f842
1 изменённых файлов: 3 добавлений и 1 удалений

Просмотреть файл

@ -81,15 +81,17 @@ class Downloader
if INDEX.size == 0
index_options = options.dup
index_options[:cache_save] = false # TODO: make sure caching really doesn't work for index file
index_data = File.read(under(dir, "index.html")) rescue nil
index_file = super(UNICODE_PUBLIC+name_dir_part, "#{name_dir_part}index.html", dir, true, index_options)
INDEX[:index] = File.read(index_file)
since = true unless INDEX[:index] == index_data
end
file_base = File.basename(name, '.txt')
return if file_base == '.' # Use pre-generated headers and tables
beta_name = INDEX[:index][/#{Regexp.quote(file_base)}(-[0-9.]+d\d+)?\.txt/]
# make sure we always check for new versions of files,
# because they can easily change in the beta period
super(UNICODE_PUBLIC+name_dir_part+beta_name, name, dir, true, options)
super(UNICODE_PUBLIC+name_dir_part+beta_name, name, dir, since, options)
else
index_file = Pathname.new(under(dir, name_dir_part+'index.html'))
if index_file.exist?