aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tab.rb
diff options
context:
space:
mode:
authorMax Howell2012-08-10 16:06:51 -0400
committerMax Howell2012-08-29 12:41:33 -0400
commit50767c60773b290eb8d203695852a6a0c21c71e4 (patch)
tree350492373da4f93cc528b93637be57d71d394db0 /Library/Homebrew/tab.rb
parent05991dd846ac54b10cd78453b140de8bfb259392 (diff)
downloadbrew-50767c60773b290eb8d203695852a6a0c21c71e4.tar.bz2
Record HEAD SHA and date of installs in receipt
Diffstat (limited to 'Library/Homebrew/tab.rb')
-rw-r--r--Library/Homebrew/tab.rb19
1 files changed, 13 insertions, 6 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index e28ce1eda..15f2911d9 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -9,17 +9,19 @@ require 'vendor/multi_json'
# `Tab.for_install`.
class Tab < OpenStruct
def self.for_install f, args
+ sha = `cd '#{HOMEBREW_REPOSITORY}' && git rev-parse --verify -q HEAD 2>/dev/null`.chuzzle
Tab.new :used_options => args.used_options(f),
:unused_options => args.unused_options(f),
:tabfile => f.prefix + "INSTALL_RECEIPT.json",
:built_as_bottle => !!args.build_bottle?,
- :tapped_from => f.tap
+ :tapped_from => f.tap,
+ :time => Time.now.to_i, # to_s would be better but Ruby has no from_s function :P
+ :HEAD => sha
end
def self.from_file path
tab = Tab.new MultiJson.decode(open(path).read)
tab.tabfile = path
-
return tab
end
@@ -35,7 +37,9 @@ class Tab < OpenStruct
Tab.new :used_options => [],
:unused_options => [],
:built_as_bottle => false,
- :tapped_from => ""
+ :tapped_from => "",
+ :time => nil,
+ :HEAD => nil
end
end
end
@@ -63,7 +67,9 @@ class Tab < OpenStruct
Tab.new :used_options => [],
:unused_options => f.build.as_flags,
:built_as_bottle => false,
- :tapped_from => ""
+ :tapped_from => "",
+ :time => nil,
+ :HEAD => nil
end
def installed_with? opt
@@ -79,8 +85,9 @@ class Tab < OpenStruct
:used_options => used_options,
:unused_options => unused_options,
:built_as_bottle => built_as_bottle,
- :tapped_from => tapped_from
- })
+ :tapped_from => tapped_from,
+ :time => time,
+ :HEAD => send("HEAD")})
end
def write