Allow passing individual casks to bump-unversioned-casks for debugging.
This commit is contained in:
parent
05b496194a
commit
1c2a31e224
@ -129,13 +129,21 @@ module Homebrew
|
|||||||
# Keep existing paths and try to convert others to tap, formula or cask paths.
|
# Keep existing paths and try to convert others to tap, formula or cask paths.
|
||||||
# If a cask and formula with the same name exist, includes both their paths
|
# If a cask and formula with the same name exist, includes both their paths
|
||||||
# unless `only` is specified.
|
# unless `only` is specified.
|
||||||
def to_paths(only: nil)
|
sig { params(only: T.nilable(Symbol), recurse_tap: T::Boolean).returns(T::Array[Pathname]) }
|
||||||
|
def to_paths(only: nil, recurse_tap: false)
|
||||||
@to_paths ||= {}
|
@to_paths ||= {}
|
||||||
@to_paths[only] ||= downcased_unique_named.flat_map do |name|
|
@to_paths[only] ||= downcased_unique_named.flat_map do |name|
|
||||||
if File.exist?(name)
|
if File.exist?(name)
|
||||||
Pathname(name)
|
Pathname(name)
|
||||||
elsif name.count("/") == 1 && !name.start_with?("./", "/")
|
elsif name.count("/") == 1 && !name.start_with?("./", "/")
|
||||||
Tap.fetch(name).path
|
tap = Tap.fetch(name)
|
||||||
|
|
||||||
|
if recurse_tap
|
||||||
|
next tap.formula_files if only == :formula
|
||||||
|
next tap.cask_files if only == :cask
|
||||||
|
end
|
||||||
|
|
||||||
|
tap.path
|
||||||
else
|
else
|
||||||
next Formulary.path(name) if only == :formula
|
next Formulary.path(name) if only == :formula
|
||||||
next Cask::CaskLoader.path(name) if only == :cask
|
next Cask::CaskLoader.path(name) if only == :cask
|
||||||
|
|||||||
@ -17,7 +17,7 @@ module Homebrew
|
|||||||
def self.bump_unversioned_casks_args
|
def self.bump_unversioned_casks_args
|
||||||
Homebrew::CLI::Parser.new do
|
Homebrew::CLI::Parser.new do
|
||||||
usage_banner <<~EOS
|
usage_banner <<~EOS
|
||||||
`bump-unversioned-casks` [<options>] [<tap>]
|
`bump-unversioned-casks` [<options>] [<cask>|<tap>]
|
||||||
|
|
||||||
Check all casks with unversioned URLs in a given <tap> for updates.
|
Check all casks with unversioned URLs in a given <tap> for updates.
|
||||||
EOS
|
EOS
|
||||||
@ -28,7 +28,7 @@ module Homebrew
|
|||||||
flag "--state-file=",
|
flag "--state-file=",
|
||||||
description: "File for caching state."
|
description: "File for caching state."
|
||||||
|
|
||||||
named 1
|
min_named 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -43,11 +43,10 @@ module Homebrew
|
|||||||
end
|
end
|
||||||
state_file.dirname.mkpath
|
state_file.dirname.mkpath
|
||||||
|
|
||||||
tap = Tap.fetch(args.named.first)
|
|
||||||
|
|
||||||
state = state_file.exist? ? JSON.parse(state_file.read) : {}
|
state = state_file.exist? ? JSON.parse(state_file.read) : {}
|
||||||
|
|
||||||
cask_files = tap.cask_files
|
cask_files = args.named.to_paths(only: :cask, recurse_tap: true)
|
||||||
|
|
||||||
unversioned_cask_files = cask_files.select do |cask_file|
|
unversioned_cask_files = cask_files.select do |cask_file|
|
||||||
url = cask_file.each_line do |line|
|
url = cask_file.each_line do |line|
|
||||||
url = line[/\s*url\s+"([^"]+)"\s*/, 1]
|
url = line[/\s*url\s+"([^"]+)"\s*/, 1]
|
||||||
@ -59,7 +58,7 @@ module Homebrew
|
|||||||
|
|
||||||
unversioned_casks = unversioned_cask_files.map { |path| Cask::CaskLoader.load(path) }
|
unversioned_casks = unversioned_cask_files.map { |path| Cask::CaskLoader.load(path) }
|
||||||
|
|
||||||
ohai "Unversioned Casks: #{unversioned_casks.count}"
|
ohai "Unversioned Casks: #{unversioned_casks.count} (#{state.size} cached)"
|
||||||
|
|
||||||
checked, unchecked = unversioned_casks.partition { |c| state.key?(c.full_name) }
|
checked, unchecked = unversioned_casks.partition { |c| state.key?(c.full_name) }
|
||||||
|
|
||||||
|
|||||||
@ -899,7 +899,7 @@ present, "revision 1" will be added.
|
|||||||
* `--message`:
|
* `--message`:
|
||||||
Append *`message`* to the default commit message.
|
Append *`message`* to the default commit message.
|
||||||
|
|
||||||
### `bump-unversioned-casks` [*`options`*] [*`tap`*]
|
### `bump-unversioned-casks` [*`options`*] [*`cask`*|*`tap`*]
|
||||||
|
|
||||||
Check all casks with unversioned URLs in a given *`tap`* for updates.
|
Check all casks with unversioned URLs in a given *`tap`* for updates.
|
||||||
|
|
||||||
|
|||||||
@ -1245,7 +1245,7 @@ Print what would be done rather than doing it\.
|
|||||||
\fB\-\-message\fR
|
\fB\-\-message\fR
|
||||||
Append \fImessage\fR to the default commit message\.
|
Append \fImessage\fR to the default commit message\.
|
||||||
.
|
.
|
||||||
.SS "\fBbump\-unversioned\-casks\fR [\fIoptions\fR] [\fItap\fR]"
|
.SS "\fBbump\-unversioned\-casks\fR [\fIoptions\fR] [\fIcask\fR|\fItap\fR]"
|
||||||
Check all casks with unversioned URLs in a given \fItap\fR for updates\.
|
Check all casks with unversioned URLs in a given \fItap\fR for updates\.
|
||||||
.
|
.
|
||||||
.TP
|
.TP
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user