Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 9005

Show
Ignore:
Timestamp:
03/10/08 21:08:57 (4 months ago)
Author:
minam
Message:

for cached local copies, do the exclude and the copy in the same step, it is much faster

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • tools/capistrano/lib/capistrano/recipes/deploy/strategy/copy.rb

    r8996 r9005  
    6161                item = queue.shift 
    6262                name = File.basename(item) 
     63 
    6364                next if name == "." || name == ".." 
     65                next if copy_exclude.any? { |pattern| File.fnmatch(pattern, item) } 
     66 
    6467                if File.directory?(item) 
    6568                  queue += Dir.glob("#{item}/*", File::FNM_DOTMATCH) 
     
    7376            logger.debug "getting (via #{copy_strategy}) revision #{revision} to #{destination}" 
    7477            system(command) 
    75           end 
    76  
    77           if copy_exclude.any? 
    78             logger.debug "processing exclusions..." 
    79             copy_exclude.each { |pattern| FileUtils.rm_rf(File.join(destination, pattern)) } 
     78 
     79            if copy_exclude.any? 
     80              logger.debug "processing exclusions..." 
     81              copy_exclude.each { |pattern| FileUtils.rm_rf(File.join(destination, pattern)) } 
     82            end 
    8083          end 
    8184 
  • tools/capistrano/test/deploy/strategy/copy_test.rb

    r8994 r9005  
    201201    FileUtils.expects(:mkdir_p).with("/temp/dir/1234567890") 
    202202 
    203     prepare_directory_tree!("/temp/dir/captest") 
    204  
    205     FileUtils.expects(:rm_rf).with("/temp/dir/1234567890/*/bar.txt") 
     203    prepare_directory_tree!("/temp/dir/captest", true) 
     204 
    206205    prepare_standard_compress_and_copy! 
    207206    @strategy.deploy! 
     
    218217 
    219218      Dir.expects(:glob).with("app/*", File::FNM_DOTMATCH).returns(["app/.", "app/..", "app/bar.txt"]) 
    220       File.expects(:directory?).with("app/bar.txt").returns(false) 
    221       FileUtils.expects(:ln).with("#{cache}/app/bar.txt", "/temp/dir/1234567890/app/bar.txt") 
     219 
     220      unless exclude 
     221        File.expects(:directory?).with("app/bar.txt").returns(false) 
     222        FileUtils.expects(:ln).with("#{cache}/app/bar.txt", "/temp/dir/1234567890/app/bar.txt") 
     223      end 
    222224    end 
    223225