Ruby Net::GitHub::Upload

DESCRIPTION

Ruby Net::GitHub::Upload is upload user agent for GitHub Downloads respect to github.com/typester/net-github-upload-perl

SYNOPSIS

# require
require 'rubygems'
require 'net/github-upload'

# setup
 = `git config github.user`.chomp  # your login for github
token = `git config github.token`.chomp # your token for github
repos = 'repository name'               # your repos name (like 'taberareloo')
gh = Net::GitHub::Upload.new(
  :login => ,
  :token => token
)

# file upload
direct_link = gh.upload(
  :repos => repos,
  :file  => 'test/test',
  :description => "test file"
)
# direct link is link to Amazon S3.
# Because GitHub refrection for file changing is async,
# if you get changed file synchronously, you use this "direct_link"

# data upload
# you can define content_type => Amazon S3 Content-Type
time = Time.now.to_i
direct_link = gh.upload(
  :repos => repos,
  :data  => 'test',
  :name  => "test_#{time}.txt",
  :content_type => 'text/plain',
  :description => "test file2"
)

# replace file or data
# thx id:rngtng !
direct_link = gh.replace(
  :repos => repos,
  :file  => 'test/test',
  :description => "test file"
)
direct_link = gh.replace(
  :repos => repos,
  :data  => 'test',
  :name  => "test_#{time}.txt",
  :content_type => 'text/plain',
  :description => "test file2"
)

DEPENDENCY

  • nokogiri

  • faster_xml_simple

  • httpclient

INSTALL

gem source -a http://gemcutter.org
sudo gem install net-github-upload

LICENSE

Ruby Net::Github::Upload (The MIT License)

Copyright © 2009 Constellation

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.