-
Notifications
You must be signed in to change notification settings - Fork 2
/
Rakefile
85 lines (64 loc) · 2.62 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
carriers = %w(kddi softbank docomo)
perl='/usr/bin/perl'
# -------------------------------------------------------------------------
# basic
task :default => ['test']
task 'test' => ['dat', 'ucm', 'Makefile'] do
sh 'make test'
end
file 'Makefile' do
sh 'perl Makefile.PL'
end
# -------------------------------------------------------------------------
# dat/
dat_files = [carriers.map{|x| "dat/#{x}-table.yaml"}, carriers.map{|x| "dat/#{x}-table.pl"}, 'dat/convert-map-utf8.yaml', 'dat/convert-map-utf8.yaml'].flatten
task 'dat' => dat_files
file 'dat/docomo-table.yaml' do
sh "#{perl} ./tools/docomo-scrape.pl > dat/docomo-table.yaml"
end
file 'dat/softbank-table.yaml' => ['dat/softbank-unicode2sjis_auto.pl'] do
sh "#{perl} ./tools/softbank-scrape.pl > dat/softbank-table.yaml"
sh "#{perl} ./tools/softbank-scrape-name.pl"
# Update kddi/softbank yaml English names
sh "#{perl} ./tools/add-names-by-mapping.pl dat/softbank-table.yaml"
end
file 'dat/softbank-unicode2sjis_auto.pl'
file 'dat/kddi-table.yaml' => ['typeD.pdf'] do
sh "#{perl} ./tools/kddi-extract.pl typeD.pdf > dat/kddi-table.yaml"
# Update kddi/softbank yaml English names
sh "#{perl} ./tools/add-names-by-mapping.pl dat/kddi-table.yaml"
end
file 'dat/convert-map-utf8.yaml' do
sh "#{perl} tools/convert-map-scrape.pl > dat/convert-map-utf8.yaml"
end
[carriers.map {|x| "dat/#{x}-table.pl"}, 'dat/convert-map-utf8.pl'].flatten.each do |f|
file f => [f.gsub(/\.pl/, '.yaml')] do
sh "#{perl} ./tools/yaml2perl.pl #{f.gsub(/\.pl/, '.yaml')} #{f}"
end
end
# -------------------------------------------------------------------------
# ucm/
encodings = %w(airh docomo kddi-cp932 kddi-auto softbank-auto)
ucm_files = [encodings.map{|x| "ucm/x-sjis-#{x}-raw.ucm" }, carriers.map{|x| "ucm/x-utf8-#{x}.ucm"}].flatten
task :ucm => ucm_files
encodings.each do |carrier|
file "ucm/x-sjis-#{carrier}-raw.ucm" => ['dat/softbank-table.yaml', 'dat/kddi-table.yaml', "tools/make-sjis-ucm.pl", "dat/docomo-table.yaml"] do
sh "#{perl} ./tools/make-sjis-ucm.pl"
end
end
file 'tools/make-sjis-ucm.pl'
carriers.map{|x|"ucm/x-utf8-#{x}.ucm"}.each { |f|
file f => ['dat/convert-map-utf8.yaml'] do
sh "#{perl} ./tools/make-utf8-ucm.pl"
end
}
# -------------------------------------------------------------------------
# carrier pdf
file 'typeD.pdf' do
sh 'wget http://www.au.kddi.com/ezfactory/tec/spec/pdf/typeD.pdf'
end
# -------------------------------------------------------------------------
task :clean do
sh 'rm typeD.pdf' if File.exist?('typeD.pdf')
sh "rm #{ucm_files.join(' ')} #{dat_files.join(' ')}"
end