1 #ライセンスのjsonファイルを作るサポートツール
\r
4 puts "ls_helper.rb ls.yml [work dir=current dir]"
\r
5 puts "generate to ls.json"
\r
14 lg = YAML.load(open(filename).read)
\r
15 fn = File.basename filename, ".*"
\r
16 wd = ARGV[1] ? File.expand_path(ARGV[1]) : File.dirname(filename)
\r
17 o = wd + '/' + fn + '.json'
\r
21 g['licenses_attributes'].each do |lk, l|
\r
23 puts 'follow license_group_module_name' + g['module_name']
\r
24 l['license_group_module_name'] = g['module_name']
\r
25 if l['license_group_settings']
\r
26 puts 'license_group_settings to json'
\r
28 if l['system_picture_file']
\r
29 fn = File.expand_path(wd + '/' + l['system_picture_file'])
\r
30 puts 'open system picture file ' + fn
\r
31 d = File.open(fn, 'rb').read
\r
32 b = Base64.encode64(d).gsub(/\r/, '').gsub(/\n/, '')
\r
33 l['system_picture_id'] = {"text" => b}
\r
34 l.delete 'system_picture_file'
\r
36 if l['credit_picture_settings']
\r
37 credit_picture_settings = {}
\r
38 l['credit_picture_settings'].each do |n, v|
\r
39 fn = File.expand_path(wd + '/' + v)
\r
40 puts 'open system picture file ' + fn
\r
41 d = File.open(fn, 'rb').read
\r
42 b = Base64.encode64(d).gsub(/\r/, '').gsub(/\n/, '')
\r
43 credit_picture_settings[n] = {"text" => b}
\r
45 l['credit_picture_settings'] = credit_picture_settings
\r
49 puts "generating " + o
\r
50 File.open(o, 'wb') do |f|
\r
51 f.write lg.to_json.to_s
\r