Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 51 lines (45 sloc) 1.177 kb
835f8cf @pjhyett GitHub service integration
pjhyett authored
1 $:.unshift *Dir["#{File.dirname(__FILE__)}/vendor/**/lib"]
5ed9057 @pjhyett organize requires to prevent merge conflicts
pjhyett authored
2
3 # stdlib
4 require 'net/http'
5 require 'net/https'
6 require 'net/smtp'
7 require 'socket'
8 require 'timeout'
9 require 'xmlrpc/client'
10 require 'openssl'
0b62ddb @tekkub Escape out the log message before sending to CIA
tekkub authored
11 require 'cgi'
5ab9f83 @tekkub Fix CIA timestamp (I think)
tekkub authored
12 #~ require 'date' # This is needed by the CIA service in ruby 1.8.7 or later
5ed9057 @pjhyett organize requires to prevent merge conflicts
pjhyett authored
13
14 # vendor
15 require 'rack'
16 require 'sinatra'
17 require 'tinder'
18 require 'json'
19 require 'tinder'
20 require 'basecamp'
21 require 'tmail'
22 require 'xmpp4r'
23 require 'xmpp4r-simple'
a24963a initial commit of new RubyForge service
Bryan T. Richardson authored
24 require 'rubyforge'
835f8cf @pjhyett GitHub service integration
pjhyett authored
25
7ef39cf Exterminate repetition and make people's lives just that little bit easi...
Luke Redpath authored
26 module GitHub
38c735a @pjhyett use common short_url method and revert back to tinyurl because of is.gd ...
pjhyett authored
27 def service(name)
8f31ca2 @pjhyett turn back on global timeout
pjhyett authored
28 Timeout.timeout(20) do
33e198e @pjhyett timeout block around everything
pjhyett authored
29 post "/#{name}/" do
30 data = JSON.parse(params[:data])
31 payload = JSON.parse(params[:payload])
32 yield data, payload
33 end
8f31ca2 @pjhyett turn back on global timeout
pjhyett authored
34 end
35 rescue Timeout::Error
7ef39cf Exterminate repetition and make people's lives just that little bit easi...
Luke Redpath authored
36 end
38c735a @pjhyett use common short_url method and revert back to tinyurl because of is.gd ...
pjhyett authored
37
38 def shorten_url(url)
39 Timeout::timeout(6) do
98fb9b6 @pjhyett use bitly instead of tinyurl
pjhyett authored
40 short = Net::HTTP.get("api.bit.ly", "/shorten?version=2.0.1&longUrl=#{url}&login=github&apiKey=R_261d14760f4938f0cda9bea984b212e4")
41 short = JSON.parse(short)
42 short["errorCode"].zero? ? short["results"][url]["shortUrl"] : url
38c735a @pjhyett use common short_url method and revert back to tinyurl because of is.gd ...
pjhyett authored
43 end
44 rescue Timeout::Error
45 url
46 end
7ef39cf Exterminate repetition and make people's lives just that little bit easi...
Luke Redpath authored
47 end
48 include GitHub
835f8cf @pjhyett GitHub service integration
pjhyett authored
49
0576ff1 @pjhyett I take it back, it just needed the full load path to load correctly
pjhyett authored
50 Dir["#{File.dirname(__FILE__)}/services/**/*.rb"].each { |service| load service }
Something went wrong with that request. Please try again.