public
Description: Sinatra app that pushes your Github Commit info to twitter
Homepage: http://groups.google.com/group/github-twitter/
Clone URL: git://github.com/jnunemaker/github-twitter.git
Search Repo:
updated config and got the littly diddy working
jnunemaker (author)
Fri Feb 15 20:47:15 -0800 2008
commit  3ee5e28266dc4e4ca6f815a63b51d96e2acc3087
tree    e8ec6936d016a7975ade218d7ec11d4c3797a481
parent  9b21120e31621f390c931e083de8d62818298bee
...
 
 
...
1
2
0
@@ -1 +1,3 @@
0
+config.yml
0
+*.log
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
0
@@ -1 +1,41 @@
0
+require 'net/http'
0
+
0
+payload = %Q{{
0
+ "before": "5aef35982fb2d34e9d9d4502f6ede1072793222d",
0
+ "repository": {
0
+ "url": "http://github.com/defunkt/github",
0
+ "name": "github",
0
+ "owner": {
0
+ "email": "chris@ozmm.org",
0
+ "name": "defunkt"
0
+ }
0
+ },
0
+ "commits": {
0
+ "41a212ee83ca127e3c8cf465891ab7216a705f59": {
0
+ "url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
0
+ "author": {
0
+ "email": "chris@ozmm.org",
0
+ "name": "Chris Wanstrath"
0
+ },
0
+ "message": "okay i give in",
0
+ "timestamp": "2008-02-15T14:57:17-08:00"
0
+ },
0
+ "de8251ff97ee194a289832576287d6f8ad74e3d0": {
0
+ "url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
0
+ "author": {
0
+ "email": "chris@ozmm.org",
0
+ "name": "Chris Wanstrath"
0
+ },
0
+ "message": "update pricing a tad",
0
+ "timestamp": "2008-02-15T14:36:34-08:00"
0
+ }
0
+ },
0
+ "after": "de8251ff97ee194a289832576287d6f8ad74e3d0"
0
+}}
0
+
0
+url = URI.parse('http://localhost:4567/')
0
+req = Net::HTTP::Post.new(url.path)
0
+req.set_form_data({'payload' => payload})
0
+res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
0
+puts res
...
12
13
14
15
 
16
17
18
...
27
28
29
30
 
31
32
33
...
12
13
14
 
15
16
17
18
...
27
28
29
 
30
31
32
33
0
@@ -12,7 +12,7 @@
0
     payload = JSON.parse(payload)
0
     return unless payload.keys.include?("repository")
0
     @repo = payload["repository"]["name"]
0
- @template = ERB.new(REPOS[@repo]["template"] || "[<%= commit['repo'] %>] <%= commit['author']['name'] %> (<%= commit['url'] %>) - <%= commit['message'] %>")
0
+ @template = ERB.new(REPOS[@repo]["template"] || "[<%= commit['repo'] %>] <%= commit['url'] %> by <%= commit['author']['name'] %> - <%= commit['message'] %>")
0
     @twitter = connect(@repo)
0
     payload["commits"].each { |c| process_commit(c.last) }
0
   end
0
@@ -27,7 +27,7 @@
0
     proc = Proc.new do
0
       commit
0
     end
0
- @twitter.update(@template.result(proc))
0
+ @twitter.post(@template.result(proc)[0,140])
0
   end
0
   
0
 end

Comments

    No one has commented yet.