| 8 | | :name => 'tdiary-contrib', |
| 9 | | :root => File.expand_path(File.dirname(__FILE__)), |
| 10 | | :include_dirs => %w[doc filter lib misc plugin spec test util].map{|d| File.join d, '**', '*' }, |
| 11 | | :binary_ext => %w[swf].map{|ext| ".#{ext}" }, |
| | 8 | :name => 'tdiary-contrib', |
| | 9 | :root => File.expand_path(File.dirname(__FILE__)), |
| | 10 | :include_dirs => %w[doc filter lib misc plugin spec test util].map{|d| File.join d, '**', '*' }, |
| | 11 | :binary_ext => %w[swf].map{|ext| ".#{ext}" }, |
| 44 | | require 'shell' |
| 45 | | t.prerequisites.each do |f| |
| 46 | | filename = File.join pkg.package_dir_path, f |
| 47 | | # exclude directories and binary files |
| 48 | | next if File.ftype(filename) != 'file' || |
| 49 | | package[:binary_ext].include?(File.extname(filename)) |
| 50 | | |
| 51 | | case |
| 52 | | when Shell.new.find_system_command('nkf') |
| 53 | | sh "nkf -O --euc #{filename} #{filename}.tmp && " << |
| 54 | | "touch -m -r #{filename} #{filename}.tmp && " << |
| 55 | | "mv #{filename}.tmp #{filename}" |
| 56 | | when Shell.new.find_system_command('iconv') |
| 57 | | # use iconv instead of nkf in the following another way... |
| 58 | | sh <<-EOS |
| 59 | | iconv --from-code=utf-8 --to-code=euc-jp --output #{filename}{.tmp,} && \ |
| 60 | | touch -m -r #{filename}{,.tmp} && \ |
| 61 | | mv #{filename}{.tmp,} |
| 62 | | EOS |
| 63 | | #else |
| 64 | | # ... or require 'nkf', 'iconv' |
| 65 | | end |
| 66 | | end |
| 67 | | touch t.name |
| | 44 | require 'shell' |
| | 45 | t.prerequisites.each do |f| |
| | 46 | filename = File.join pkg.package_dir_path, f |
| | 47 | # exclude directories and binary files |
| | 48 | next if File.ftype(filename) != 'file' || |
| | 49 | package[:binary_ext].include?(File.extname(filename)) |
| | 50 | |
| | 51 | case |
| | 52 | when Shell.new.find_system_command('nkf') |
| | 53 | sh "nkf -O --euc #{filename} #{filename}.tmp && " << |
| | 54 | "touch -m -r #{filename} #{filename}.tmp && " << |
| | 55 | "mv #{filename}.tmp #{filename}" |
| | 56 | when Shell.new.find_system_command('iconv') |
| | 57 | # use iconv instead of nkf in the following another way... |
| | 58 | sh <<-EOS |
| | 59 | iconv --from-code=utf-8 --to-code=euc-jp --output #{filename}{.tmp,} && \ |
| | 60 | touch -m -r #{filename}{,.tmp} && \ |
| | 61 | mv #{filename}{.tmp,} |
| | 62 | EOS |
| | 63 | #else |
| | 64 | # ... or require 'nkf', 'iconv' |
| | 65 | end |
| | 66 | end |
| | 67 | touch t.name |