Sha256: 1336d20fb76ce4f46741bbaf439c36b55e4ad10c1a452ce786329426c317913f
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module GithubUtil def configure git_config = Git.global_config user_name = git_config['user.name'] user_email = git_config['user.email'] github_username = git_config['github.user'] github_token = git_config['github.token'] {:name => github_username, :token => github_token, :login => github_username} end def info(msg) puts msg if log_level > 0 end def log(msg) puts msg if log_level > 1 end def post(path, options = {}) opts = {'login' => config[:login], 'token' => config[:token]} res = Net::HTTP.post_form URI.parse(path), opts.merge(options) res.extend(GithubParser) end def post_repo_user(api_path, repo, action, options = {}) user = options[:user] ? options[:user] : config[:name] path = 'http://github.com/api/v2/yaml/' path << api_path path << "/#{user}/#{repo}" path << "/#{action}" if action post path, options end def post_repo_show(repo, action, options = {}) res = post_repo_user 'repos/show', repo, action, options res.parse_result(action) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
github_repo-0.1.0 | lib/github_util.rb |