Skip to content

Instantly share code, notes, and snippets.

@timurvafin
Created January 5, 2012 16:03
Show Gist options
  • Save timurvafin/1565873 to your computer and use it in GitHub Desktop.
Save timurvafin/1565873 to your computer and use it in GitHub Desktop.
source 'http://rubygems.org'
gem 'i18n'
gem 'activesupport', '>= 2.3.5'
gem 'octokit', '~> 0.6.0'
group :development do
gem 'cucumber', '>= 0'
gem 'bundler', '~> 1.0.0'
gem 'jeweler', '~> 1.5.2'
gem 'rcov', '>= 0'
end
require 'rubygems'
require 'bundler/setup'
require 'octokit'
require 'active_support/core_ext'
@username = 'fs'
def client
@client ||= Octokit::Client.new(:login => '', :token => '')
end
def repositories
@repositories ||= client.repositories(@username, :private => true)
end
def expired?(repo, ttl = 12.month)
client.branches(repo).each do |branch|
if DateTime.now.to_i - client.commits(repo, branch.first, :page => 1).first.committed_date.to_datetime.to_i < ttl
return false
end
end
true
end
repositories.each do |repo|
puts repo.name if repo.private? && expired?(repo)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment