Class: Homebrew::DevCmd::Contributions Private
- Inherits:
-
AbstractCommand
- Object
- AbstractCommand
- Homebrew::DevCmd::Contributions
- Defined in:
- sorbet/rbi/dsl/homebrew/dev_cmd/contributions.rbi,
dev-cmd/contributions.rb
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
DO NOT EDIT MANUALLY
This is an autogenerated file for dynamic methods in Homebrew::DevCmd::Contributions
.
Please instead update this file by running bin/tapioca dsl Homebrew::DevCmd::Contributions
.
Defined Under Namespace
Classes: Args
Constant Summary collapse
- PRIMARY_REPOS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
%w[brew core cask].freeze
- SUPPORTED_REPOS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
[ PRIMARY_REPOS, OFFICIAL_CMD_TAPS.keys.map { |t| t.delete_prefix("homebrew/") }, OFFICIAL_CASK_TAPS.reject { |t| t == "cask" }, ].flatten.freeze
- MAX_REPO_COMMITS =
This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.
1000
Instance Method Summary collapse
- #args ⇒ Homebrew::DevCmd::Contributions::Args private
- #run ⇒ void private
Methods inherited from AbstractCommand
command, command_name, dev_cmd?, #initialize, parser
Constructor Details
This class inherits a constructor from Homebrew::AbstractCommand
Instance Method Details
#args ⇒ Homebrew::DevCmd::Contributions::Args
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
9 |
# File 'sorbet/rbi/dsl/homebrew/dev_cmd/contributions.rbi', line 9 def args; end |
#run ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'dev-cmd/contributions.rb', line 46 def run results = {} grand_totals = {} repos = if args.repositories.blank? || T.must(args.repositories).include?("primary") PRIMARY_REPOS elsif T.must(args.repositories).include?("all") SUPPORTED_REPOS else args.repositories end from = args.from.presence || Date.today.prev_year.iso8601 contribution_types = [:author, :committer, :coauthorship, :review] users = args.user.presence || GitHub.members_by_team("Homebrew", "maintainers").keys users.each do |username| # TODO: Using the GitHub username to scan the `git log` undercounts some # contributions as people might not always have configured their Git # committer details to match the ones on GitHub. # TODO: Switch to using the GitHub APIs instead of `git log` if # they ever support trailers. results[username] = scan_repositories(repos, username, from:) grand_totals[username] = total(results[username]) contributions = contribution_types.filter_map do |type| type_count = grand_totals[username][type] next if type_count.to_i.zero? "#{Utils.pluralize("time", type_count, include_count: true)} (#{type})" end contributions << "#{Utils.pluralize("time", grand_totals[username].values.sum, include_count: true)} (total)" puts [ "#{username} contributed", *contributions.to_sentence, "#{time_period(from:, to: args.to)}.", ].join(" ") end return unless args.csv? puts puts generate_csv(grand_totals) end |