Navigation Menu

Skip to content

Commit

Permalink
add GitHub uploader.
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Nov 28, 2011
1 parent 1be5095 commit 99079aa
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
4 changes: 4 additions & 0 deletions Makefile.am
Expand Up @@ -95,6 +95,10 @@ update-files:
cd $(srcdir)/doc && $(MAKE) update-files
cd $(srcdir)/test/sql && $(MAKE) update-files

upload-to-github:
ruby $(srcdir)/tools/upload-to-github.rb \
$$USER $(PACKAGE)-$(VERSION).tar.gz

echo-mysql-source:
echo $(MYSQL_SOURCE)

Expand Down
3 changes: 2 additions & 1 deletion tools/Makefile.am
@@ -1,5 +1,6 @@
noinstall_ruby_scripts = \
prepare-sphinx-html.rb
prepare-sphinx-html.rb \
upload-to-github.rb

EXTRA_DIST = \
$(noinstall_ruby_scripts)
30 changes: 30 additions & 0 deletions tools/upload-to-github.rb
@@ -0,0 +1,30 @@
#!/usr/bin/env ruby

if ARGV.size < 1
puts "Usage: #{$0} USER FILE ..."
puts " e.g.: #{$0} kou mroonga-1.10.tar.gz ..."
exit false
end

require "rubygems"
require "github_api"
require "mime/types"

user, *files = *ARGV

print "password[#{user}]: "
system("stty -echo")
password = STDIN.gets.chomp
system("stty echo")
puts

github = Github.new(:login => user, :password => password)
files.each do |file|
content_type = MIME::Types.type_for(file)[0].to_s
resource = github.repos.create_download("mroonga", "mroonga",
:name => File.basename(file),
:size => File.size(file),
:description => File.basename(file),
:content_type => content_type)
github.repos.upload(resource, File.basename(file))
end

0 comments on commit 99079aa

Please sign in to comment.