Port Homebrew::DevCmd::UpdatePythonResources
This commit is contained in:
parent
46d758d5cf
commit
7bef4b010c
@ -1,28 +1,27 @@
|
|||||||
# 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"
|
||||||
require "manpages"
|
require "manpages"
|
||||||
require "system_command"
|
require "system_command"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
extend SystemCommand::Mixin
|
module DevCmd
|
||||||
|
class UpdateMaintainers < AbstractCommand
|
||||||
|
include SystemCommand::Mixin
|
||||||
|
|
||||||
sig { returns(CLI::Parser) }
|
cmd_args do
|
||||||
def self.update_maintainers_args
|
|
||||||
Homebrew::CLI::Parser.new do
|
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Update the list of maintainers in the `Homebrew/brew` README.
|
Update the list of maintainers in the `Homebrew/brew` README.
|
||||||
EOS
|
EOS
|
||||||
|
|
||||||
named_args :none
|
named_args :none
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def self.update_maintainers
|
|
||||||
update_maintainers_args.parse
|
|
||||||
|
|
||||||
|
sig { override.void }
|
||||||
|
def run
|
||||||
# We assume that only public members wish to be included in the README
|
# We assume that only public members wish to be included in the README
|
||||||
public_members = GitHub.public_member_usernames("Homebrew")
|
public_members = GitHub.public_member_usernames("Homebrew")
|
||||||
maintainers = GitHub.members_by_team("Homebrew", "maintainers")
|
maintainers = GitHub.members_by_team("Homebrew", "maintainers")
|
||||||
@ -65,4 +64,6 @@ module Homebrew
|
|||||||
puts "List of maintainers updated in the README and the generated man pages."
|
puts "List of maintainers updated in the README and the generated man pages."
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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/pypi"
|
require "utils/pypi"
|
||||||
|
|
||||||
module Homebrew
|
module Homebrew
|
||||||
module_function
|
module DevCmd
|
||||||
|
class UpdatePythonResources < AbstractCommand
|
||||||
sig { returns(CLI::Parser) }
|
cmd_args do
|
||||||
def update_python_resources_args
|
|
||||||
Homebrew::CLI::Parser.new do
|
|
||||||
description <<~EOS
|
description <<~EOS
|
||||||
Update versions for PyPI resource blocks in <formula>.
|
Update versions for PyPI resource blocks in <formula>.
|
||||||
EOS
|
EOS
|
||||||
@ -34,11 +33,9 @@ module Homebrew
|
|||||||
|
|
||||||
named_args :formula, min: 1, without_api: true
|
named_args :formula, min: 1, without_api: true
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
def update_python_resources
|
|
||||||
args = update_python_resources_args.parse
|
|
||||||
|
|
||||||
|
sig { override.void }
|
||||||
|
def run
|
||||||
args.named.to_formulae.each do |formula|
|
args.named.to_formulae.each do |formula|
|
||||||
PyPI.update_python_resources! formula,
|
PyPI.update_python_resources! formula,
|
||||||
version: args.version,
|
version: args.version,
|
||||||
@ -52,4 +49,6 @@ module Homebrew
|
|||||||
ignore_non_pypi_packages: args.ignore_non_pypi_packages?
|
ignore_non_pypi_packages: args.ignore_non_pypi_packages?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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/update-maintainers"
|
||||||
|
|
||||||
RSpec.describe "brew update-maintainers" do
|
RSpec.describe Homebrew::DevCmd::UpdateMaintainers do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
end
|
end
|
||||||
|
|||||||
@ -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/update-python-resources"
|
||||||
|
|
||||||
RSpec.describe "brew update-python-resources" do
|
RSpec.describe Homebrew::DevCmd::UpdatePythonResources do
|
||||||
it_behaves_like "parseable arguments"
|
it_behaves_like "parseable arguments"
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user