stream_grabber 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -4
- data/app/helpers/stream_grabber_helper.rb +1 -1
- data/lib/stream_grabber/github.rb +2 -2
- data/lib/stream_grabber/last_fm.rb +2 -2
- data/lib/stream_grabber/twitter.rb +1 -1
- data/lib/stream_grabber.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -57,11 +57,17 @@ following interface
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
|
60
|
-
And as long as `last_five` returns a hash with timestamps as keys,
|
61
|
-
|
62
|
-
in the resulting list.
|
60
|
+
And as long as `last_five` returns a hash with timestamps as keys, the
|
61
|
+
value of each key is an array of the form
|
63
62
|
|
64
|
-
|
63
|
+
[:classname, "value"]
|
64
|
+
|
65
|
+
where `:classname` is a symbol representing what css class you want `li`
|
66
|
+
elements for that source to have and `"value"` is whatever string
|
67
|
+
content you want to display in the body.
|
68
|
+
|
69
|
+
Over engineered? Damn Straight!! You can see it in action [in the
|
70
|
+
sidebar of my homepage](http://eightbitraptor.com)
|
65
71
|
|
66
72
|
If you want to add sources, please give me a pull request and I'll merge
|
67
73
|
them straight in.
|
@@ -5,7 +5,7 @@ module StreamGrabberHelper
|
|
5
5
|
css_id = args.first[:id]
|
6
6
|
end
|
7
7
|
|
8
|
-
data = StreamGrabber.grab(num).inject([]){ |memo,acc| memo << content_tag(:li,raw(acc[1])) }
|
8
|
+
data = StreamGrabber.grab(num).inject([]){ |memo,acc| memo << content_tag(:li,raw(acc[1][1]), :class => acc[1][0]) }
|
9
9
|
|
10
10
|
content_tag :ol, {:class => css_class || 'activity_list', :id => css_id || 'stream_grabber'} do
|
11
11
|
raw(data.join("\n"))
|
@@ -12,7 +12,7 @@ module StreamGrabber
|
|
12
12
|
commits = {}
|
13
13
|
@doc.items.first(5).each do |item|
|
14
14
|
date = Time.parse(item[:updated].to_s).to_i
|
15
|
-
commits[date] = message_from(item[:link], item[:title])
|
15
|
+
commits[date] = [:github, message_from(item[:link], item[:title])]
|
16
16
|
end
|
17
17
|
commits
|
18
18
|
end
|
@@ -21,4 +21,4 @@ module StreamGrabber
|
|
21
21
|
%Q{<a href="#{link}">#{title}</a>}
|
22
22
|
end
|
23
23
|
end
|
24
|
-
end
|
24
|
+
end
|
@@ -16,7 +16,7 @@ module StreamGrabber
|
|
16
16
|
artist_name = elem.css('artist > name').text
|
17
17
|
track_name = elem.>('name').text
|
18
18
|
url = elem.>('url').text
|
19
|
-
tracks[date_loved] = message_for(artist_name,track_name, url)
|
19
|
+
tracks[date_loved] = [:lastfm, message_for(artist_name,track_name, url)]
|
20
20
|
end
|
21
21
|
tracks
|
22
22
|
end
|
@@ -25,4 +25,4 @@ module StreamGrabber
|
|
25
25
|
%Q{ #{@user_name} loved the track <a href="#{url}">#{title} by #{artist}</a> on Last.fm }
|
26
26
|
end
|
27
27
|
end
|
28
|
-
end
|
28
|
+
end
|
@@ -12,7 +12,7 @@ module StreamGrabber
|
|
12
12
|
tweets = {}
|
13
13
|
@doc.each do |tweet|
|
14
14
|
date = Time.parse(tweet["created_at"]).to_i
|
15
|
-
tweets[date] = message_from(tweet["text"], tweet["id"])
|
15
|
+
tweets[date] = [:twitter, message_from(tweet["text"], tweet["id"])]
|
16
16
|
end
|
17
17
|
tweets
|
18
18
|
end
|
data/lib/stream_grabber.rb
CHANGED
@@ -22,7 +22,7 @@ module StreamGrabber
|
|
22
22
|
StreamGrabber.constants.each do |klass|
|
23
23
|
k = StreamGrabber.const_get(klass)
|
24
24
|
if k.instance_of?(Class) and k.method_defined?('last_five')
|
25
|
-
name = k.name.partition('::').last.
|
25
|
+
name = k.name.partition('::').last.underscore.downcase
|
26
26
|
user_name = usernames[name.to_sym]
|
27
27
|
messages.merge!(k.new(user_name).send(:last_five))
|
28
28
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stream_grabber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 31
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 2
|
10
|
+
version: 0.1.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt House
|