muck-raker 0.1.21 → 0.1.22

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. data/README.rdoc +14 -0
  2. data/Rakefile +2 -0
  3. data/VERSION +1 -1
  4. data/app/controllers/admin/muck/feeds_controller.rb +23 -157
  5. data/app/controllers/muck/entries_controller.rb +7 -7
  6. data/app/controllers/muck/feeds_controller.rb +1 -1
  7. data/app/controllers/muck/recommendations_controller.rb +20 -16
  8. data/app/controllers/muck/visits_controller.rb +20 -0
  9. data/app/helpers/muck_raker_helper.rb +5 -1
  10. data/app/models/click.rb +8 -0
  11. data/app/models/entry.rb +39 -9
  12. data/app/models/feed.rb +89 -25
  13. data/app/models/feed_parent.rb +5 -0
  14. data/app/models/recommendation.rb +5 -0
  15. data/app/models/tag_cloud.rb +4 -0
  16. data/app/views/admin/feeds/index.html.erb +29 -59
  17. data/app/views/entries/_related_entry.html.erb +1 -1
  18. data/app/views/entries/_result.html.erb +1 -1
  19. data/app/views/feeds/_feed.html.erb +14 -1
  20. data/app/views/feeds/edit.html.erb +1 -1
  21. data/app/views/parts/_add_feed.html.erb +4 -4
  22. data/app/views/recommendations/index.pjs.erb +8 -8
  23. data/app/views/recommendations/index.rss.builder +3 -3
  24. data/app/views/recommendations/index.xml.builder +8 -8
  25. data/app/views/recommendations/index_js.pjs.erb +4 -0
  26. data/app/views/recommendations/index_real_time.pjs.erb +44 -0
  27. data/app/views/recommendations/index_real_time.xml.builder +26 -0
  28. data/app/views/visits/show.html.erb +156 -0
  29. data/config/muck_raker_routes.rb +19 -15
  30. data/db/bootstrap/services.yml +23 -23
  31. data/db/migrate/20090602191243_create_muck_raker.rb +2 -2
  32. data/db/migrate/20090728165716_add_etag_to_feeds.rb +9 -0
  33. data/db/migrate/20090730045848_add_comment_cache_to_entries.rb +9 -0
  34. data/db/migrate/20090804211240_add_entry_id_to_shares.rb +9 -0
  35. data/lib/muck_raker/tasks.rb +21 -24
  36. data/locales/en.yml +18 -1
  37. data/muck-raker.gemspec +82 -6
  38. data/raker/lib/recommenderd.jar +0 -0
  39. data/test/feed_archive/http---www-oercommons-org-oai-verb-ListRecords-metadataPrefix-oer_recommender-set-collection-american-physical-society/1248886128173.xml +56 -0
  40. data/test/feed_archive/http---www-oercommons-org-oai-verb-ListRecords-metadataPrefix-oer_recommender-set-collection-arizona-state-university/1248886130492.xml +49 -0
  41. data/test/feed_archive/http---www-oercommons-org-oai-verb-ListRecords-metadataPrefix-oer_recommender-set-collection-aspire/1248886130883.xml +192 -0
  42. data/test/rails_root/Rakefile +3 -0
  43. data/test/rails_root/app/controllers/application_controller.rb +10 -1
  44. data/test/rails_root/app/models/activity.rb +3 -0
  45. data/test/rails_root/app/models/comment.rb +3 -0
  46. data/test/rails_root/app/models/share.rb +4 -0
  47. data/test/rails_root/app/models/user.rb +5 -0
  48. data/test/rails_root/app/views/default/index.html.erb +2 -0
  49. data/test/rails_root/app/views/layouts/frame.html.erb +35 -0
  50. data/test/rails_root/config/database.yml +4 -2
  51. data/test/rails_root/config/environment.rb +3 -0
  52. data/test/rails_root/config/environments/cucumber.rb +21 -0
  53. data/test/rails_root/config/global_config.yml +2 -0
  54. data/test/rails_root/config/routes.rb +1 -1
  55. data/test/rails_root/db/bootstrap/attention.yml +6 -0
  56. data/test/rails_root/db/bootstrap/feeds.yml +4268 -0
  57. data/test/rails_root/db/bootstrap/oai_endpoints.yml +6 -0
  58. data/test/rails_root/db/bootstrap/services.yml +172 -0
  59. data/test/rails_root/db/migrate/20090402033319_add_muck_activities.rb +36 -0
  60. data/test/rails_root/db/migrate/20090602191243_create_muck_raker.rb +2 -2
  61. data/test/rails_root/db/migrate/20090613173314_create_comments.rb +24 -0
  62. data/test/rails_root/db/migrate/20090728165716_add_etag_to_feeds.rb +9 -0
  63. data/test/rails_root/db/migrate/20090730044139_add_comment_cache.rb +9 -0
  64. data/test/rails_root/db/migrate/20090730045848_add_comment_cache_to_entries.rb +9 -0
  65. data/test/rails_root/db/migrate/20090730154102_allow_null_user.rb +9 -0
  66. data/test/rails_root/db/migrate/20090803185323_create_shares.rb +18 -0
  67. data/test/rails_root/db/migrate/20090804211240_add_entry_id_to_shares.rb.rb +9 -0
  68. data/test/rails_root/features/feeds.feature +13 -0
  69. data/test/rails_root/features/step_definitions/common_steps.rb +93 -0
  70. data/test/rails_root/features/step_definitions/visit_steps.rb +6 -0
  71. data/test/rails_root/features/step_definitions/webrat_steps.rb +52 -23
  72. data/test/rails_root/features/support/paths.rb +36 -0
  73. data/test/rails_root/features/visit.feature +10 -0
  74. data/test/rails_root/lib/tasks/cucumber.rake +20 -0
  75. data/test/rails_root/public/images/icons/blue_guy.png +0 -0
  76. data/test/rails_root/public/images/icons/cancel.png +0 -0
  77. data/test/rails_root/public/images/icons/close.png +0 -0
  78. data/test/rails_root/public/images/icons/delete.png +0 -0
  79. data/test/rails_root/public/images/icons/exclaim.png +0 -0
  80. data/test/rails_root/public/images/icons/grey_guy.png +0 -0
  81. data/test/rails_root/public/images/icons/hide.png +0 -0
  82. data/test/rails_root/public/images/icons/information.png +0 -0
  83. data/test/rails_root/public/images/icons/minus.png +0 -0
  84. data/test/rails_root/public/images/icons/question.png +0 -0
  85. data/test/rails_root/public/images/icons/search_box.png +0 -0
  86. data/test/rails_root/public/images/icons/star.png +0 -0
  87. data/test/rails_root/public/images/icons/stop.png +0 -0
  88. data/test/rails_root/public/images/icons/thumb_down.png +0 -0
  89. data/test/rails_root/public/images/icons/thumb_up.png +0 -0
  90. data/test/rails_root/public/images/icons/vote.png +0 -0
  91. data/test/rails_root/public/javascripts/jquery/jrails.js +1 -0
  92. data/test/rails_root/public/javascripts/muck.js +15 -1
  93. data/test/rails_root/public/javascripts/muck_activities.js +1 -1
  94. data/test/rails_root/public/stylesheets/application.css +49 -1
  95. data/test/rails_root/public/stylesheets/styles.css +2 -1
  96. data/test/rails_root/script/cucumber +2 -1
  97. data/test/rails_root/test/functional/admin/feeds_controller_test.rb +37 -0
  98. data/test/rails_root/test/functional/feed_previews_controller_test.rb +1 -1
  99. data/test/rails_root/test/functional/visits_controller_test.rb +21 -0
  100. data/test/rails_root/test/test_helper.rb +2 -1
  101. data/test/rails_root/test/unit/entry_test.rb +12 -0
  102. data/test/rails_root/test/unit/feed_parent_test.rb +17 -0
  103. data/test/rails_root/test/unit/feed_test.rb +42 -3
  104. data/test/rails_root/test/unit/tag_cloud_test.rb +4 -0
  105. metadata +89 -4
  106. data/app/models/language.rb +0 -16
  107. data/app/views/recommendations/document_not_found.html.erb +0 -13
