Path: | README.rdoc |
Last Update: | 2010-01-12 12:07:54 +0300 |
by: Arvicco url: http://github.com/arvicco/git_hub
git_hub is a library that wraps github API and exposes simple interface for finding, creating and managing github repositories and other resources.
This project is quite new, so it’s probably not ready for prime time just yet... Contributors always welcome!
require 'git_hub' include GitHub
Find existing repos:
repo = Repo.find(:user=>user_name, :repo=>repo_name) repos = Repo.find(:user=>user_name) search_repos = Repo.find(:query=>['search','terms'])
Retrieve tags, branches and commits for a repo:
puts repo.tags['v0.1.0'].committer puts repo.branches['master'].committed_date repo.commits.each {|commit| p commit.author}
Retrieve info for a specific commit:
commits = Commit.find(:user=>user_name, :repo=>repo_name, :branch=>'master') commits = Commit.find(:user=>user_name, :repo=>repo_name, :branch=>'master', :path=>'README.rdoc') commit = Commit.find(:user=>user_name, :repo=>repo_name, :sha=>'commit_sha') # or, if repo is already retrieved: commit = repo.commits.last commit = repo.tags['v0.1.0'] commit = repo.branches['master'] # returns most recent commit for a branch
Create new repo or delete existing repo (need to authenticate with your github credentials first)
Api.auth = {:user=>user_name, :token=>token} new_repo = Repo.create(:name=>repo_name, :desc=>'Description', :homepage=>'http://your_page.org', :private=> false) new_repo.delete
$ sudo gem install git_hub
(The MIT License)
Copyright © 2009 Arvicco
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.