diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 135a5dcfc7..2415b843b2 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -11,16 +11,23 @@ class Tab < OpenStruct FILENAME = 'INSTALL_RECEIPT.json' def self.create(formula, compiler, stdlib, build) - Tab.new :used_options => build.used_options.as_flags, - :unused_options => build.unused_options.as_flags, - :tabfile => formula.prefix.join(FILENAME), - :built_as_bottle => !!ARGV.build_bottle?, - :poured_from_bottle => false, - :tapped_from => formula.tap, - :time => Time.now.to_i, - :HEAD => Homebrew.git_head, - :compiler => compiler, - :stdlib => stdlib + attributes = { + :used_options => build.used_options.as_flags, + :unused_options => build.unused_options.as_flags, + :tabfile => formula.prefix.join(FILENAME), + :built_as_bottle => !!ARGV.build_bottle?, + :poured_from_bottle => false, + :tapped_from => formula.tap, + :time => Time.now.to_i, + :HEAD => Homebrew.git_head, + :compiler => compiler, + :stdlib => stdlib, + :source => { + :path => formula.path.to_s, + }, + } + + new(attributes) end def self.from_file path @@ -83,15 +90,22 @@ class Tab < OpenStruct end def self.dummy_tab f=nil - Tab.new :used_options => [], - :unused_options => (f.options.as_flags rescue []), - :built_as_bottle => false, - :poured_from_bottle => false, - :tapped_from => "", - :time => nil, - :HEAD => nil, - :stdlib => nil, - :compiler => :clang + attributes = { + :used_options => [], + :unused_options => (f.options.as_flags rescue []), + :built_as_bottle => false, + :poured_from_bottle => false, + :tapped_from => "", + :time => nil, + :HEAD => nil, + :stdlib => nil, + :compiler => :clang, + :source => { + :path => nil, + }, + } + + new(attributes) end def with? val @@ -139,7 +153,7 @@ class Tab < OpenStruct end def to_json - Utils::JSON.dump({ + attributes = { :used_options => used_options.as_flags, :unused_options => unused_options.as_flags, :built_as_bottle => built_as_bottle, @@ -148,7 +162,11 @@ class Tab < OpenStruct :time => time, :HEAD => self.HEAD, :stdlib => (stdlib.to_s if stdlib), - :compiler => (compiler.to_s if compiler)}) + :compiler => (compiler.to_s if compiler), + :source => source || {}, + } + + Utils::JSON.dump(attributes) end def write diff --git a/Library/Homebrew/test/test_tab.rb b/Library/Homebrew/test/test_tab.rb index bb4ea9198d..ea38be87b0 100644 --- a/Library/Homebrew/test/test_tab.rb +++ b/Library/Homebrew/test/test_tab.rb @@ -17,6 +17,7 @@ class TabTests < Homebrew::TestCase :HEAD => TEST_SHA1, :compiler => "clang", :stdlib => "libcxx", + :source => { :path => nil }, }) end