diff options
| author | Xu Cheng | 2015-07-28 15:33:07 +0800 |
|---|---|---|
| committer | Xu Cheng | 2015-07-31 19:44:00 +0800 |
| commit | 808729e7ff685d372193f9adb79f44ea7f6e9adf (patch) | |
| tree | 1df9036b32092d70a7670d547b3968bea0788739 | |
| parent | 46d45677cc06a479c39fc7a59d9077de9d84d842 (diff) | |
| download | brew-808729e7ff685d372193f9adb79f44ea7f6e9adf.tar.bz2 | |
Tab: store spec of formula
| -rw-r--r-- | Library/Homebrew/tab.rb | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/Library/Homebrew/tab.rb b/Library/Homebrew/tab.rb index 37b0db2fd..6e98bb652 100644 --- a/Library/Homebrew/tab.rb +++ b/Library/Homebrew/tab.rb @@ -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, |
