root/lang/perl/Encode-JP-Mobile/trunk/Rakefile @ 39137

Revision 6289, 2.6 kB (checked in by tomi-ru, 7 years ago)

small fix for tools/

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