Skip to content

Commit

Permalink
Merge pull request #16566 from dduugg/fix-update-sponsors
Browse files Browse the repository at this point in the history
Add SystemCommand::Mixin to all commands using system_command
  • Loading branch information
Bo98 authored Feb 1, 2024
2 parents f5068ab + 8156c5d commit 190563c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
11 changes: 6 additions & 5 deletions Library/Homebrew/cmd/list.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@
require "formula"
require "cli/parser"
require "cask/list"
require "system_command"

module Homebrew
module_function
extend SystemCommand::Mixin

sig { returns(CLI::Parser) }
def list_args
def self.list_args
Homebrew::CLI::Parser.new do
description <<~EOS
List all installed formulae and casks.
Expand Down Expand Up @@ -64,7 +65,7 @@ def list_args
end
end

def list
def self.list
args = list_args.parse

if args.full_name?
Expand Down Expand Up @@ -121,7 +122,7 @@ def list
end
end

def filtered_list(args:)
def self.filtered_list(args:)
names = if args.no_named?
Formula.racks
else
Expand Down Expand Up @@ -150,7 +151,7 @@ def filtered_list(args:)
end
end

def list_casks(args:)
def self.list_casks(args:)
casks = if args.no_named?
Cask::Caskroom.casks
else
Expand Down
1 change: 1 addition & 0 deletions Library/Homebrew/dev-cmd/bump-unversioned-casks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
require "cask/installer"
require "cask/cask_loader"
require "cli/parser"
require "system_command"
require "tap"
require "unversioned_cask_checker"

Expand Down
7 changes: 4 additions & 3 deletions Library/Homebrew/dev-cmd/generate-man-completions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
require "formula"
require "completions"
require "manpages"
require "system_command"

module Homebrew
module_function
extend SystemCommand::Mixin

sig { returns(CLI::Parser) }
def generate_man_completions_args
def self.generate_man_completions_args
Homebrew::CLI::Parser.new do
description <<~EOS
Generate Homebrew's manpages and shell completions.
Expand All @@ -18,7 +19,7 @@ def generate_man_completions_args
end
end

def generate_man_completions
def self.generate_man_completions
args = generate_man_completions_args.parse

Commands.rebuild_internal_commands_completion_list
Expand Down
8 changes: 3 additions & 5 deletions Library/Homebrew/dev-cmd/update-license-data.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
require "system_command"

module Homebrew
include SystemCommand::Mixin

module_function
extend SystemCommand::Mixin

sig { returns(CLI::Parser) }
def update_license_data_args
def self.update_license_data_args
Homebrew::CLI::Parser.new do
description <<~EOS
Update SPDX license data in the Homebrew repository.
Expand All @@ -20,7 +18,7 @@ def update_license_data_args
end
end

def update_license_data
def self.update_license_data
update_license_data_args.parse

SPDX.download_latest_license_data!
Expand Down
7 changes: 4 additions & 3 deletions Library/Homebrew/dev-cmd/update-maintainers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
require "cli/parser"
require "utils/github"
require "manpages"
require "system_command"

module Homebrew
module_function
extend SystemCommand::Mixin

sig { returns(CLI::Parser) }
def update_maintainers_args
def self.update_maintainers_args
Homebrew::CLI::Parser.new do
description <<~EOS
Update the list of maintainers in the `Homebrew/brew` README.
Expand All @@ -19,7 +20,7 @@ def update_maintainers_args
end
end

def update_maintainers
def self.update_maintainers
update_maintainers_args.parse

# We assume that only public members wish to be included in the README
Expand Down
13 changes: 7 additions & 6 deletions Library/Homebrew/dev-cmd/update-sponsors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,16 @@

require "cli/parser"
require "utils/github"
require "system_command"

module Homebrew
module_function
extend SystemCommand::Mixin

NAMED_MONTHLY_AMOUNT = 100
URL_MONTHLY_AMOUNT = 1000

sig { returns(CLI::Parser) }
def update_sponsors_args
def self.update_sponsors_args
Homebrew::CLI::Parser.new do
description <<~EOS
Update the list of GitHub Sponsors in the `Homebrew/brew` README.
Expand All @@ -21,19 +22,19 @@ def update_sponsors_args
end
end

def sponsor_name(sponsor)
def self.sponsor_name(sponsor)
sponsor[:name] || sponsor[:login]
end

def sponsor_logo(sponsor)
def self.sponsor_logo(sponsor)
"https://github.com/#{sponsor[:login]}.png?size=64"
end

def sponsor_url(sponsor)
def self.sponsor_url(sponsor)
"https://github.com/#{sponsor[:login]}"
end

def update_sponsors
def self.update_sponsors
update_sponsors_args.parse

named_sponsors = []
Expand Down

0 comments on commit 190563c

Please sign in to comment.