housefire 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/housefire.rb +25 -21
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
data/lib/housefire.rb
CHANGED
@@ -51,33 +51,37 @@ class Housefire
|
|
51
51
|
|
52
52
|
# parse out events into things we recognize (changeset, ticket, etc.)
|
53
53
|
doc.css("entry").each do |entry|
|
54
|
-
|
54
|
+
begin
|
55
|
+
id = entry.css("id")[0].content.split("Event/")[1].to_i
|
55
56
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
57
|
+
# DON'T notify the same event more than once
|
58
|
+
if !recent_items.key?(id)
|
59
|
+
e = {}
|
60
|
+
e[:id] = id
|
60
61
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
62
|
+
# DON'T notify changesets, github already does that
|
63
|
+
title = entry.css("title")[0].content
|
64
|
+
if !title.include?("[Changeset] ")
|
65
|
+
e[:title] = title
|
66
|
+
e[:content] = Sanitize.clean(entry.css("content")[0].content)
|
67
|
+
e[:author] = entry.css("author name")[0].content
|
68
|
+
e[:link] = entry.css("link")[0].attributes["href"].content
|
69
|
+
e[:date] = entry.css("published")[0].content
|
69
70
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
71
|
+
message = "#{e[:author]}: #{e[:title]} -- #{e[:content]}".gsub(/[^[:print:]]/, '').gsub(/&/,'&')
|
72
|
+
puts message
|
73
|
+
puts "\n\n\n"
|
74
|
+
@room.speak(message)
|
75
|
+
end
|
76
|
+
# recent_items = recent_items.sort.last 10
|
77
|
+
recent_items[id] = e
|
78
|
+
save_db(@conf['lhcache'], recent_items)
|
74
79
|
end
|
75
|
-
|
76
|
-
|
77
|
-
|
80
|
+
rescue Exception => e
|
81
|
+
puts e.message
|
82
|
+
puts e.backtrace.inspect
|
78
83
|
end
|
79
84
|
end
|
80
|
-
|
81
85
|
end
|
82
86
|
|
83
87
|
def save_db(file, object)
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 0.0.
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- David Grandinetti
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-04
|
17
|
+
date: 2010-05-04 00:00:00 +01:00
|
18
18
|
default_executable: housefire
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|