Created
November 18, 2009 21:54
-
-
Save tekkub/238305 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'net/http' | |
require 'net/https' | |
user = `git config --global github.user`.strip | |
token = `git config --global github.token`.strip | |
raise "Error reading github auth" if user.empty? || token.empty? | |
auth = {:login => user, :token => token} | |
projname = Dir.getwd.split("/").last | |
url = URI.parse "https://github.com/tekkub/#{projname.downcase}/edit/postreceive_urls" | |
req = Net::HTTP::Post.new(url.path) | |
req.set_form_data({"urls[]" => "http://tekkub.net/github"}.merge(auth), '&') | |
server = Net::HTTP.new url.host, url.port | |
server.use_ssl = url.scheme == 'https' | |
server.verify_mode = OpenSSL::SSL::VERIFY_NONE | |
res = server.start {|http| http.request(req) } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment