Skip to content
Browse files

provide web-hooks for rdoc.info backwards compatibility

  • Loading branch information...
1 parent db0ece9 commit 0917964e1c10c41e38844216b02c067bc43464a2 @zapnap zapnap committed
Showing with 21 additions and 19 deletions.
  1. +21 −19 app.rb
View
40 app.rb
@@ -140,25 +140,27 @@ def shorten_commit_link(commit)
# Checkout and post commit hooks
- post '/checkout' do
- if params[:payload]
- payload = JSON.parse(params[:payload])
- url = payload["repository"]["url"].gsub(%r{^http://}, 'git://')
- scheme = "git"
- commit = nil
- else
- scheme = params[:scheme]
- url = params[:url]
- commit = params[:commit]
- end
- dirname = File.basename(url).gsub(/\.[^.]+\Z/, '').gsub(/\s+/, '')
- return "INVALIDSCHEME" unless url.include?("://")
- case scheme
- when "git", "svn"
- fork { checkout(url, dirname, commit, scheme) }
- "OK"
- else
- "INVALIDSCHEME"
+ ['/checkout', '/projects/update'].each do |path|
+ post path do
+ if params[:payload]
+ payload = JSON.parse(params[:payload])
+ url = payload["repository"]["url"].gsub(%r{^http://}, 'git://')
+ scheme = "git"
+ commit = nil
+ else
+ scheme = params[:scheme]
+ url = params[:url]
+ commit = params[:commit]
+ end
+ dirname = File.basename(url).gsub(/\.[^.]+\Z/, '').gsub(/\s+/, '')
+ return "INVALIDSCHEME" unless url.include?("://")
+ case scheme
+ when "git", "svn"
+ fork { checkout(url, dirname, commit, scheme) }
+ "OK"
+ else
+ "INVALIDSCHEME"
+ end
end
end

0 comments on commit 0917964

Please sign in to comment.
Something went wrong with that request. Please try again.