class Object

Constants

RTc
RTs
VERSION

Public Instance Methods

repo_access() click to toggle source

ToDo: Add pagination handling!

# File bin/missue.rb, line 322
def repo_access
    hLine = "-"*72
    redW = "\e[1;49;31mW\e[0m"      # red W
    yelR = "\e[1;49;33mR\e[0m"      # yel R
    grnR = "\e[1;49;32mR\e[0m"      # grn R
    client = Octokit::Client.new(access_token: ENV['GITHUB_OAUTH_TOKEN'], accept: 'application/vnd.github.v3+json')
    puts "\n" + hLine + "\n Repo Access\n" + hLine
    client.repositories.each do |repository|
        full_name       = repository[:full_name]
        has_push_access = repository[:permissions][:push]
        access_type = has_push_access ? redW : grnR
        puts "  #{access_type}  : #{full_name}"
    end
    
    puts "\n" + hLine + "\n Organizations\n" + hLine
    client.organizations.each do |organization|
        puts "  #{organization[:login]}"
    end
    puts hLine
end
sort_list(ilist) click to toggle source
# File bin/missue.rb, line 316
def sort_list(ilist)
    # "12,3-5,2,6,35-38" --> [2,3,4,5,6,12,35,36,37,38]
    ilist.gsub(/(\d+)-(\d+)/) { ($1..$2).to_a.join(',') }.split(',').map(&:to_i).sort.uniq
end