Changeset 2555

Show
Ignore:
Timestamp:
02/07/07 21:58:12 (2 years ago)
Author:
uta
Message:

#262

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/archive.rb

    r2099 r2555  
    2222if flag_rubrikcs 
    2323  if File.exists?(rubricks_base) 
    24     base_dir = "#{rubricks_base}/public/javascripts" 
    25     CompressUtil.rubricks_js(base_dir, 'rubricks_common', jar) 
     24    common_dir = "#{rubricks_base}/public/javascripts" 
     25    system_dir = "#{rubricks_base}/public/javascripts/components/system" 
     26    CompressUtil.rubricks_common_js(common_dir, 'rubricks_common', jar) 
     27    CompressUtil.rubricks_system_js(system_dir, jar) 
    2628  else 
    2729    p "Can't find #{spinelz_base}" 
  • tools/compress_util.rb

    r2009 r2555  
    33class CompressUtil 
    44  class << self 
    5     def rubricks_js(base, filename, jar) 
     5    def rubricks_common_js(base, filename, jar) 
    66      begin 
    77        data = '' 
    88        path = "#{base}/#{filename}.js" 
    9         Dir.glob("#{base}/#{filename}_src_*.js").collect do |src_path| 
     9        Dir.glob("#{base}/src_#{filename}_*.js").collect do |src_path| 
    1010          data += `java -jar #{jar} -c #{src_path}` 
    1111        end 
    12         file = File.open(path, 'w') 
    13         file.binmode 
    14         file.print data 
    15         file.close 
     12        CompressUtil.write_js(path, data) 
     13      rescue Exception 
     14        puts $!.to_s 
     15      end 
     16    end 
     17 
     18    def rubricks_system_js(base, jar) 
     19      begin 
     20        Dir.glob("#{base}/src_*.js").collect do |src_path| 
     21          dest_path = src_path.sub(/src_/, '') 
     22          data = `java -jar #{jar} -c #{src_path}` 
     23          CompressUtil.write_js(dest_path, data) 
     24        end 
    1625      rescue Exception 
    1726        puts $!.to_s 
     
    4251          all_data += data 
    4352          CompressUtil.mkdir(dest_path.sub(%r(^(.*)/([^/]+)$), '\1')) 
    44           file = File.open(dest_path, 'w') 
    45           file.binmode 
    46           file.print data 
    47           file.close 
     53          CompressUtil.write_js(dest_path, data) 
    4854        end 
    4955        if make_all 
    50           File.open(all_file, 'w') do |file| 
    51             file.print all_data 
    52           end 
     56          CompressUtil.write_js(all_file, all_data) 
    5357        end 
    5458        data = '' 
     
    5862          data += `java -jar #{jar} -c #{src_path}` 
    5963        end 
    60         file = File.open(dest_path, 'w') 
    61         file.binmode 
    62         file.print data 
    63         file.close 
     64        CompressUtil.write_js(dest_path, data) 
    6465      rescue Exception 
    6566        puts $!.to_s 
     
    9899    end 
    99100 
     101    def write_js(path, data) 
     102      file = File.open(path, 'w') 
     103      file.binmode 
     104      file.print data 
     105      file.close 
     106    end 
     107 
    100108    def mkdir(path) 
    101109      unless File.exist?(path)