muck-raker 0.1.45 → 0.1.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.45
1
+ 0.1.46
@@ -4,10 +4,13 @@ class Muck::TopicsController < ApplicationController
4
4
  before_filter :adjust_format_for_iphone
5
5
  before_filter :check_terms, :except => [:new]
6
6
  before_filter :build_tag_feeds, :only => [:show, :rss_discovery]
7
+ before_filter :configure_feed_loading, :only => [:show]
7
8
 
8
9
  def show
9
- @show_google_search = true
10
- @show_combined = false
10
+
11
+ load_feeds
12
+ load_combined_feeds
13
+
11
14
  respond_to do |format|
12
15
  format.html do
13
16
  @opml_path = topic_path(params[:id], :service_ids => params[:service_ids], :format => 'opml')
@@ -81,15 +84,58 @@ class Muck::TopicsController < ApplicationController
81
84
  @video_feeds = Service.build_video_feeds(@terms, current_user, params[:service_ids])
82
85
  @bookmark_feeds = Service.build_bookmark_feeds(@terms, current_user, params[:service_ids])
83
86
  @music_feeds = Service.build_music_feeds(@terms, current_user, params[:service_ids])
87
+ @news_feeds = Service.build_news_feeds(@terms, current_user, params[:service_ids])
88
+ @blog_feeds = Service.build_blog_feeds(@terms, current_user, params[:service_ids])
89
+ @search_feeds = Service.build_search_feeds(@terms, current_user, params[:service_ids])
90
+
84
91
  @general_feeds = Service.build_general_feeds(@terms, current_user, params[:service_ids])
85
92
 
86
93
  @discovered_feeds = GoogleFeedRequest.find_feeds(@terms)
87
94
 
88
- @feeds = @photo_feeds + @video_feeds + @bookmark_feeds + @music_feeds + @general_feeds + @discovered_feeds
95
+ @feeds = @photo_feeds + @video_feeds + @bookmark_feeds + @music_feeds + @news_feeds + @blog_feeds + @search_feeds + @general_feeds + @discovered_feeds
89
96
 
90
97
  @number_of_items = 6
91
98
  @number_of_images = 12
92
99
  @number_of_videos = 6
93
100
  end
94
101
 
102
+ def load_feeds
103
+ if @load_feeds_on_server
104
+ @server_loaded_general_feeds = GoogleFeedRequest.load_feeds(@general_feeds + @discovered_feeds)
105
+ @server_loaded_photo_feeds = GoogleFeedRequest.load_feeds(@photo_feeds)
106
+ @server_loaded_video_feeds = GoogleFeedRequest.load_feeds(@video_feeds)
107
+ @server_loaded_bookmark_feeds = GoogleFeedRequest.load_feeds(@bookmark_feeds)
108
+ @server_loaded_music_feeds = GoogleFeedRequest.load_feeds(@music_feeds)
109
+ @server_loaded_news_feeds = GoogleFeedRequest.load_feeds(@news_feeds)
110
+ @server_loaded_blog_feeds = GoogleFeedRequest.load_feeds(@blog_feeds)
111
+ @server_loaded_search_feeds = GoogleFeedRequest.load_feeds(@search_feeds)
112
+ if @show_combined
113
+ @server_loaded_general_feeds = Feed.combine_sort(@server_loaded_general_feeds)
114
+ @server_loaded_photo_feeds = Feed.combine_sort(@server_loaded_photo_feeds)
115
+ @server_loaded_video_feeds = Feed.combine_sort(@server_loaded_video_feeds)
116
+ @server_loaded_bookmark_feeds = Feed.combine_sort(@server_loaded_bookmark_feeds)
117
+ @server_loaded_music_feeds = Feed.combine_sort(@server_loaded_music_feeds)
118
+ @server_loaded_news_feeds = Feed.combine_sort(@server_loaded_news_feeds)
119
+ @server_loaded_blog_feeds = Feed.combine_sort(@server_loaded_blog_feeds)
120
+ @server_loaded_search_feeds = Feed.combine_sort(@server_loaded_search_feeds)
121
+ end
122
+ end
123
+ end
124
+
125
+ def load_combined_feeds
126
+ return unless @load_feeds_on_server && @show_combined
127
+ @server_loaded_feeds = Feed.sort_entries(@server_loaded_general_feeds + @server_loaded_news_feeds +
128
+ @server_loaded_blog_feeds + @server_loaded_search_feeds +
129
+ @server_loaded_photo_feeds + @server_loaded_video_feeds +
130
+ @server_loaded_bookmark_feeds + @server_loaded_music_feeds)
131
+ @server_loaded_data_feeds = Feed.sort_entries(@server_loaded_general_feeds + @server_loaded_news_feeds + @server_loaded_blog_feeds + @server_loaded_search_feeds)
132
+ @server_loaded_extended_data_feeds = Feed.sort_entries(@server_loaded_data_feeds + @server_loaded_bookmark_feeds)
133
+ end
134
+
135
+ def configure_feed_loading
136
+ @show_google_search = true
137
+ @show_combined = false
138
+ @load_feeds_on_server = false
139
+ end
140
+
95
141
  end
