Merge pull request #10249 from hyuraku/cmd/info_refactor-github_info

cmd/info: refactor-github_info
This commit is contained in:
Mike McQuaid 2021-01-08 09:45:25 +00:00 committed by GitHub
commit 7176870ef9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -215,20 +215,14 @@ module Homebrew
end
def github_info(f)
if f.tap
if remote = f.tap.remote
path = if f.class.superclass == Formula
f.path.relative_path_from(f.tap.path)
elsif f.is_a?(Cask::Cask)
f.sourcefile_path.relative_path_from(f.tap.path)
end
github_remote_path(remote, path)
else
f.path
end
else
f.path
return f.path if f.tap.blank? || f.tap.remote.blank?
path = if f.class.superclass == Formula
f.path.relative_path_from(f.tap.path)
elsif f.is_a?(Cask::Cask)
f.sourcefile_path.relative_path_from(f.tap.path)
end
github_remote_path(f.tap.remote, path)
end
def info_formula(f, args:)