Skip temporary directory when target directory is known
This commit is contained in:
		
							parent
							
								
									612230a705
								
							
						
					
					
						commit
						5ca4dbfd25
					
				@ -85,13 +85,13 @@ class Resource
 | 
			
		||||
  # If block is given, yield to that block
 | 
			
		||||
  # A target or a block must be given, but not both
 | 
			
		||||
  def unpack(target=nil)
 | 
			
		||||
    mktemp(download_name) do
 | 
			
		||||
      downloader.stage
 | 
			
		||||
      if block_given?
 | 
			
		||||
    if target
 | 
			
		||||
      mkdir_p(target)
 | 
			
		||||
      chdir(target) { downloader.stage }
 | 
			
		||||
    elsif block_given?
 | 
			
		||||
      mktemp(download_name) do
 | 
			
		||||
        downloader.stage
 | 
			
		||||
        yield self
 | 
			
		||||
      elsif target
 | 
			
		||||
        target = Pathname.new(target) unless target.is_a? Pathname
 | 
			
		||||
        target.install Dir['*']
 | 
			
		||||
      end
 | 
			
		||||
    end
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user