Sha256: d2e28a388c2d5de1d5aee0d8ff5c7649ad4c2c3718b243cf55767b2afcf9fd04
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
require "organization_audit/version" module OrganizationAudit autoload :Repo, 'organization_audit/repo' class << self def all(options={}) ignore = (options[:ignore] || []) unless options[:token] options = options.dup token = `git config github.token`.strip options[:token] = token unless token.empty? end Repo.all(options).reject do |repo| matches_ignore?(ignore, repo) or (options[:ignore_public] and repo.public?) end end def optparse(parser, options) parser.on("--user USER", "Use this github user") { |user| options[:user] = user } parser.on("--organization ORGANIZATION", "Use this github organization") { |organization| options[:organization] = organization } parser.on("--token TOKEN", "Use this github token") { |token| options[:token] = token } parser.on("--ignore REPO", "Ignore given repo name or url or name /regexp/ (use multiple times)") { |repo_name| options[:ignore] << repo_name } parser.on("--ignore-public", "Ignore public repos") { options[:ignore_public] = true } end private def matches_ignore?(ignore, repo) ignore_regexp = ignore.select { |i| i =~ /^\/.*\/$/ }.map { |i| Regexp.new(i[1..-2]) } ignore.include?(repo.url) or ignore.include?(repo.name) or ignore_regexp.any? { |i| i =~ repo.name } end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
organization_audit-1.0.5 | lib/organization_audit.rb |
organization_audit-1.0.4 | lib/organization_audit.rb |