aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/extend/pathname.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/Library/Homebrew/extend/pathname.rb b/Library/Homebrew/extend/pathname.rb
index ee8d8c9f4..1cbe50f86 100644
--- a/Library/Homebrew/extend/pathname.rb
+++ b/Library/Homebrew/extend/pathname.rb
@@ -197,7 +197,16 @@ class Pathname
def version
require 'version'
- Version.parse(self)
+ if BOTTLE_EXTNAME_RX === to_s
+ begin
+ receipt = Utils.popen_read("tar", "-tzf", to_s, "*/*/INSTALL_RECEIPT.json").chomp
+ Version.new(receipt.split("/", 3)[1])
+ rescue
+ Version.parse(self)
+ end
+ else
+ Version.parse(self)
+ end
end
def compression_type