@@ -0,0 +1,6 @@
1
+ oer_commons:
2
+ uri: 'http://www.oercommons.org/oai'
3
+ display_uri: 'http://www.oercommons.org'
4
+ metadata_prefix: 'oer_recommender'
5
+ title: 'OER Commons - Open Educational Resources'
6
+ short_title: 'OERC'
@@ -0,0 +1,172 @@
1
+ rss:
2
+ id: 1
3
+ name: rss
4
+ uri:
5
+ api_uri:
6
+ uri_template:
7
+ icon: rss-atom.gif
8
+ sequence: 1
9
+ oai:
10
+ id: 2
11
+ name: OAI
12
+ uri:
13
+ api_uri:
14
+ uri_template:
15
+ icon: oai.gif
16
+ sequence: 2
17
+ twitter:
18
+ id: 3
19
+ name: Twitter
20
+ uri: "http://www.twitter.com"
21
+ api_uri:
22
+ uri_template:
23
+ icon: twitter.gif
24
+ sequence: 3
25
+ youtube:
26
+ id: 4
27
+ name: You Tube
28
+ uri: "http://www.youtube.com"
29
+ api_uri:
30
+ uri_template: feed://www.youtube.com/rss/user/{username}/videos.rss
31
+ icon: youtube.gif
32
+ sequence: 4
33
+ flickr:
34
+ id: 5
35
+ name: Flickr
36
+ uri: "http://www.flickr.com"
37
+ api_uri:
38
+ uri_template: "http://api.flickr.com/services/feeds/activity.gne?id={username}"
39
+ icon: flickr.gif
40
+ sequence: 5
41
+ delicious:
42
+ id: 6
43
+ name: del.icio.us
44
+ uri: "http://del.icio.us/"
45
+ api_uri: "https://api.del.icio.us/v1/"
46
+ uri_template:
47
+ icon: delicious.gif
48
+ sequence: 6
49
+ digg:
50
+ id: 7
51
+ name: Digg
52
+ uri: "http://www.digg.com"
53
+ api_uri:
54
+ uri_template: "http://digg.com/rss/{username}/index2.xml"
55
+ icon: digg.gif
56
+ sequence: 7
57
+ 43places:
58
+ id: 8
59
+ name: 43 Places
60
+ uri: "http://www.43places.com"
61
+ api_uri:
62
+ uri_template: "http://www.43places.com/rss/uber/author?username={username}"
63
+ icon: 43places.gif
64
+ sequence: 8
65
+ allconsuming:
66
+ id: 9
67
+ name: All Consuming
68
+ uri: "http://allconsuming.net/"
69
+ api_uri:
70
+ uri_template: "http://allconsuming.net/person/{username}/rss"
71
+ icon: allconsuming.gif
72
+ sequence: 9
73
+ clipmarks:
74
+ id: 10
75
+ sequence: 10
76
+ name: Clipmarks
77
+ uri: "http://www.clipmarks.com"
78
+ api_uri:
79
+ uri_template: "http://rss.clipmarks.com/clipper/{username}/"
80
+ icon: clipmarks.gif
81
+ lastfm:
82
+ id: 11
83
+ sequence: 11
84
+ name: Last.fm
85
+ uri: "http://www.last.fm"
86
+ api_uri:
87
+ uri_template: "http://ws.audioscrobbler.com/1.0/user/{username}/recenttracks.rss"
88
+ icon: lastfm.gif
89
+ livejournal:
90
+ id: 12
91
+ sequence: 12
92
+ name: LiveJournal
93
+ uri: "http://www.livejournal.com"
94
+ api_uri:
95
+ uri_template: "http://{username}.livejournal.com"
96
+ icon: livejournal.gif
97
+ simpy:
98
+ id: 13
99
+ sequence: 13
100
+ name: Simpy
101
+ uri: "http://www.simpy.com"
102
+ api_uri:
103
+ uri_template: "http://www.simpy.com/rss/user/{username}/links/"
104
+ icon: simpy.gif
105
+ wordpress:
106
+ id: 14
107
+ sequence: 14
108
+ name: Wordpress.com
109
+ uri: "http://www.wordpress.com/"
110
+ api_uri:
111
+ uri_template: "http://{username}.wordpress.com/"
112
+ icon: wordpress.gif
113
+ xanga:
114
+ id: 15
115
+ sequence: 15
116
+ name: Xanga
117
+ uri: "http://www.xanga.com"
118
+ api_uri:
119
+ uri_template: "http://www.xanga.com/{username}/rss"
120
+ icon: xanga.gif
121
+ citeulike:
122
+ id: 16
123
+ sequence: 16
124
+ name: cite u like
125
+ uri: "http://www.citeulike.org"
126
+ api_uri:
127
+ uri_template: "http://www.citeulike.org/rss/user/{username}"
128
+ icon: citeulike.gif
129
+ googlenews:
130
+ id: 17
131
+ sequence: 17
132
+ name: Google News
133
+ uri: "http://news.google.com/"
134
+ icon: googlenews.gif
135
+ googleblogsearch:
136
+ id: 18
137
+ sequence: 18
138
+ name: Google Blog Search
139
+ uri: "http://blogsearch.google.com/"
140
+ icon: googleblogs.gif
141
+ opml:
142
+ id: 19
143
+ sequence: 19
144
+ name: OPML
145
+ icon: opml.gif
146
+ tag:
147
+ id: 20
148
+ sequence: 20
149
+ name: Tag
150
+ icon: tag.gif
151
+ odeo:
152
+ id: 21
153
+ sequence: 21
154
+ name: Odeo Podcasts
155
+ uri: "http://www.odeo.com"
156
+ icon: odeo.gif
157
+ technorati:
158
+ id: 22
159
+ sequence: 22
160
+ name: Technorati
161
+ uri: "http://www.technorati.com/"
162
+ api_uri:
163
+ uri_template: "http://feeds.technorati.com/faves/{username}?format=rss"
164
+ icon: technorati.gif
165
+ merlot:
166
+ id: 23
167
+ sequence: 23
168
+ name: Merlot
169
+ uri: "http://www.merlot.org/"
170
+ api_uri:
171
+ uri_template:
172
+ icon: merlot.gif
@@ -0,0 +1,36 @@
1
+ class AddMuckActivities < ActiveRecord::Migration
2
+
3
+ def self.up
4
+
5
+ create_table :activities, :force => true do |t|
6
+ t.integer :item_id
7
+ t.string :item_type
8
+ t.string :template
9
+ t.integer :source_id
10
+ t.string :source_type
11
+ t.text :content
12
+ t.string :title
13
+ t.boolean :is_status_update, :default => false
14
+ t.boolean :is_public, :default => true
15
+ t.timestamps
16
+ end
17
+
18
+ add_index :activities, ["item_id", "item_type"]
19
+
20
+ create_table :activity_feeds, :force => true do |t|
21
+ t.integer :activity_id
22
+ t.integer :ownable_id
23
+ t.string :ownable_type
24
+ end
25
+
26
+ add_index :activity_feeds, ["activity_id"]
27
+ add_index :activity_feeds, ["ownable_id", "ownable_type"]
28
+
29
+ end
30
+
31
+ def self.down
32
+ drop_table :activities
33
+ drop_table :activity_feeds
34
+ end
35
+
36
+ end
@@ -112,8 +112,8 @@ class CreateMuckRaker < ActiveRecord::Migration
112
112
  t.text "top_tags"
