post2irc 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -1
- data/README.textile +5 -0
- data/bin/post2irc +4 -2
- data/lib/post2irc/ircbot.rb +0 -5
- data/lib/post2irc/sinatra_listener.rb +16 -3
- data/lib/post2irc/version.rb +1 -1
- data/lib/post2irc.rb +2 -1
- data/post2irc.gemspec +1 -0
- metadata +18 -7
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
post2irc (0.
|
4
|
+
post2irc (0.9.1)
|
5
5
|
cinch
|
6
6
|
json
|
7
7
|
sinatra
|
8
|
+
xml-simple
|
8
9
|
|
9
10
|
GEM
|
10
11
|
remote: http://rubygems.org/
|
@@ -19,6 +20,7 @@ GEM
|
|
19
20
|
rack-protection (~> 1.2)
|
20
21
|
tilt (~> 1.3, >= 1.3.3)
|
21
22
|
tilt (1.3.3)
|
23
|
+
xml-simple (1.1.1)
|
22
24
|
|
23
25
|
PLATFORMS
|
24
26
|
ruby
|
data/README.textile
CHANGED
@@ -24,6 +24,11 @@ There is a built-in service hook for bitbucket, so you can receive alerts of you
|
|
24
24
|
|
25
25
|
http://your_url:8080/public/sources/bitbucket/service
|
26
26
|
|
27
|
+
|
28
|
+
There us a built-in service hook for pivotal tracker, so you can receive notifications on story changes on irc. Go to the admin of your pivotal repository, look for project/integrations and add a webhook pointing to
|
29
|
+
|
30
|
+
http://your_url:8080/public/sources/pivotal/webhook
|
31
|
+
|
27
32
|
Of course both the url and port must be accessible from the internet
|
28
33
|
|
29
34
|
|
data/bin/post2irc
CHANGED
@@ -2,16 +2,18 @@
|
|
2
2
|
|
3
3
|
begin
|
4
4
|
require 'cinch'
|
5
|
-
require 'sinatra'
|
5
|
+
require 'sinatra/base'
|
6
6
|
require 'json'
|
7
|
+
require 'xmlsimple'
|
7
8
|
require 'post2irc'
|
8
9
|
rescue LoadError => e
|
9
10
|
require 'rubygems'
|
10
11
|
path = File.expand_path '../../lib', __FILE__
|
11
12
|
$:.unshift(path) if File.directory?(path) && !$:.include?(path)
|
12
13
|
require 'cinch'
|
13
|
-
require 'sinatra'
|
14
|
+
require 'sinatra/base'
|
14
15
|
require 'json'
|
16
|
+
require 'xmlsimple'
|
15
17
|
require 'post2irc'
|
16
18
|
end
|
17
19
|
|
data/lib/post2irc/ircbot.rb
CHANGED
@@ -22,12 +22,12 @@ class SinatraListener < Sinatra::Base
|
|
22
22
|
end
|
23
23
|
|
24
24
|
post "/:prefix" do
|
25
|
-
|
25
|
+
halt UNAUTHORIZED unless authorized?(params[:prefix])
|
26
26
|
Ircbot.report string_cleaner(params[:q])
|
27
27
|
end
|
28
28
|
|
29
29
|
post "/:prefix/sources/bitbucket/service" do
|
30
|
-
|
30
|
+
halt UNAUTHORIZED unless authorized?(params[:prefix])
|
31
31
|
unless params[:payload].nil?
|
32
32
|
payload=JSON.parse params[:payload]
|
33
33
|
puts payload
|
@@ -36,8 +36,21 @@ class SinatraListener < Sinatra::Base
|
|
36
36
|
repository_uri=payload['repository']['absolute_url']
|
37
37
|
repository_name=payload['repository']['name']
|
38
38
|
|
39
|
-
Ircbot.report string_cleaner( [repository_name, messages_authors, "#{base_uri}#{repository_uri}"].compact.join(' :: ') )
|
39
|
+
Ircbot.report string_cleaner( ['bitbucket', repository_name, messages_authors, "#{base_uri}#{repository_uri}"].compact.join(' :: ') )
|
40
40
|
end
|
41
41
|
end
|
42
|
+
|
43
|
+
post "/:prefix/sources/pivotal/webhook" do
|
44
|
+
halt UNAUTHORIZED unless authorized?(params[:prefix])
|
45
|
+
activity = XmlSimple.xml_in request.body.read
|
46
|
+
|
47
|
+
event_type = activity['event_type']
|
48
|
+
author = activity['author']
|
49
|
+
description = activity['description']
|
50
|
+
#we get the URLs and remove the /services/v3 so they will be accessed via direct link
|
51
|
+
stories_urls =activity['stories'].map{|s1| s1['story'].map{|s2| s2['url'] } }.flatten.join(' , ').gsub('/services/v3','') rescue nil
|
52
|
+
|
53
|
+
Ircbot.report string_cleaner( ['pivotal', event_type, author, description, stories_urls].compact.join(' :: ') )
|
54
|
+
end
|
42
55
|
end
|
43
56
|
|
data/lib/post2irc/version.rb
CHANGED
data/lib/post2irc.rb
CHANGED
data/post2irc.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: post2irc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-08-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sinatra
|
16
|
-
requirement: &
|
16
|
+
requirement: &82039780 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *82039780
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cinch
|
27
|
-
requirement: &
|
27
|
+
requirement: &82039410 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *82039410
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: json
|
38
|
-
requirement: &
|
38
|
+
requirement: &82038880 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,18 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *82038880
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: xml-simple
|
49
|
+
requirement: &82038320 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *82038320
|
47
58
|
description: This gem will start a sinatra script that will listen to posts and will
|
48
59
|
publish the contents to an irc channel. No authentication is provided.
|
49
60
|
email:
|