From 9966943a34b32afdd4224a196ff1bbd7e0b7a134 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Wed, 30 Oct 2013 00:43:10 -0500 Subject: [PATCH] Resource: extract unpacking from #stage Closes Homebrew/homebrew#23768. --- Library/Homebrew/resource.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Library/Homebrew/resource.rb b/Library/Homebrew/resource.rb index 8fd9dc7b3f..8b3ce4c335 100644 --- a/Library/Homebrew/resource.rb +++ b/Library/Homebrew/resource.rb @@ -43,12 +43,16 @@ class Resource downloader.cached_location end - # Download the resource + # Fetch, verify, and unpack the resource + def stage(target=nil, &block) + verify_download_integrity(fetch) + unpack(target, &block) + end + # If a target is given, unpack there; else unpack to a temp folder # If block is given, yield to that block # A target or a block must be given, but not both - def stage(target=nil) - verify_download_integrity(fetch) + def unpack(target=nil) mktemp(download_name) do downloader.stage if block_given?