Skip to content

Constellation/ruby-net-github-upload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
login = `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 => login,
  :token => token
)

# file upload
direct_link = gh.upload(
  :repos => repos,
  :file  => 'test/test',
  :description => "test file",
  :upload_timeout => 600 # Allow yourself time to upload larger files.
)
# 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"
)

# Printing out progress (will yield to block once a second):
direct_link = gh.upload(
  :repos => repos,
  :file  => 'test/test',
  :description => "test file",
  :upload_timeout => 600 # Allow yourself time to upload larger files.
) do
  print "."
end
puts "."

DEPENDENCY

  • nokogiri

  • json

  • faster_xml_simple

  • httpclient

INSTALL

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

DEVELOPERS

id:Constellation id:Spooner

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.

Releases

No releases published

Packages

No packages published

Languages