aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/tab.rb
diff options
context:
space:
mode:
authorJack Nagel2015-03-13 00:41:10 -0400
committerJack Nagel2015-03-14 21:14:37 -0400
commit838eb29bcf4672cf7e6832d3e3cd9cd0ef1356ff (patch)
treeb6b83eecf7f0541c06dca5f08cb5f2e45133ec63 /Library/Homebrew/tab.rb
parent7c63fecb7450dbf19c81e5c37a984d7d029a75eb (diff)
downloadhomebrew-838eb29bcf4672cf7e6832d3e3cd9cd0ef1356ff.tar.bz2
Switch to a more useful serialization of tap info
Closes #37383.
Diffstat (limited to 'Library/Homebrew/tab.rb')
-rw-r--r--Library/Homebrew/tab.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb
index dcd8c2762..90bf5b7b8 100644
--- a/Library/Homebrew/tab.rb
+++ b/Library/Homebrew/tab.rb
@@ -17,13 +17,13 @@ class Tab < OpenStruct
"tabfile" => formula.prefix.join(FILENAME),
"built_as_bottle" => 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,
+ "tap" => formula.tap,
},
}
@@ -33,6 +33,13 @@ class Tab < OpenStruct
def self.from_file path
attributes = Utils::JSON.load(File.read(path))
attributes["tabfile"] = path
+ attributes["source"] ||= {}
+
+ tapped_from = attributes["tapped_from"]
+ unless tapped_from.nil? || tapped_from == "path or URL"
+ attributes["source"]["tap"] = attributes.delete("tapped_from")
+ end
+
new(attributes)
end
@@ -86,7 +93,7 @@ class Tab < OpenStruct
else
tab = empty
tab.unused_options = f.options.as_flags
- tab.source = { "path" => f.path.to_s }
+ tab.source = { "path" => f.path.to_s, "tap" => f.tap }
end
tab
@@ -98,13 +105,13 @@ class Tab < OpenStruct
"unused_options" => [],
"built_as_bottle" => false,
"poured_from_bottle" => false,
- "tapped_from" => "",
"time" => nil,
"HEAD" => nil,
"stdlib" => nil,
"compiler" => "clang",
"source" => {
"path" => nil,
+ "tap" => nil,
},
}
@@ -159,18 +166,21 @@ class Tab < OpenStruct
built_as_bottle
end
+ def tap
+ source["tap"]
+ end
+
def to_json
attributes = {
"used_options" => used_options.as_flags,
"unused_options" => unused_options.as_flags,
"built_as_bottle" => built_as_bottle,
"poured_from_bottle" => poured_from_bottle,
- "tapped_from" => tapped_from,
"time" => time,
"HEAD" => self.HEAD,
"stdlib" => (stdlib.to_s if stdlib),
"compiler" => (compiler.to_s if compiler),
- "source" => source || {},
+ "source" => source,
}
Utils::JSON.dump(attributes)