null+****@clear*****
null+****@clear*****
2011年 11月 29日 (火) 01:34:35 JST
Kouhei Sutou 2011-11-28 16:34:35 +0000 (Mon, 28 Nov 2011)
New Revision: 99079aaba548b3f7d2c43fd36d8c5698041504c4
Log:
add GitHub uploader.
Added files:
tools/upload-to-github.rb
Modified files:
Makefile.am
tools/Makefile.am
Modified: Makefile.am (+4 -0)
===================================================================
--- Makefile.am 2011-11-28 16:04:37 +0000 (4375f48)
+++ Makefile.am 2011-11-28 16:34:35 +0000 (e1cab2c)
@@ -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)
Modified: tools/Makefile.am (+2 -1)
===================================================================
--- tools/Makefile.am 2011-11-28 16:04:37 +0000 (245fb81)
+++ tools/Makefile.am 2011-11-28 16:34:35 +0000 (b65b930)
@@ -1,5 +1,6 @@
noinstall_ruby_scripts = \
- prepare-sphinx-html.rb
+ prepare-sphinx-html.rb \
+ upload-to-github.rb
EXTRA_DIST = \
$(noinstall_ruby_scripts)
Added: tools/upload-to-github.rb (+30 -0) 100755
===================================================================
--- /dev/null
+++ tools/upload-to-github.rb 2011-11-28 16:34:35 +0000 (618e2df)
@@ -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