github-repos
A shard that makes it easy to fetch data about specific repositories.
This module was original made as part of a personal project which is why only a few properties has been added to GitHub::Repo
, however, contributions are very welcome ;).
Installation
-
Add the dependency to your
shard.yml
:dependencies: github-repos: github: henrikac/github-repos
-
Run
shards install
Usage
Keep in mind that "Unauthenticated clients can make 60 requests per hour" 1.
require "github-repos"
repos = GitHub.fetch_repos("henrikac", ["pokeapi", "github-repos", "prettytable"])
if repos.empty?
puts "Didn't find any repositories :'("
else
repos.each { |r| puts r.title }
end
The original purpose of this module was to fetch repository data every 5 minutes. By doing this the data displayed to potential users was always up-to-date.
require "github-repos"
mut = Mutex.new
repos = Array(GitHub::Repo).new
spawn do
loop do
mut.lock
repos = GitHub.fetch_repos("henrikac", ["pokeapi", "github-repos", "prettytable"])
mut.unlock
sleep 5.minutes
end
end
# code ...
Contributing
- Fork it (https://github.com/henrikac/github-repos/fork)
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request
Contributors
- Henrik Christensen - creator and maintainer