Created
August 19, 2011 17:02
-
-
Save casualjim/1157353 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # Upstart file for sinatra github hook | |
| start on runlevel [2345] | |
| stop on runlevel [06] | |
| #console logged | |
| #respawn | |
| env RUBYOPT=rubygems | |
| exec ruby /home/ivan/src/github_post_receive/hook_server.rb |
This file contains hidden or 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
| require 'sinatra' | |
| require 'net/http' | |
| require 'yajl/json_gem' | |
| configure do | |
| set :port, 4480 | |
| end | |
| get "/" do | |
| puts "works" | |
| "works" | |
| end | |
| post "/:project" do | |
| Net::HTTP.start("localhost", 8080) { |http| | |
| project = params[:project] | |
| puts "Triggerng build for #{project}" | |
| req = Net::HTTP::Get.new("/job/#{project}/build?token=GITHUB&cause=Updated%20from%20github") | |
| req.basic_auth 'notifier', 'PASSWORD' | |
| puts http.request(req) | |
| } | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment