Skip to content
Snippets Groups Projects
Commit 808729e7 authored by Xu Cheng's avatar Xu Cheng
Browse files

Tab: store spec of formula

parent 46d45677
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@ class Tab < OpenStruct
"source" => {
"path" => formula.path.to_s,
"tap" => formula.tap,
"spec" => formula.active_spec_sym.to_s,
},
}
......@@ -44,6 +45,15 @@ class Tab < OpenStruct
attributes["source"]["tap"] = attributes.delete("tapped_from")
end
if attributes["source"]["spec"].nil?
version = PkgVersion.parse path.to_s.split("/")[-2]
if version.head?
attributes["source"]["spec"] = "head"
else
attributes["source"]["spec"] = "stable"
end
end
new(attributes)
end
......@@ -97,7 +107,7 @@ class Tab < OpenStruct
else
tab = empty
tab.unused_options = f.options.as_flags
tab.source = { "path" => f.path.to_s, "tap" => f.tap }
tab.source = { "path" => f.path.to_s, "tap" => f.tap, "spec" => f.active_spec_sym.to_s }
end
tab
......@@ -116,6 +126,7 @@ class Tab < OpenStruct
"source" => {
"path" => nil,
"tap" => nil,
"spec" => nil,
},
}
......@@ -181,6 +192,10 @@ class Tab < OpenStruct
source["tap"] = tap
end
def spec
source["spec"].to_sym
end
def to_json
attributes = {
"used_options" => used_options.as_flags,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment