Show
Ignore:
Timestamp:
01/22/08 00:59:56 (5 years ago)
Author:
walf443
Message:

platform/tdiary: check whether nkf is command exist in Rakefile to_euc task

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • platform/tdiary/Rakefile

    r5188 r5197  
    4949task :to_euc => pkg.package_dir_path 
    5050file pkg.package_dir_path do |t| 
     51  require 'shell' 
    5152  t.prerequisites.each do |f| 
    5253    filename = File.join(pkg.package_dir_path, f) 
     
    5455    next if File.ftype(filename) != 'file' || 
    5556            package[:binary_ext].include?(File.extname(filename)) 
    56     sh "nkf -O --euc #{filename} #{filename}.tmp && " << 
    57        "touch -m -r #{filename} #{filename}.tmp && " << 
    58        "mv #{filename}.tmp #{filename}" 
    59     # use iconv instead of nkf in the following another way... 
    60     # sh "iconv --from-code=utf-8 --to-code=eucjp-ms --output #{filename}{.tmp,} && " << 
    61     #    "touch -m -r #{filename}{,.tmp} && " << 
    62     #    "mv #{filename}{.tmp,}" 
     57 
     58    if Shell.new.find_system_command('nkf') 
     59      sh "nkf -O --euc #{filename} #{filename}.tmp && " << 
     60         "touch -m -r #{filename} #{filename}.tmp && " << 
     61         "mv #{filename}.tmp #{filename}" 
     62    else 
     63      # use iconv instead of nkf in the following another way... 
     64      sh "iconv --from-code=utf-8 --to-code=eucjp-ms --output #{filename}{.tmp,} && " << 
     65         "touch -m -r #{filename}{,.tmp} && " << 
     66         "mv #{filename}{.tmp,}" 
     67    end 
    6368  end 
    6469  touch t.name