зеркало из https://github.com/github/ruby.git
Follow emoji data files header change
The header of emoji data files in UCD, which were moved at 13.0.0, has been changed since 14.0.0. It seems to be the same as other files in UCD.
This commit is contained in:
Родитель
6898984f1c
Коммит
76c0056505
|
@ -311,18 +311,19 @@ end
|
|||
def data_foreach(name, &block)
|
||||
fn = get_file(name)
|
||||
warn "Reading #{name}"
|
||||
File.open(fn, 'rb') do |f|
|
||||
if /^emoji/ =~ name
|
||||
sep = ""
|
||||
pat = /^# #{Regexp.quote(File.basename(name))}.*^# Version: ([\d.]+)/m
|
||||
line = f.gets("")
|
||||
# Headers till Emoji 13
|
||||
version = line[/^# #{Regexp.quote(File.basename(name))}.*^# Version: ([\d.]+)/m, 1]
|
||||
type = :Emoji
|
||||
else
|
||||
sep = "\n"
|
||||
pat = /^# #{File.basename(name).sub(/\./, '-([\\d.]+)\\.')}/
|
||||
# Headers since Emoji 14 or other Unicode data
|
||||
line = f.gets("\n")
|
||||
type = :Unicode
|
||||
end
|
||||
File.open(fn, 'rb') do |f|
|
||||
line = f.gets(sep)
|
||||
unless version = line[pat, 1]
|
||||
version ||= line[/^# #{File.basename(name).sub(/\./, '-([\\d.]+)\\.')}/, 1]
|
||||
unless version
|
||||
raise ArgumentError, <<-ERROR
|
||||
#{name}: no #{type} version
|
||||
#{line.gsub(/^/, '> ')}
|
||||
|
@ -330,7 +331,7 @@ def data_foreach(name, &block)
|
|||
end
|
||||
if !(v = $versions[type])
|
||||
$versions[type] = version
|
||||
elsif v != version
|
||||
elsif v != version and "#{v}.0" != version
|
||||
raise ArgumentError, <<-ERROR
|
||||
#{name}: #{type} version mismatch: #{version} to #{v}
|
||||
#{line.gsub(/^/, '> ')}
|
||||
|
|
Загрузка…
Ссылка в новой задаче