Merge pull request #7061 from EricFromCanada/tap-info-json
tap-info: include cask tokens and all commands in JSON output
This commit is contained in:
commit
29f847e3ab
@ -1,5 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "commands"
|
||||
require "extend/cachable"
|
||||
require "readall"
|
||||
require "description_cache_store"
|
||||
@ -419,7 +420,12 @@ class Tap
|
||||
|
||||
# An array of all {Formula} names of this {Tap}.
|
||||
def formula_names
|
||||
@formula_names ||= formula_files.map { |f| formula_file_to_name(f) }
|
||||
@formula_names ||= formula_files.map(&method(:formula_file_to_name))
|
||||
end
|
||||
|
||||
# An array of all {Cask} tokens of this {Tap}.
|
||||
def cask_tokens
|
||||
@cask_tokens ||= cask_files.map(&method(:formula_file_to_name))
|
||||
end
|
||||
|
||||
# path to the directory of all alias files for this {Tap}.
|
||||
@ -469,17 +475,10 @@ class Tap
|
||||
@command_dir ||= path/"cmd"
|
||||
end
|
||||
|
||||
def command_file?(file)
|
||||
file = Pathname.new(file) unless file.is_a? Pathname
|
||||
file = file.expand_path(path)
|
||||
file.parent == command_dir && file.basename.to_s.match?(/^brew(cask)?-/) &&
|
||||
(file.executable? || file.extname == ".rb")
|
||||
end
|
||||
|
||||
# An array of all commands files of this {Tap}.
|
||||
def command_files
|
||||
@command_files ||= if command_dir.directory?
|
||||
command_dir.children.select(&method(:command_file?))
|
||||
Commands.find_commands(command_dir)
|
||||
else
|
||||
[]
|
||||
end
|
||||
@ -528,8 +527,9 @@ class Tap
|
||||
"official" => official?,
|
||||
"formula_names" => formula_names,
|
||||
"formula_files" => formula_files.map(&:to_s),
|
||||
"command_files" => command_files.map(&:to_s),
|
||||
"cask_tokens" => cask_tokens,
|
||||
"cask_files" => cask_files.map(&:to_s),
|
||||
"command_files" => command_files.map(&:to_s),
|
||||
"pinned" => pinned?,
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user