Sha256: c02db38033128d295a6a093f15c70f6a2dac34b685725da2ce084bc895734d2f

Contents?: true

Size: 1.61 KB

Versions: 1

Compression:

Stored size: 1.61 KB

Contents

$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'yaml'
require 'json'
require 'logger'
require 'fileutils'
require 'open3'
require 'thor'
require 'octokit'
require 'parallel'
require 'dotenv/load'

Octokit.auto_paginate = true

module GitHubRecordsArchiver
  autoload :DataHelper,    'github_records_archiver/data_helper'
  autoload :Comment,       'github_records_archiver/comment'
  autoload :CLI,           'github_records_archiver/cli'
  autoload :GitRepository, 'github_records_archiver/git_repository'
  autoload :Issue,         'github_records_archiver/issue'
  autoload :Organization,  'github_records_archiver/organization'
  autoload :Repository,    'github_records_archiver/repository'
  autoload :Team,          'github_records_archiver/team'
  autoload :User,          'github_records_archiver/user'
  autoload :VERSION,       'github_records_archiver/version'
  autoload :Wiki,          'github_records_archiver/wiki'

  class << self
    attr_writer :token, :dest_dir, :verbose, :shell, :client

    def token
      @token ||= ENV['GITHUB_TOKEN']
    end

    def client
      @client ||= Octokit::Client.new access_token: token
    end

    def dest_dir
      @dest_dir ||= File.expand_path('./archive', Dir.pwd)
    end

    def verbose
      @verbose ||= false
    end
    alias verbose? verbose

    def shell
      @shell ||= Thor::Base.shell.new
    end

    def verbose_status(status, message, color = :white)
      return unless verbose?
      shell.say_status status, remove_token(message), color
    end

    def remove_token(string)
      string.gsub(GitHubRecordsArchiver.token, '<GITHUB_TOKEN>')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github_records_archiver-0.3.1 lib/github_records_archiver.rb