@@ -238,11 +238,12 @@ module MuckRakerGoogleHelper
238
238
  </script>}
239
239
  end
240
240
 
241
- def google_hot_trends
241
+ # Renders a partial with the latest trends from google.
242
+ def google_hot_trends(limit = 10)
242
243
  feed = Feed.fetch_feed('http://www.google.com/trends/hottrends/atom/hourly')
243
244
  result = Nokogiri::HTML(feed.entries[0].content)
244
245
  google_hot_trends_terms = result.css('a').collect{ |a| change_chars(a.text) }.compact
245
- render :partial => 'google/hot_trends', :locals => { :google_hot_trends_terms => google_hot_trends_terms }
246
+ render :partial => 'google/hot_trends', :locals => { :google_hot_trends_terms => google_hot_trends_terms[0, limit] }
246
247
  end
247
248
 
248
249
  def change_chars(term)
data/app/models/feed.rb CHANGED
@@ -208,4 +208,17 @@ class Feed < ActiveRecord::Base
208
208
  uris.collect { |uri| Feed.find_or_create(uri, '', '', '', service.id, user, uri) }
209
209
  end
210
210
 
211
+ # Combines entries in a collection of feeds together and sorts the entries by date
212
+ def self.combine_sort(feeds)
213
+ return [] if feeds.nil? || feeds.blank?
214
+ entries = feeds.collect{|feed| feed.entries}.flatten!
215
+ sort_entries(entries)
216
+ end
217
+
218
+ # Sorts a collection of entries by date
219
+ def self.sort_entries(entries)
220
+ return [] if entries.nil? || entries.blank?
221
+ entries.sort { |a,b| b.published_at <=> a.published_at }
222
+ end
223
+
211
224
  end
@@ -19,17 +19,66 @@ class GoogleFeedRequest
19
19
  get('http://ajax.googleapis.com/ajax/services/feed/lookup', :query => build_google_query({:q => uri}))
20
20
  end
21
21
 
22
+ # Requests entries for a single feed
22
23
  def self.load_feed(uri)
23
24
  get('http://ajax.googleapis.com/ajax/services/feed/load', :query => build_google_query({:q => uri}))
24
25
  end
25
26
 
27
+ # Requests a set of feeds from Google
28
+ #
29
+ # feeds: An array of objects with the attributes 'uri' and 'service_id' defined
30
+ def self.load_feeds(feeds)
31
+ feeds = feeds.collect do |feed|
32
+ json = load_feed(feed.uri)
33
+ new_feed = convert_google_feed_json_to_feed(feed, json)
34
+ new_feed.entries << convert_google_feed_json_to_entries(new_feed, json).compact if new_feed
35
+ new_feed
36
+ end
37
+ if feeds
38
+ feeds.compact!
39
+ else
40
+ []
41
+ end
42
+ end
43
+
44
+ # Converts json returned from google into a feed object
45
+ def self.convert_google_feed_json_to_feed(feed, json)
46
+ if json['responseStatus'] == 200
47
+ if json['responseData']['feed']
48
+ Feed.new( :uri => feed.uri,
49
+ :service_id => feed.service_id,
50
+ :display_uri => json['responseData']['feed']['link'],
51
+ :title => json['responseData']['feed']['title'],
52
+ :service => feed.service)
53
+ end
54
+ end
55
+ end
56
+
57
+ # Converts json returned from google into an array of entries
58
+ def self.convert_google_feed_json_to_entries(feed, json)
59
+ if json['responseData']['feed']['entries']
60
+ json['responseData']['feed']['entries'].collect do |entry|
61
+ published_at = DateTime.parse(entry['publishedDate']) rescue DateTime.now - 1.day
62
+ Entry.new(:permalink => entry['link'],
63
+ :author => entry['author'],
64
+ :title => entry['title'],
65
+ :description => entry['contentSnippet'],
66
+ :content => entry['content'],
67
+ :published_at => published_at,
68
+ :tag_list => entry['categories'],
69
+ :direct_link => entry['link'],
70
+ :feed => feed)
71
+ end
72
+ end
73
+ end
74
+
26
75
  # Search for feeds using google. This will return
