Skip to content

Commit

Permalink
Added update-zonetab target
Browse files Browse the repository at this point in the history
  • Loading branch information
nobu committed Nov 1, 2019
1 parent ae14e5f commit 9bc6e30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 4 additions & 0 deletions ext/date/prereq.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,7 @@
> $(@F)

zonetab.h: zonetab.list

.PHONY: update-zonetab
update-zonetab:
$(RUBY) -C $(srcdir) update-abbr.rb
5 changes: 3 additions & 2 deletions bin/update-abbr → ext/date/update-abbr
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- mode: ruby -*-
require 'nokogiri'
require 'open-uri'

Expand All @@ -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)

0 comments on commit 9bc6e30

Please sign in to comment.