Combine Tab alias_path with source.path
This commit is contained in:
parent
8bbcbfc020
commit
f9e16ee2e0
@ -27,11 +27,10 @@ class Tab < OpenStruct
|
||||
"time" => Time.now.to_i,
|
||||
"source_modified_time" => formula.source_modified_time.to_i,
|
||||
"HEAD" => HOMEBREW_REPOSITORY.git_head,
|
||||
"alias_path" => formula.alias_path.to_s,
|
||||
"compiler" => compiler,
|
||||
"stdlib" => stdlib,
|
||||
"source" => {
|
||||
"path" => formula.path.to_s,
|
||||
"path" => formula.specified_path.to_s,
|
||||
"tap" => formula.tap ? formula.tap.name : nil,
|
||||
"spec" => formula.active_spec_sym.to_s,
|
||||
"versions" => {
|
||||
@ -56,10 +55,6 @@ class Tab < OpenStruct
|
||||
attributes["source_modified_time"] ||= 0
|
||||
attributes["source"] ||= {}
|
||||
|
||||
if alias_path = attributes["alias_path"]
|
||||
attributes["alias_path"] = Pathname.new(alias_path)
|
||||
end
|
||||
|
||||
tapped_from = attributes["tapped_from"]
|
||||
unless tapped_from.nil? || tapped_from == "path or URL"
|
||||
attributes["source"]["tap"] = attributes.delete("tapped_from")
|
||||
@ -142,7 +137,7 @@ class Tab < OpenStruct
|
||||
tab = empty
|
||||
tab.unused_options = f.options.as_flags
|
||||
tab.source = {
|
||||
"path" => f.path.to_s,
|
||||
"path" => f.specified_path.to_s,
|
||||
"tap" => f.tap ? f.tap.name : f.tap,
|
||||
"spec" => f.active_spec_sym.to_s,
|
||||
"versions" => {
|
||||
@ -166,7 +161,6 @@ class Tab < OpenStruct
|
||||
"time" => nil,
|
||||
"source_modified_time" => 0,
|
||||
"HEAD" => nil,
|
||||
"alias_path" => nil,
|
||||
"stdlib" => nil,
|
||||
"compiler" => DevelopmentTools.default_compiler,
|
||||
"source" => {
|
||||
@ -298,7 +292,6 @@ class Tab < OpenStruct
|
||||
"time" => time,
|
||||
"source_modified_time" => source_modified_time.to_i,
|
||||
"HEAD" => self.HEAD,
|
||||
"alias_path" => (alias_path.to_s if alias_path),
|
||||
"stdlib" => (stdlib.to_s if stdlib),
|
||||
"compiler" => (compiler.to_s if compiler),
|
||||
"source" => source
|
||||
|
||||
@ -43,9 +43,9 @@ class TabTests < Homebrew::TestCase
|
||||
assert_nil tab.stable_version
|
||||
assert_nil tab.devel_version
|
||||
assert_nil tab.head_version
|
||||
assert_nil tab.alias_path
|
||||
assert_equal DevelopmentTools.default_compiler, tab.cxxstdlib.compiler
|
||||
assert_nil tab.cxxstdlib.type
|
||||
assert_nil tab.source["path"]
|
||||
end
|
||||
|
||||
def test_include?
|
||||
@ -100,7 +100,7 @@ class TabTests < Homebrew::TestCase
|
||||
def test_from_file
|
||||
path = Pathname.new(TEST_DIRECTORY).join("fixtures", "receipt.json")
|
||||
tab = Tab.from_file(path)
|
||||
alias_path = Pathname.new("/usr/local/Library/Taps/homebrew/homebrew-core/Aliases/test-formula")
|
||||
source_path = "/usr/local/Library/Taps/hombrew/homebrew-core/Formula/foo.rb"
|
||||
|
||||
assert_equal @used.sort, tab.used_options.sort
|
||||
assert_equal @unused.sort, tab.unused_options.sort
|
||||
@ -118,7 +118,7 @@ class TabTests < Homebrew::TestCase
|
||||
assert_equal "2.14", tab.stable_version.to_s
|
||||
assert_equal "2.15", tab.devel_version.to_s
|
||||
assert_equal "HEAD-0000000", tab.head_version.to_s
|
||||
assert_equal alias_path, tab.alias_path
|
||||
assert_equal source_path, tab.source["path"]
|
||||
end
|
||||
|
||||
def test_to_json
|
||||
@ -136,7 +136,7 @@ class TabTests < Homebrew::TestCase
|
||||
assert_equal @tab.stable_version, tab.stable_version
|
||||
assert_equal @tab.devel_version, tab.devel_version
|
||||
assert_equal @tab.head_version, tab.head_version
|
||||
assert_equal @tab.alias_path, tab.alias_path
|
||||
assert_equal @tab.source["path"], tab.source["path"]
|
||||
end
|
||||
|
||||
def test_remap_deprecated_options
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user