Port Homebrew::DevCmd::DispatchBuildBottle

This commit is contained in:
Douglas Eichelberger 2024-03-21 08:13:35 -07:00
parent 19f9c52652
commit 21c84553cf
2 changed files with 78 additions and 78 deletions

View File

@ -1,15 +1,14 @@
# typed: true # typed: strict
# frozen_string_literal: true # frozen_string_literal: true
require "abstract_command"
require "cli/parser" require "cli/parser"
require "utils/github" require "utils/github"
module Homebrew module Homebrew
module_function module DevCmd
class DispatchBuildBottle < AbstractCommand
sig { returns(CLI::Parser) } cmd_args do
def dispatch_build_bottle_args
Homebrew::CLI::Parser.new do
description <<~EOS description <<~EOS
Build bottles for these formulae with GitHub Actions. Build bottles for these formulae with GitHub Actions.
EOS EOS
@ -35,11 +34,9 @@ module Homebrew
conflicts "--linux", "--linux-self-hosted" conflicts "--linux", "--linux-self-hosted"
named_args :formula, min: 1 named_args :formula, min: 1
end end
end
def dispatch_build_bottle
args = dispatch_build_bottle_args.parse
sig { override.void }
def run
tap = Tap.fetch(args.tap || CoreTap.instance.name) tap = Tap.fetch(args.tap || CoreTap.instance.name)
user, repo = tap.full_name.split("/") user, repo = tap.full_name.split("/")
ref = "master" ref = "master"
@ -91,4 +88,6 @@ module Homebrew
GitHub.workflow_dispatch_event(user, repo, workflow, ref, **inputs) GitHub.workflow_dispatch_event(user, repo, workflow, ref, **inputs)
end end
end end
end
end
end end

View File

@ -1,7 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
require "cmd/shared_examples/args_parse" require "cmd/shared_examples/args_parse"
require "dev-cmd/dispatch-build-bottle"
RSpec.describe "brew dispatch-build-bottle" do RSpec.describe Homebrew::DevCmd::DispatchBuildBottle do
it_behaves_like "parseable arguments" it_behaves_like "parseable arguments", argv: ["foo"]
end end