113
113
  t.integer "priority", :default => 10
114
114
  t.integer "status", :default => 1
115
- t.datetime "last_requested_at"
116
- t.datetime "last_harvested_at"
115
+ t.datetime "last_requested_at", :default => '1969-01-01 00:00:00'
116
+ t.datetime "last_harvested_at", :default => '1969-01-01 00:00:00'
117
117
  t.integer "harvest_interval", :default => 86400
118
118
  t.integer "failed_requests", :default => 0
119
119
  t.text "error_message"
@@ -0,0 +1,24 @@
1
+ class CreateComments < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :comments, :force => true do |t|
4
+ t.integer :commentable_id, :default => 0
5
+ t.string :commentable_type, :limit => 15, :default => ""
6
+ t.text :body
7
+ t.integer :user_id, :default => 0, :null => false
8
+ t.integer :parent_id
9
+ t.integer :lft
10
+ t.integer :rgt
11
+ t.integer :is_denied, :default => 0, :null => false
12
+ t.boolean :is_reviewed, :default => false
13
+ t.timestamps
14
+ end
15
+
16
+ add_index :comments, ["user_id"]
17
+ add_index :comments, ["commentable_id", "commentable_type"]
18
+
19
+ end
20
+
21
+ def self.down
22
+ drop_table :comments
23
+ end
24
+ end
@@ -0,0 +1,9 @@
1
+ class AddEtagToFeeds < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :feeds, :etag, :string
4
+ end
5
+
6
+ def self.down
7
+ remove_column :feeds, :etag
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddCommentCache < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :activities, :comment_count, :integer, :default => 0
4
+ end
5
+
6
+ def self.down
7
+ remove_column :activities, :comment_count
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AddCommentCacheToEntries < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :entries, :comment_count, :integer, :default => 0
4
+ end
5
+
6
+ def self.down
7
+ remove_column :entries, :comment_count
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ class AllowNullUser < ActiveRecord::Migration
2
+ def self.up
3
+ change_column :comments, :user_id, :integer, :null => true, :default => nil
4
+ end
5
+
6
+ def self.down
7
+ change_column :comments, :user_id, :integer, :null => false, :default => 0
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ class CreateShares < ActiveRecord::Migration
2
+ def self.up
3
+ create_table :shares, :force => true do |t|
4
+ t.string :uri, :limit => 2083, :default => "", :null => false
5
+ t.string :title
6
+ t.text :message
7
+ t.integer :shared_by_id, :null => false
8
+ t.integer :shared_to_id
9
+ t.timestamps
10
+ end
11
+ add_index :shares, :shared_by_id
12
+ add_index :shares, :shared_to_id
13
+ end
14
+
15
+ def self.down
16
+ drop_table :shares
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ class AddEntryIdToShares < ActiveRecord::Migration
2
+ def self.up
3
+ add_column :shares, :entry_id, :integer
4
+ end
5
+
6
+ def self.down
7
+ remove_column :shares, :entry_id
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ Feature: View, add and edit feeds
2
+ As a user
3
+ I want to be able to manage feeds
4
+
5
+ Scenario: Anonymous user visits the feeds index page
6
+ Given I am not logged in
7
+ When I go to "the public feed index"
8
+ Then I should see "Registered Collections"
9
+
10
+ Scenario: Admin user visits a page that does not exist and is prompted to create a new page
11
+ Given I log in with role "administrator"
12
+ When I go to "the feed admin page"
13
+ Then I should see "Registered Collections"
@@ -0,0 +1,93 @@
1
+ PASSWORD = "asdfasdf"
2
+
3
+ def log_in_user(user, password)
4
+ visit(login_url)
5
+ fill_in("user_session_login", :with => user.login)
6
+ fill_in("user_session_password", :with => PASSWORD)
7
+ click_button("Sign In")
8
+ end
9
+
10
+ def log_in_with_login_and_role(login, role)
11
+ @user = Factory(:user, :login => login, :password => PASSWORD, :password_confirmation => PASSWORD)
12
+ @user.add_to_role(role)
13
+ log_in_user(@user, PASSWORD)
14
+ end
15
+
16
+ def log_in_with_role(role)
17
+ @user = Factory(:user, :password => PASSWORD, :password_confirmation => PASSWORD)
18
+ @user.add_to_role(role)
19
+ log_in_user(@user, PASSWORD)
20
+ end
21
+
22
+
23
+ Before do
24
+ ActionMailer::Base.deliveries = []
25
+ end
26
+
27
+
28
+ # Assumes password is 'asdfasdf'
29
+ Given /I log in as "(.*)"/ do |login|
30
+ @user = User.find_by_login(login)
31
+ log_in_user(@user, PASSWORD)
32
+ end
33
+
34
+ Given /I log in as new user "(.*)" with password "(.*)"/ do |login, password|
35
+ @user = Factory(:user, :login => login, :password => password, :password_confirmation => password)
36
+ log_in_user(@user, password)
37
+ end
38
+
39
+ Given /I log in as new user/ do
40
+ @user = Factory(:user, :password => PASSWORD, :password_confirmation => PASSWORD)
41
+ log_in_user(@user, PASSWORD)
42
+ end
43
+
44
+ Given /^I log in with role "(.*)"$/ do |role|
45
+ log_in_with_role(role)
46
+ end
47
+
48
+ Given /^I am not logged in$/ do
49
+ post '/logout'
50
+ end
51
+
52
+ Then /^I should see the login$/ do
53
+ response.body.should =~ /sign_in/m
54
+ response.body.should =~ /user_session_login/m
55
+ response.body.should =~ /user_session_password/m
56
+ end
57
+
58
+
59
+ #features/step_definitions/common_steps.rb
60
+ # On page/record
61
+ Given /^I am on "([^"]*)"$/ do |path|
62
+ visit path
63
+ end
64
+
65
+ Then /^I should be on "([^"]*)"$/ do |path|
66
+ current_path.should == path
67
+ end
68
+
69
+ Given /^I am on "([^"]*)" "([^"]*)"$/ do |model,number|
70
+ visit polymorphic_path(record_from_strings(model,number))
71
+ end
72
+
73
+ Then /^I should be on "([^"]*)" "([^"]*)"$/ do |model,number|
74
+ current_path.should == polymorphic_path(record_from_strings(model,number))
75
+ end
76
+
77
+ # Existing
78
+ Given /^a "([^"]*)" exists for "([^"]*)" "([^"]*)"$/ do |associated,model,number|
79
+ record = record_from_strings(model,number)
80
+ record.send(associated.underscore+'=',valid(associated))
81
+ record.save!
82
+ end
83
+
84
+ # Support
85
+ def current_path
86
+ response.request.request_uri
87
+ end
88
+
89
+ def record_from_strings(model,number)
90
+ model.constantize.find(:first,:offset=>number.to_i-1)
91
+ end
92
+
93
+
@@ -0,0 +1,6 @@
1
+ Given /^There is an entry in the database$/ do
2
+ entry = Entry.first
3
+ if entry.nil?
4
+ entry = Factory(:entry)
5
+ end
6
+ end