Skip to content

Commit

Permalink
Rename contributors:update task to contributors
Browse files Browse the repository at this point in the history
Since we no longer keep the yaml file in source control, I think the
`update` part has lost most of its meaning.
  • Loading branch information
deivid-rodriguez committed Jan 15, 2025
1 parent 350e4de commit 25b5237
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
2 changes: 1 addition & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Dir.glob("lib/tasks/**/*.rake").each { |r| load r }

desc "Build the static site"
task build: ["contributors:update", :repo_pages, :man] do
task build: ["contributors", :repo_pages, :man] do
sh "middleman build --clean --verbose"
end

Expand Down
68 changes: 33 additions & 35 deletions lib/tasks/contributors.rake
Original file line number Diff line number Diff line change
@@ -1,39 +1,37 @@
desc "Regenerate file with contributor's information that our team page will display"
namespace :contributors do
task :update do
def small_avatar(url)
connector = url.include?("?") ? "&" : "?"
[url, "s=40"].join(connector)
end

core_team = %w[
colby-swandale
deivid-rodriguez
greysteil
hsbt
indirect
rubymorillo
segiddins
]
credited_elsewhere = core_team + %w[homu bundlerbot]
desc "Generate file with contributor's information that our team page will display"
task :contributors do
def small_avatar(url)
connector = url.include?("?") ? "&" : "?"
[url, "s=40"].join(connector)
end

require "octokit"
require "yaml"
options = { auto_paginate: true }
options[:access_token] = ENV["GITHUB_TOKEN"] if ENV["GITHUB_TOKEN"]
client = Octokit::Client.new(**options)
contributors = client.contributors("rubygems/rubygems", false)
contributors.reject!{|c| credited_elsewhere.include?(c[:login]) }
contributors.map! do |c|
{
avatar_url: small_avatar(c[:avatar_url]),
commits: c[:contributions],
href: c[:html_url],
name: c[:login]
}
end
contributors.sort_by! {|c| [-c[:commits], c[:name].downcase] }
core_team = %w[
colby-swandale
deivid-rodriguez
greysteil
hsbt
indirect
rubymorillo
segiddins
]
credited_elsewhere = core_team + %w[homu bundlerbot]

File.write("data/contributors.yml", YAML.dump(contributors))
require "octokit"
require "yaml"
options = { auto_paginate: true }
options[:access_token] = ENV["GITHUB_TOKEN"] if ENV["GITHUB_TOKEN"]
client = Octokit::Client.new(**options)
contributors = client.contributors("rubygems/rubygems", false)
contributors.reject!{|c| credited_elsewhere.include?(c[:login]) }
contributors.map! do |c|
{
avatar_url: small_avatar(c[:avatar_url]),
commits: c[:contributions],
href: c[:html_url],
name: c[:login]
}
end
contributors.sort_by! {|c| [-c[:commits], c[:name].downcase] }

File.write("data/contributors.yml", YAML.dump(contributors))
end

0 comments on commit 25b5237

Please sign in to comment.