Sha256: f648cfbd0c637dfa4c4a83d9b28c2e191736f832f0e543fabd29d211a1046948

Contents?: true

Size: 658 Bytes

Versions: 3

Compression:

Stored size: 658 Bytes

Contents

require 'contracts'
require 'octokit'
require 'progress_bar'
require_relative 'settings'

module GitHub
  include Contracts

  Contract String => ArrayOf[({ upstream: Sawyer::Resource, origin: Sawyer::Resource })]
  def self.fork_all(organization)
    repositories = api.org_repos organization
    progress = ProgressBar.new repositories.length
    repositories.flat_map do |repository|
      progress.increment!
      { upstream: repository, origin: api.fork(repository[:full_name]) }
    end
  end

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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
git-ready-0.8.15 lib/git-ready/github.rb
git-ready-0.8.14 lib/git-ready/github.rb
git-ready-0.8.13 lib/git-ready/github.rb