mirror of
https://github.com/Homebrew/brew.git
synced 2025-07-14 16:09:03 +08:00
Port Homebrew::Cmd::Migrate
This commit is contained in:
parent
59adde2069
commit
0cb608a80c
@ -1,14 +1,14 @@
|
||||
# typed: true
|
||||
# typed: strict
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "abstract_command"
|
||||
require "migrator"
|
||||
require "cli/parser"
|
||||
require "cask/migrator"
|
||||
|
||||
module Homebrew
|
||||
sig { returns(CLI::Parser) }
|
||||
def self.migrate_args
|
||||
Homebrew::CLI::Parser.new do
|
||||
module Cmd
|
||||
class Migrate < AbstractCommand
|
||||
cmd_args do
|
||||
description <<~EOS
|
||||
Migrate renamed packages to new names, where <formula> are old names of
|
||||
packages.
|
||||
@ -27,11 +27,9 @@ module Homebrew
|
||||
|
||||
named_args [:installed_formula, :installed_cask], min: 1
|
||||
end
|
||||
end
|
||||
|
||||
def self.migrate
|
||||
args = migrate_args.parse
|
||||
|
||||
sig { override.void }
|
||||
def run
|
||||
args.named.to_formulae_and_casks(warn: false).each do |formula_or_cask|
|
||||
case formula_or_cask
|
||||
when Formula
|
||||
@ -42,3 +40,5 @@ module Homebrew
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1,8 +1,9 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require "cmd/migrate"
|
||||
require "cmd/shared_examples/args_parse"
|
||||
|
||||
RSpec.describe "brew migrate" do
|
||||
RSpec.describe Homebrew::Cmd::Migrate do
|
||||
it_behaves_like "parseable arguments"
|
||||
|
||||
it "migrates a renamed Formula", :integration_test do
|
||||
|
Loading…
x
Reference in New Issue
Block a user