27
76
  # a collection of 'Feed' objects
28
77
  def self.find_feeds(query)
29
78
  query = query.join('+') if query.is_a?(Array)
30
79
  feed_response = find_google_feeds(query)
31
80
  if 200 == feed_response['responseStatus']
32
- convert_google_json_to_feeds(feed_response)
81
+ convert_google_find_feeds_json_to_feeds(feed_response)
33
82
  else
34
83
  []
35
84
  end
@@ -42,7 +91,7 @@ class GoogleFeedRequest
42
91
  end
43
92
 
44
93
  # convert the result of a google query to 'Feed' objects
45
- def self.convert_google_json_to_feeds(google_feeds)
94
+ def self.convert_google_find_feeds_json_to_feeds(google_feeds)
46
95
  google_feeds['responseData']['entries'].collect do |google_feed|
47
96
  Feed.new( :uri => google_feed['url'],
48
97
  :display_uri => google_feed['link'],
@@ -25,7 +25,7 @@ class Service < ActiveRecord::Base
25
25
  named_scope :identity_services, :conditions => ['use_for = ?', 'identity']
26
26
  named_scope :tag_services, :conditions => ['use_for = ?', 'tags']
27
27
  named_scope :photo_services, :conditions => ["service_categories.id = services.service_category_id AND service_categories.name = 'Photos'"], :include => ['service_category']
28
-
28
+
29
29
  # Indicates whether service is primarily a photo service ie from flick, picasa, etc
30
30
  #
31
31
  # refresh_services: Optional parameter indicating whether or not to reload values from the database before checking service type
@@ -54,6 +54,27 @@ class Service < ActiveRecord::Base
54
54
  Service.get_music_services(refresh_services).include?(self)
55
55
  end
56
56
 
57
+ # Indicates whether service is primarily news
58
+ #
59
+ # refresh_services: Optional parameter indicating whether or not to reload values from the database before checking service type
60
+ def news?(refresh_services = false)
61
+ Service.get_news_services(refresh_services).include?(self)
62
+ end
63
+
64
+ # Indicates whether service is primarily blog related
65
+ #
66
+ # refresh_services: Optional parameter indicating whether or not to reload values from the database before checking service type
67
+ def blog?(refresh_services = false)
68
+ Service.get_blog_services(refresh_services).include?(self)
69
+ end
70
+
71
+ # Indicates whether service is primarily search related
72
+ #
73
+ # refresh_services: Optional parameter indicating whether or not to reload values from the database before checking service type
74
+ def search?(refresh_services = false)
75
+ Service.get_search_services(refresh_services).include?(self)
76
+ end
77
+
57
78
  # Indicates whether service is general (ie not video, photo, music or bookmark)
58
79
  #
59
80
  # refresh_services: Optional parameter indicating whether or not to reload values from the database before checking service type
@@ -120,7 +141,9 @@ class Service < ActiveRecord::Base
120
141
  uris = service.generate_uris(username, password, uri)
121
142
  uris.collect{ |u| Feed.find_or_create(u.url, u.title, username, password, service.id, contributor) } if uris
122
143
  end
123
-
144
+
145
+
146
+
124
147
  def self.build_photo_feeds(terms, user, service_ids = nil, refresh_services = false)
125
148
  if service_ids.nil?
126
149
  service_ids = get_photo_tag_services(refresh_services).map(&:id)
@@ -157,6 +180,33 @@ class Service < ActiveRecord::Base
157
180
  build_tag_feeds(terms, user, service_ids, refresh_services)
158
181
  end
159
182
 
183
+ def self.build_news_feeds(terms, user, service_ids = nil, refresh_services = false)
184
+ if service_ids.nil?
185
+ service_ids = get_news_tag_services(refresh_services).map(&:id)
186
+ else
187
+ service_ids = make_int_array(service_ids) & get_news_tag_services(refresh_services).map(&:id)
188
+ end
189
+ build_tag_feeds(terms, user, service_ids, refresh_services)
190
+ end
191
+
192
+ def self.build_blog_feeds(terms, user, service_ids = nil, refresh_services = false)
193
+ if service_ids.nil?
194
+ service_ids = get_blog_tag_services(refresh_services).map(&:id)
195
+ else
196
+ service_ids = make_int_array(service_ids) & get_blog_tag_services(refresh_services).map(&:id)
197
+ end
198
+ build_tag_feeds(terms, user, service_ids, refresh_services)
199
+ end
200
+
201
+ def self.build_search_feeds(terms, user, service_ids = nil, refresh_services = false)
202
+ if service_ids.nil?
203
+ service_ids = get_search_tag_services(refresh_services).map(&:id)
204
+ else
205
+ service_ids = make_int_array(service_ids) & get_search_tag_services(refresh_services).map(&:id)
206
+ end
207
+ build_tag_feeds(terms, user, service_ids, refresh_services)
208
+ end
209
+
160
210
  def self.build_general_feeds(terms, user, service_ids = nil, refresh_services = false)
161
211
  if service_ids.nil?
162
212
  service_ids = get_general_tag_services(refresh_services).map(&:id)
@@ -166,6 +216,8 @@ class Service < ActiveRecord::Base
166
216
  build_tag_feeds(terms, user, service_ids, refresh_services)
167
217
  end
168
218
 
219
+
220
+
169
221
  # Get all photo services
170
222
  #
171
223
  # refresh_services: By default all tag services are cached. Setting this value to true
@@ -202,15 +254,44 @@ class Service < ActiveRecord::Base
202
254
  @music_services ||= get_services(refresh_services).find_all{|service| service.service_category.name == 'Music' }
203
255
  end
204
256
 
257
+ # Get all news services
258
+ #
259
+ # refresh_services: By default all tag services are cached. Setting this value to true
260
+ # will result in the values being repopulated from the database
261
+ def self.get_news_services(refresh_services = false)
262
+ @news_services = nil if refresh_services
263
+ @news_services ||= get_services(refresh_services).find_all{|service| service.service_category.name == 'News' }
264
+ end
265
+
266
+ # Get all blog services
267
+ #
268
+ # refresh_services: By default all tag services are cached. Setting this value to true
269
+ # will result in the values being repopulated from the database
270
+ def self.get_blog_services(refresh_services = false)
271
+ @blog_services = nil if refresh_services
272
+ @blog_services ||= get_services(refresh_services).find_all{|service| service.service_category.name == 'Blogging' }
273
+ end
274
+
275
+ # Get all search services
276
+ #
277
+ # refresh_services: By default all tag services are cached. Setting this value to true
278
+ # will result in the values being repopulated from the database
279
+ def self.get_search_services(refresh_services = false)
280
+ @search_services = nil if refresh_services
281
+ @search_services ||= get_services(refresh_services).find_all{|service| service.service_category.name == 'Search' }
282
+ end
283
+
205
284
  # Get all general services. These are all services except photo, video, bookmark and music.
206
285
  #
207
286
  # refresh_services: By default all tag services are cached. Setting this value to true
208
287
  # will result in the values being repopulated from the database
209
288
  def self.get_general_services(refresh_services = false)
210
289
  @general_services = nil if refresh_services
211
- @general_services ||= get_services(refresh_services).find_all{|service| !['Photos', 'Videos', 'Bookmarks', 'Music'].include?(service.service_category.name) }
290
+ @general_services ||= get_services(refresh_services).find_all{|service| !non_general_categories.include?(service.service_category.name) }
212
291
  end
213
-
292
+
293
+
294
+
214
295
  # Get all photo services that are used to generate tag feeds
215
296
  #
216
297
  # refresh_services: By default all tag services are cached. Setting this value to true
@@ -247,15 +328,45 @@ class Service < ActiveRecord::Base
247
328
  @music_services ||= get_tag_services(nil, refresh_services).find_all{|service| service.service_category.name == 'Music' }
248
329
  end
249
330
 
331
+ # Get all news services that are used to generate tag feeds
332
+ #
333
+ # refresh_services: By default all tag services are cached. Setting this value to true
334
+ # will result in the values being repopulated from the database
335
+ def self.get_news_tag_services(refresh_services = false)
336
+ @news_services = nil if refresh_services
337
+ @news_services ||= get_tag_services(nil, refresh_services).find_all{|service| service.service_category.name == 'News' }
338
+ end
339
+
340
+ # Get all blog services that are used to generate tag feeds
341
+ #
342
+ # refresh_services: By default all tag services are cached. Setting this value to true
343
+ # will result in the values being repopulated from the database
344
+ def self.get_blog_tag_services(refresh_services = false)
345
+ @blog_services = nil if refresh_services
346
+ @blog_services ||= get_tag_services(nil, refresh_services).find_all{|service| service.service_category.name == 'Blogging' }
347
+ end
348
+
349
+ # Get all search services that are used to generate tag feeds
350
+ #
351
+ # refresh_services: By default all tag services are cached. Setting this value to true
352
+ # will result in the values being repopulated from the database
353
+ def self.get_search_tag_services(refresh_services = false)
354
+ @search_services = nil if refresh_services
355
+ @search_services ||= get_tag_services(nil, refresh_services).find_all{|service| service.service_category.name == 'Search' }
356
+ end
357
+
250
358
  # Get all general services that are used to generate tag feeds
251
359
  #
252
360
  # refresh_services: By default all tag services are cached. Setting this value to true
253
361
  # will result in the values being repopulated from the database
254
362
  def self.get_general_tag_services(refresh_services = false)
255
363
  @general_services = nil if refresh_services
256
- @general_services ||= get_tag_services(nil, refresh_services).find_all{|service| !['Photos', 'Videos', 'Bookmarks', 'Music'].include?(service.service_category.name) }
364
+ @general_services ||= get_tag_services(nil, refresh_services).find_all{|service| !non_general_categories.include?(service.service_category.name) }
257
365
  end
258
366
 
367
+
368
+
369
+
259
370
  # Builds tag based feeds for the given term. Feeds are not saved to the database.
260
371
  #
261
372
  # terms: Terms for which to generate feeds. This value can be an array, a single string,
@@ -362,4 +473,8 @@ class Service < ActiveRecord::Base
362
473
  Service.find_by_name('rss') # this will return the default rss service
363
474
  end
364
475
 
476
+ def self.non_general_categories
477
+ ['Photos', 'Videos', 'Bookmarks', 'Music', 'News', 'Blogging', 'Search']
478
+ end
479
+
365
480
  end
@@ -46,25 +46,6 @@
46
46
  }
