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

Changeset 8994

Show
Ignore:
Timestamp:
03/08/08 19:31:50 (4 months ago)
Author:
minam
Message:

allow :copy_exclude to work for both normal and cached copies

Files:

Legend:

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

    r8993 r8994  
    6262                name = File.basename(item) 
    6363                next if name == "." || name == ".." 
    64                 next if copy_exclude.any? { |pattern| pattern.is_a?(Regexp) ? item =~ pattern : File.fnmatch?(pattern, item, File::FNM_DOTMATCH) } 
    6564                if File.directory?(item) 
    6665                  queue += Dir.glob("#{item}/*", File::FNM_DOTMATCH) 
     
    7473            logger.debug "getting (via #{copy_strategy}) revision #{revision} to #{destination}" 
    7574            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)) } 
    7680          end 
    7781 
  • tools/capistrano/test/deploy/strategy/copy_test.rb

    r8993 r8994  
    2525  end 
    2626 
     27  def test_deploy_with_exclusions_should_remove_patterns_from_destination 
     28    @config[:copy_exclude] = ".git" 
     29    Dir.expects(:tmpdir).returns("/temp/dir") 
     30    @source.expects(:checkout).with("154", "/temp/dir/1234567890").returns(:local_checkout) 
     31    @strategy.expects(:system).with(:local_checkout) 
     32 
     33    FileUtils.expects(:rm_rf).with("/temp/dir/1234567890/.git") 
     34    prepare_standard_compress_and_copy! 
     35    @strategy.deploy! 
     36  end 
     37 
    2738  def test_deploy_with_export_should_use_tar_gz_and_export 
    2839    Dir.expects(:tmpdir).returns("/temp/dir") 
     
    190201    FileUtils.expects(:mkdir_p).with("/temp/dir/1234567890") 
    191202 
    192     prepare_directory_tree!("/temp/dir/captest", true) 
    193  
     203    prepare_directory_tree!("/temp/dir/captest") 
     204 
     205    FileUtils.expects(:rm_rf).with("/temp/dir/1234567890/*/bar.txt") 
    194206    prepare_standard_compress_and_copy! 
    195207    @strategy.deploy! 
     
    206218 
    207219      Dir.expects(:glob).with("app/*", File::FNM_DOTMATCH).returns(["app/.", "app/..", "app/bar.txt"]) 
    208       unless exclude 
    209         File.expects(:directory?).with("app/bar.txt").returns(false) 
    210         FileUtils.expects(:ln).with("#{cache}/app/bar.txt", "/temp/dir/1234567890/app/bar.txt") 
    211       end 
     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") 
    212222    end 
    213223