зеркало из https://github.com/github/ruby.git
[ruby/date] Added update-zonetab target
https://github.com/ruby/date/commit/9bc6e30a82
This commit is contained in:
Родитель
b2126d3fcf
Коммит
6abf4c4802
|
@ -6,3 +6,7 @@
|
|||
> $(@F)
|
||||
|
||||
zonetab.h: zonetab.list
|
||||
|
||||
.PHONY: update-zonetab
|
||||
update-zonetab:
|
||||
$(RUBY) -C $(srcdir) update-abbr.rb
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
# -*- mode: ruby -*-
|
||||
require 'nokogiri'
|
||||
require 'open-uri'
|
||||
|
||||
|
@ -24,11 +25,11 @@ end
|
|||
|
||||
h.delete_if{|_,v| !v}
|
||||
|
||||
lines = File.readlines('ext/date/zonetab.list')
|
||||
lines = File.readlines('zonetab.list')
|
||||
lines.select{|l| l.include?(',')}.
|
||||
map{|l| l.split(',', 2)[0]}.
|
||||
each{|a| h.delete(a)}
|
||||
|
||||
lines.insert(-2, h.sort.map{|k,v| "#{k},#{v}\n"})
|
||||
lines.flatten!
|
||||
File.write('ext/date/zonetab.list', lines.join)
|
||||
File.write('zonetab.list', lines.join)
|
Загрузка…
Ссылка в новой задаче