47
47
  return 'feed.png';
48
48
  }
49
-
50
- function apply_show_content(){
51
- jQuery('.combined-feed-list .feed-item .feed-title').hover(
52
- function () {
53
- jQuery(this).next('.combined-feed-list .feed-item .feed-content').show();
54
- },
55
- function () {
56
- jQuery(this).next('.combined-feed-list .feed-item .feed-content').hide();
57
- }
58
- );
59
- jQuery('.combined-feed-list .feed-item .feed-content').hover(
60
- function () {
61
- jQuery(this).show();
62
- },
63
- function () {
64
- jQuery(this).hide();
65
- }
66
- );
67
- }
68
49
  </script>
69
50
 
70
51
  <div id="<%= content_id %>" class="combined-feed">
@@ -0,0 +1,19 @@
1
+ <% if entry.feed.service.video? -%>
2
+ <% link = Nokogiri::HTML(entry.content).css('a').detect{ |link| !link.css('img').blank? } -%>
3
+ <% link.to_s.gsub('<a', 'class="feed-video" rel="video_' + content_id) if link -%>
4
+ <%= link %>
5
+ <% elsif entry.feed.service.photo? -%>
6
+ <% link = Nokogiri::HTML(entry.content).css('a').detect{ |link| !link.css('img').blank? } -%>
7
+ <% link.to_s.gsub('<a', 'class="feed-photo" rel="photo_' + content_id) if link -%>
8
+ <%= link %>
9
+ <% elsif entry.feed.service.bookmark? -%>
10
+ <div class="hentry <%= cycle("even", "odd") -%>"><h4 class="title"><a class="bookmark-link" href="<%= entry.permalink %>" target="_blank"><%= entry.title %></a></h4></div>
11
+ <% else -%>
12
+ <div class="hentry <%= cycle("even", "odd") -%>">
13
+ <h4 class="title"><a class="entry-link" href="#" target="blank"><%= entry.title %></a><span class="entry-close"><a class="entry-link-close" href="#"><%= t('muck.raker.close') %></a></span></h4>
14
+ <div class="entry">
15
+ <%= entry.content %>
16
+ <p><a href="<%= entry.permalink %>"><%= t('muck.raker.read_more') %></a></p>
17
+ </div>
18
+ </div>
19
+ <% end -%>
@@ -0,0 +1,24 @@
1
+ <% content_id ||= feed_content_id(feed) -%>
2
+ <div class="feed">
3
+ <div class="feed-header">
4
+ <h3 <%= service_icon_background(feed.service) %>>
5
+ <%= link_to "#{feed.title.humanize}", feed.display_uri, :target => 'blank' %>
6
+ <%= link_to "(rss)", feed.uri, :target => 'blank' %>
7
+ <% if defined?(show_controls) && show_controls -%>
8
+ <span class="remove-feed feed-control">
9
+ <%= link_to t('muck.raker.remove'), aggregation_feed_path(0, :aggregation_id => @aggregation.id, :feed_id => feed.id), :class => 'delete-link' %>
10
+ </span>
11
+ <% if use_uri_for_control -%>
12
+ <%= hidden_field_tag "uris[]", feed.uri -%>
13
+ <% else -%>
14
+ <%= hidden_field_tag "service_ids[]", feed.service.id -%>
15
+ <% end -%>
16
+ <% end -%>
17
+ </h3>
18
+ </div>
19
+ <div class="feed-content">
20
+ <div id="<%= content_id %>" class="feed-item <%= feed_class(feed) %>">
21
+ <%= render :partial => 'topics/entry', :collection => feed.entries, :locals => { :content_id => content_id } %>
22
+ </div>
23
+ </div>
24
+ </div>
@@ -0,0 +1,7 @@
1
+ <li class="feed-item" <%= service_icon_background(simple_entry.feed.service) %>>
2
+ <div class="feed-title"><a href="<%= simple_entry.permalink %>" target="_blank"><%= h simple_entry.title %></a></div>
3
+ <div class="feed-content" style="display:none;">
4
+ <h3><a href="<%= simple_entry.permalink %>" target="_blank"><%= h simple_entry.title %></a></h3>
5
+ <%= simple_entry.content %>
6
+ </div>
7
+ </li>
@@ -22,7 +22,20 @@
22
22
  </div>
