Permalink
Browse files

* Fixed up some more small things.

 * Added a link to the GitHub guide in the README
  • Loading branch information...
James Tucker
James Tucker committed May 11, 2008
1 parent 9d77857 commit f3943b053811c3cd8c3ad98e9025243677aeff03
Showing with 33 additions and 10 deletions.
  1. +6 −1 README
  2. +24 −6 bin/github_post_receive_server
  3. +3 −3 bin/github_post_receive_server.ru
View
7 README
@@ -6,4 +6,9 @@ it your own, enjoy it. I've added a rackup for those of you that would prefer
to use an evented server for this application. (It's kinda ideal in this case)
Sadly, the way rubygems packs up binaries, I will need some assistance making
-the rackup work from the default binary install path.
+the rackup work from the default binary install path.
+
+For more details please see the following guide on GitHub:
+http://github.com/guides/post-receive-hooks
+
+And please, take a look at the source, that's what it's there for.
@@ -1,5 +1,17 @@
#!/usr/bin/env ruby
-$0 = "Rack Post-Receive Server :-P"
+trap(:INT) { exit 0 }
+
+defaults = {
+ :Host => '127.0.0.1',
+ :Port => 9001
+}
+
+abort %{
+ Usage: #{$0} [--help] [host [port]]
+ The default host is #{defaults[:Host]}
+ The default port is #{defaults[:Port]}
+} if ARGV.find {|a| /--help/ =~ a}
+
begin
require 'rubygems'
require 'github_post_receive_server'
@@ -13,10 +25,16 @@ app = Rack::Builder.new do
run GithubPostReceiveServer::RackApp.new
end
-trap(:INT) { exit 0 }
+options = {
+ :Host => ARGV[0] || defaults[:Host],
+ :Port => ARGV[1] || defaults[:Port]
+}
+
+puts "Starting server on http://#{options[:Host]}:#{options[:Port]}"
+$0 = "Rack Post-Receive Server (http://#{options[:Host]}:#{options[:Port]}) :-P"
begin
- Rack::Handler::Mongrel.run(app, :Port => 9001)
-rescue
- puts "Install mongrel for faster http service."
- Rack::Handler::Webrick.run(app, :Port => 9001)
+ Rack::Handler::Mongrel.run(app, options)
+rescue LoadError
+ warn "Install mongrel for faster http service."
+ Rack::Handler::WEBrick.run(app, options)
end
@@ -1,11 +1,11 @@
#!/usr/bin/env rackup
begin
require 'rubygems'
- require 'github_post_commit_server'
+ require 'github_post_receive_server'
rescue LoadError
- require File.dirname(__FILE__) + '/../lib/github_post_commit_server'
+ require File.dirname(__FILE__) + '/../lib/github_post_receive_server'
end
use Rack::CommonLogger
use Rack::Lint
-run GithubPostCommitServer::RackApp.new
+run GithubPostReceiveServer::RackApp.new

0 comments on commit f3943b0

Please sign in to comment.