Class: Gitload::Sources::GitHub
- Inherits:
-
Object
- Object
- Gitload::Sources::GitHub
- Includes:
- Source
- Defined in:
- lib/gitload/sources/github.rb
Defined Under Namespace
Classes: Repo
Instance Method Summary collapse
-
#initialize(config, options = {}) ⇒ GitHub
constructor
A new instance of GitHub.
- #repos ⇒ Object
Methods included from Source
Constructor Details
#initialize(config, options = {}) ⇒ GitHub
Returns a new instance of GitHub.
9 10 11 12 13 14 15 16 |
# File 'lib/gitload/sources/github.rb', line 9 def initialize config, = {} @config = config ::Octokit.configure do |c| c.auto_paginate = true c.access_token = .fetch :access_token, ENV['GITLOAD_GITHUB_TOKEN'] end end |
Instance Method Details
#repos ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'lib/gitload/sources/github.rb', line 18 def repos puts 'Loading GitHub projects...' data = @config.load_or_cache_data 'github' do Utils.stringify_keys ::Octokit.repositories.collect(&:to_attrs) end data.collect{ |d| Repo.new d } end |