23
23
  <% end -%>
24
24
 
25
- <% if @show_combined -%>
25
+ <% if @load_feeds_on_server -%>
26
+ <% if @show_combined -%>
27
+ <ul class="combined-feed-list">
28
+ <%= render :partial => 'topics/simple_entry', :collection => @server_loaded_data_feeds %>
29
+ </ul>
30
+ <script type="text/javascript">
31
+ jQuery(document).ready(function() {
32
+ apply_show_entry_content();
33
+ });
34
+ </script>
35
+ <% else -%>
36
+ <%= render :partial => 'topics/feed', :collection => @server_loaded_general_feeds %>
37
+ <% end -%>
38
+ <% elsif @show_combined -%>
26
39
  <%= google_combined_feeds(@general_feeds + @discovered_feeds) %>
27
40
  <% else -%>
28
41
  <div id="calculated-feeds">
data/muck-raker.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muck-raker}
8
- s.version = "0.1.45"
8
+ s.version = "0.1.46"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joel Duffin Justin Ball"]
12
- s.date = %q{2009-10-22}
12
+ s.date = %q{2009-10-23}
13
13
  s.description = %q{The aggregation and recommendation engine for the muck system.}
14
14
  s.email = %q{justinball@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -325,9 +325,12 @@ Gem::Specification.new do |s|
325
325
  "app/views/services/_new_service.html.erb",
326
326
  "app/views/services/_summary.html.erb",
327
327
  "app/views/services/_view_service.html.erb",
328
+ "app/views/topics/_entry.html.erb",
329
+ "app/views/topics/_feed.html.erb",
328
330
  "app/views/topics/_feed_preview.html.erb",
329
331
  "app/views/topics/_form.html.erb",
330
332
  "app/views/topics/_rss_discover.html.erb",
333
+ "app/views/topics/_simple_entry.html.erb",
331
334
  "app/views/topics/new.html.erb",
332
335
  "app/views/topics/photos.html.erb",
333
336
  "app/views/topics/show.html.erb",
@@ -1,3 +1,22 @@
1
+ function apply_show_entry_content(){
2
+ jQuery('.combined-feed-list .feed-item .feed-title').hover(
3
+ function () {
4
+ jQuery(this).next('.combined-feed-list .feed-item .feed-content').show();
5
+ },
6
+ function () {
7
+ jQuery(this).next('.combined-feed-list .feed-item .feed-content').hide();
8
+ }
9
+ );
10
+ jQuery('.combined-feed-list .feed-item .feed-content').hover(
11
+ function () {
12
+ jQuery(this).show();
13
+ },
14
+ function () {
15
+ jQuery(this).hide();
16
+ }
17
+ );
18
+ }
19
+
1
20
  function show_tool(tool) {
2
21
  jQuery('.tool').hide();
3
22
  jQuery("#content_iframe").width('75%');
@@ -23,6 +23,7 @@
23
23
  jquery/jquery.easing.js
24
24
  jquery/jquery.fancybox.js
25
25
  muck.js
26
+ muck_raker.js
26
27
  application.js }, :cache => 'all_js_cached' %>
27
28
  <%= javascript_tag %[var AUTH_TOKEN = #{form_authenticity_token.inspect};] if protect_against_forgery? %>
28
29
  <%= yield :head -%>
@@ -1,3 +1,22 @@
1
+ function apply_show_entry_content(){
2
+ jQuery('.combined-feed-list .feed-item .feed-title').hover(
3
+ function () {
4
+ jQuery(this).next('.combined-feed-list .feed-item .feed-content').show();
5
+ },
6
+ function () {
7
+ jQuery(this).next('.combined-feed-list .feed-item .feed-content').hide();
8
+ }
9
+ );
10
+ jQuery('.combined-feed-list .feed-item .feed-content').hover(
11
+ function () {
12
+ jQuery(this).show();
13
+ },
14
+ function () {
15
+ jQuery(this).hide();
16
+ }
17
+ );
18
+ }
19
+
1
20
  function show_tool(tool) {
2
21
  jQuery('.tool').hide();
3
22
  jQuery("#content_iframe").width('75%');
@@ -43,6 +43,15 @@ class GoogleFeedRequestTest < ActiveSupport::TestCase
43
43
  end
44
44
  end
45
45
 
46
+ context "load an array of feeds" do
47
+ setup do
48
+ @feeds = [ Factory(:feed, :uri => 'http://www.justinball.com/feed'), Factory(:feed, :uri => 'http://www.engadget.com/rss.xml'), Factory(:feed, :uri => 'http://www.example.com') ]
49
+ end
50
+ should "load feeds" do
51
+ @feeds = GoogleFeedRequest.load_feeds(@feeds)
52
+ assert @feeds.entries.length > 0
53
+ end
54
+ end
46
55
  end
47
56
 
48
57
  end
@@ -68,6 +68,36 @@ class ServiceTest < ActiveSupport::TestCase
68
68
  end
69
69
  end
70
70
 
71
+ context "news" do
72
+ setup do
73
+ service_category = Factory(:service_category, :name => 'News')
74
+ @service = Factory(:service, :service_category_id => service_category.id)
75
+ end
76
+ should "be a news service" do
77
+ assert @service.news?(true)
78
+ end
79
+ end
80
+
81
+ context "blog" do
82
+ setup do
83
+ service_category = Factory(:service_category, :name => 'Blogging')
84
+ @service = Factory(:service, :service_category_id => service_category.id)
85
+ end
86
+ should "be a blog service" do
87
+ assert @service.blog?(true)
88
+ end
89
+ end
90
+
91
+ context "search" do
92
+ setup do
93
+ service_category = Factory(:service_category, :name => 'Search')
94
+ @service = Factory(:service, :service_category_id => service_category.id)
95
+ end
96
+ should "be a search service" do
97
+ assert @service.search?(true)
98
+ end
99
+ end
100
+
71
101
  context "general" do
72
102
  setup do
73
103
  service_category = Factory(:service_category, :name => 'RSS')
@@ -228,6 +258,33 @@ class ServiceTest < ActiveSupport::TestCase
228
258
  assert @feeds.all? { |feed| feed.service.service_category.name == "Music" }
229
259
  end
230
260
  end
261
+ context "news feeds" do
262
+ setup do
263
+ @feeds = Service.build_news_feeds(@terms, @user.id, nil, true) # We build the news service above so we have to force a cache refresh
264
+ end
265
+ should "only create news feeds" do
266
+ assert @feeds.length > 0
267
+ assert @feeds.all? { |feed| feed.service.service_category.name == "News" }
268
+ end
269
+ end
270
+ context "blog feeds" do
271
+ setup do
272
+ @feeds = Service.build_blog_feeds(@terms, @user.id, nil, true) # We build the blog service above so we have to force a cache refresh
273
+ end
274
+ should "only create blog feeds" do
275
+ assert @feeds.length > 0
276
+ assert @feeds.all? { |feed| feed.service.service_category.name == "Blogging" }
277
+ end
278
+ end
279
+ context "search feeds" do
280
+ setup do
281
+ @feeds = Service.build_search_feeds(@terms, @user.id, nil, true) # We build the search service above so we have to force a cache refresh
282
+ end
283
+ should "only create search feeds" do
284
+ assert @feeds.length > 0
285
+ assert @feeds.all? { |feed| feed.service.service_category.name == "Search" }
286
+ end
287
+ end
231
288
  end
232
289
 
233
290
  context "service types" do
@@ -250,6 +307,18 @@ class ServiceTest < ActiveSupport::TestCase
250
307
  assert Service.get_music_tag_services(true).length > 0
251
308
  assert Service.get_music_tag_services.all? { |service| service.service_category.name == "Music" }
252
309
  end
310
+ should "get news services" do
311
+ assert Service.get_news_tag_services(true).length > 0
312
+ assert Service.get_news_tag_services.all? { |service| service.service_category.name == "News" }
313
+ end
314
+ should "get blog services" do
315
+ assert Service.get_blog_tag_services(true).length > 0
316
+ assert Service.get_blog_tag_services.all? { |service| service.service_category.name == "Blogging" }
317
+ end
318
+ should "get search services" do
319
+ assert Service.get_search_tag_services(true).length > 0
320
+ assert Service.get_search_tag_services.all? { |service| service.service_category.name == "Search" }
321
+ end
253
322
  should "get general services" do
254
323
  assert Service.get_general_tag_services(true).length > 0
255
324
  assert !Service.get_general_tag_services.any? { |service| service.service_category.name == "Photos" }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muck-raker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.45
4
+ version: 0.1.46
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Duffin Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-22 00:00:00 -06:00
12
+ date: 2009-10-23 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -430,9 +430,12 @@ files:
430
430
  - app/views/services/_new_service.html.erb
431
431
  - app/views/services/_summary.html.erb
432
432
  - app/views/services/_view_service.html.erb
433
+ - app/views/topics/_entry.html.erb
434
+ - app/views/topics/_feed.html.erb
433
435
  - app/views/topics/_feed_preview.html.erb
434
436
  - app/views/topics/_form.html.erb
435
437
  - app/views/topics/_rss_discover.html.erb
438
+ - app/views/topics/_simple_entry.html.erb
436
439
  - app/views/topics/new.html.erb
437
440
  - app/views/topics/photos.html.erb
438
441
  - app/views/topics/show.html.erb