Module: GitHub

Includes:
Contracts
Defined in:
lib/git-ready/github.rb

Class Method Summary collapse

Class Method Details

.apiObject



22
23
24
# File 'lib/git-ready/github.rb', line 22

def self.api
  @api ||= Octokit::Client.new access_token: Settings.github_access_token, auto_paginate: true
end

.fork_all(organization) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/git-ready/github.rb', line 10

def self.fork_all(organization)
  repositories = %w(public, private).flat_map do |type|
    api.org_repos(organization, type: type)
  end
  progress = ProgressBar.new repositories.length
  repositories.flat_map do |repository|
    progress.increment!
    { upstream: repository, origin: api.fork(repository[:full_name]) }
  end
end