news_feed 0.0.1

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.
Files changed (59) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.rdoc +3 -0
  3. data/Rakefile +38 -0
  4. data/config/locales/en_news_feed.yml +7 -0
  5. data/lib/app/model/news_feed_event.rb +7 -0
  6. data/lib/generators/news_feed/news_feed_generator.rb +19 -0
  7. data/lib/news_feed/acts_as_news_feedable.rb +72 -0
  8. data/lib/news_feed/news_feed_events.rb +30 -0
  9. data/lib/news_feed/version.rb +3 -0
  10. data/lib/news_feed.rb +6 -0
  11. data/lib/tasks/news_feed_tasks.rake +4 -0
  12. data/test/dummy/README.rdoc +261 -0
  13. data/test/dummy/Rakefile +7 -0
  14. data/test/dummy/app/assets/javascripts/application.js +15 -0
  15. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  16. data/test/dummy/app/controllers/application_controller.rb +3 -0
  17. data/test/dummy/app/helpers/application_helper.rb +2 -0
  18. data/test/dummy/app/models/message.rb +3 -0
  19. data/test/dummy/app/models/user.rb +3 -0
  20. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  21. data/test/dummy/config/application.rb +56 -0
  22. data/test/dummy/config/boot.rb +10 -0
  23. data/test/dummy/config/database.yml +25 -0
  24. data/test/dummy/config/environment.rb +5 -0
  25. data/test/dummy/config/environments/development.rb +37 -0
  26. data/test/dummy/config/environments/production.rb +67 -0
  27. data/test/dummy/config/environments/test.rb +37 -0
  28. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  29. data/test/dummy/config/initializers/inflections.rb +15 -0
  30. data/test/dummy/config/initializers/mime_types.rb +5 -0
  31. data/test/dummy/config/initializers/secret_token.rb +7 -0
  32. data/test/dummy/config/initializers/session_store.rb +8 -0
  33. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  34. data/test/dummy/config/locales/en_news_feed.yml +7 -0
  35. data/test/dummy/config/routes.rb +58 -0
  36. data/test/dummy/config.ru +4 -0
  37. data/test/dummy/db/development.sqlite3 +0 -0
  38. data/test/dummy/db/migrate/20120806195421_create_users.rb +8 -0
  39. data/test/dummy/db/migrate/20120806213224_create_news_feed.rb +16 -0
  40. data/test/dummy/db/migrate/20120806220426_create_messages.rb +8 -0
  41. data/test/dummy/db/migrate/20120807021300_insert_news_feed_events.rb +21 -0
  42. data/test/dummy/db/schema.rb +48 -0
  43. data/test/dummy/db/test.sqlite3 +0 -0
  44. data/test/dummy/log/development.log +194 -0
  45. data/test/dummy/log/test.log +2394 -0
  46. data/test/dummy/public/404.html +26 -0
  47. data/test/dummy/public/422.html +26 -0
  48. data/test/dummy/public/500.html +25 -0
  49. data/test/dummy/public/favicon.ico +0 -0
  50. data/test/dummy/script/rails +6 -0
  51. data/test/dummy/test/fixtures/messages.yml +11 -0
  52. data/test/dummy/test/fixtures/users.yml +11 -0
  53. data/test/dummy/test/support/locales/en_news_feed.yml +7 -0
  54. data/test/dummy/test/unit/messages_test.rb +7 -0
  55. data/test/dummy/test/unit/user_test.rb +7 -0
  56. data/test/generators/install_generator_test.rb +13 -0
  57. data/test/news_feed_test.rb +56 -0
  58. data/test/test_helper.rb +20 -0
  59. metadata +215 -0
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The page you were looking for doesn't exist (404)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/404.html -->
21
+ <div class="dialog">
22
+ <h1>The page you were looking for doesn't exist.</h1>
23
+ <p>You may have mistyped the address or the page may have moved.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,26 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>The change you wanted was rejected (422)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/422.html -->
21
+ <div class="dialog">
22
+ <h1>The change you wanted was rejected.</h1>
23
+ <p>Maybe you tried to change something you didn't have access to.</p>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,25 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>We're sorry, but something went wrong (500)</title>
5
+ <style type="text/css">
6
+ body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
7
+ div.dialog {
8
+ width: 25em;
9
+ padding: 0 4em;
10
+ margin: 4em auto 0 auto;
11
+ border: 1px solid #ccc;
12
+ border-right-color: #999;
13
+ border-bottom-color: #999;
14
+ }
15
+ h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <!-- This file lives in public/500.html -->
21
+ <div class="dialog">
22
+ <h1>We're sorry, but something went wrong.</h1>
23
+ </div>
24
+ </body>
25
+ </html>
File without changes
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env ruby
2
+ # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
+
4
+ APP_PATH = File.expand_path('../../config/application', __FILE__)
5
+ require File.expand_path('../../config/boot', __FILE__)
6
+ require 'rails/commands'
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,11 @@
1
+ # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/Fixtures.html
2
+
3
+ # This model initially had no columns defined. If you add columns to the
4
+ # model remove the '{}' from the fixture names and add the columns immediately
5
+ # below each fixture, per the syntax in the comments below
6
+ #
7
+ one: {}
8
+ # column: value
9
+ #
10
+ two: {}
11
+ # column: value
@@ -0,0 +1,7 @@
1
+ en:
2
+ news_feeds:
3
+ create_object: "%{actor} created a %{object_class}: %{object_name}"
4
+ update_object: "%{actor} updated a %{object_class}: %{object_name}"
5
+ delete_object: "%{actor} deleted a %{object_class}: %{object_name}"
6
+ send_object: "%{actor} sent %{recipient_name} a %{object_class}: %{object_name}"
7
+
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class MessagesTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,7 @@
1
+ require 'test_helper'
2
+
3
+ class UserTest < ActiveSupport::TestCase
4
+ # test "the truth" do
5
+ # assert true
6
+ # end
7
+ end
@@ -0,0 +1,13 @@
1
+ require "test_helper"
2
+
3
+ class InstallGeneratorTest < Rails::Generators::TestCase
4
+ tests NewsFeed::Generators::InstallGenerator
5
+ destination File.expand_path("../tmp", __FILE__)
6
+ setup :prepare_destination
7
+
8
+ test "Assert all files are properly created" do
9
+ run_generator
10
+ assert_file "config/locales/en_news_feed.yml"
11
+ assert_file "lib/news_feed/news_feed_events.rb"
12
+ end
13
+ end
@@ -0,0 +1,56 @@
1
+ require 'test_helper'
2
+
3
+ class NewsFeedTest < Test::Unit::TestCase
4
+ def test_to_get_user_name
5
+ user = User.new
6
+ assert_equal "Bob Smith", user.object_name
7
+ end
8
+
9
+ def test_for_creating_a_new_object
10
+ user_1 = User.create
11
+ current_user = User.create
12
+ message = Message.create
13
+ message.insertNewsFeed(:Create, user_1, current_user)
14
+ news_feed_event = user_1.news_feed_events.last
15
+ assert_equal news_feed_event, NewsFeedEvent.last
16
+ assert_equal news_feed_event.text, 'Bob Smith has created a Message: Message Title'
17
+ end
18
+
19
+ def test_for_updating_and_sending_self_an_object
20
+ user_1 = User.create
21
+ current_user = User.create
22
+ message = Message.create
23
+ current_user.insertNewsFeed(:Update, current_user, current_user)
24
+ news_feed_event = current_user.news_feed_events.last
25
+ assert_equal news_feed_event.text, 'You have updated a User: Bob Smith'
26
+ end
27
+
28
+ def test_for_delete_an_object_sent_to_multiple_recipients
29
+ user_1 = User.create
30
+ current_user = User.create
31
+ message = Message.create
32
+ message.insertNewsFeed(:Delete, user_1, current_user)
33
+ news_feed_event = user_1.news_feed_events.last
34
+ assert_equal news_feed_event.text, 'Bob Smith has deleted a Message: Message Title'
35
+ end
36
+
37
+ def test_for_multiple_news_feeds
38
+ user_1 = User.create
39
+ current_user = User.create
40
+ message = Message.create
41
+ message.insertNewsFeed(:Delete, user_1, current_user)
42
+ message.insertNewsFeed(:Create, user_1, current_user)
43
+ assert_equal user_1.news_feed_events.size, 2
44
+ end
45
+
46
+ def test_for_sending_an_object_to_multiple_recipients
47
+ user_1 = User.create
48
+ current_user = User.create
49
+ message = Message.create
50
+ message.insertNewsFeed(:Send, [user_1, current_user], current_user)
51
+ news_feed_event_1 = user_1.news_feed_events.last
52
+ assert_equal news_feed_event_1.text, 'Bob Smith has sent you a Message: Message Title'
53
+ news_feed_event_2 = current_user.news_feed_events.last
54
+ assert_equal news_feed_event_2.text, 'You have sent Bob Smith a Message: Message Title'
55
+ end
56
+ end
@@ -0,0 +1,20 @@
1
+ # Configure Rails Environment
2
+ ENV["RAILS_ENV"] = "test"
3
+
4
+ require File.expand_path("../dummy/config/environment.rb", __FILE__)
5
+ require "rails/test_help"
6
+
7
+ Rails.backtrace_cleaner.remove_silencers!
8
+
9
+ # Load support files
10
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
11
+
12
+
13
+ # Load fixtures from the engine
14
+ if ActiveSupport::TestCase.method_defined?(:fixture_path=)
15
+ ActiveSupport::TestCase.fixture_path = File.expand_path("../fixtures", __FILE__)
16
+ end
17
+
18
+ # Generators
19
+ require "rails/generators/test_case"
20
+ require "generators/news_feed/news_feed_generator"
metadata ADDED
@@ -0,0 +1,215 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: news_feed
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - David Leung
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-08-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rails
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 3.2.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 3.2.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: pg
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: mysql2
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ - !ruby/object:Gem::Dependency
63
+ name: sqlite3
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ description: This gems allow for the simple creation of news feed notification objection
79
+ attached to any class
80
+ email:
81
+ - davleun@gmail.com
82
+ executables: []
83
+ extensions: []
84
+ extra_rdoc_files: []
85
+ files:
86
+ - config/locales/en_news_feed.yml
87
+ - lib/tasks/news_feed_tasks.rake
88
+ - lib/app/model/news_feed_event.rb
89
+ - lib/news_feed/version.rb
90
+ - lib/news_feed/news_feed_events.rb
91
+ - lib/news_feed/acts_as_news_feedable.rb
92
+ - lib/generators/news_feed/news_feed_generator.rb
93
+ - lib/news_feed.rb
94
+ - MIT-LICENSE
95
+ - Rakefile
96
+ - README.rdoc
97
+ - test/dummy/log/test.log
98
+ - test/dummy/log/development.log
99
+ - test/dummy/public/500.html
100
+ - test/dummy/public/422.html
101
+ - test/dummy/public/favicon.ico
102
+ - test/dummy/public/404.html
103
+ - test/dummy/app/assets/stylesheets/application.css
104
+ - test/dummy/app/assets/javascripts/application.js
105
+ - test/dummy/app/models/user.rb
106
+ - test/dummy/app/models/message.rb
107
+ - test/dummy/app/helpers/application_helper.rb
108
+ - test/dummy/app/controllers/application_controller.rb
109
+ - test/dummy/app/views/layouts/application.html.erb
110
+ - test/dummy/config.ru
111
+ - test/dummy/script/rails
112
+ - test/dummy/Rakefile
113
+ - test/dummy/README.rdoc
114
+ - test/dummy/test/support/locales/en_news_feed.yml
115
+ - test/dummy/test/fixtures/messages.yml
116
+ - test/dummy/test/fixtures/users.yml
117
+ - test/dummy/test/unit/messages_test.rb
118
+ - test/dummy/test/unit/user_test.rb
119
+ - test/dummy/db/schema.rb
120
+ - test/dummy/db/test.sqlite3
121
+ - test/dummy/db/development.sqlite3
122
+ - test/dummy/db/migrate/20120807021300_insert_news_feed_events.rb
123
+ - test/dummy/db/migrate/20120806220426_create_messages.rb
124
+ - test/dummy/db/migrate/20120806195421_create_users.rb
125
+ - test/dummy/db/migrate/20120806213224_create_news_feed.rb
126
+ - test/dummy/config/initializers/inflections.rb
127
+ - test/dummy/config/initializers/backtrace_silencers.rb
128
+ - test/dummy/config/initializers/mime_types.rb
129
+ - test/dummy/config/initializers/wrap_parameters.rb
130
+ - test/dummy/config/initializers/session_store.rb
131
+ - test/dummy/config/initializers/secret_token.rb
132
+ - test/dummy/config/application.rb
133
+ - test/dummy/config/boot.rb
134
+ - test/dummy/config/environments/test.rb
135
+ - test/dummy/config/environments/production.rb
136
+ - test/dummy/config/environments/development.rb
137
+ - test/dummy/config/environment.rb
138
+ - test/dummy/config/routes.rb
139
+ - test/dummy/config/database.yml
140
+ - test/dummy/config/locales/en_news_feed.yml
141
+ - test/news_feed_test.rb
142
+ - test/test_helper.rb
143
+ - test/generators/install_generator_test.rb
144
+ homepage: ''
145
+ licenses: []
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ none: false
152
+ requirements:
153
+ - - ! '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ required_rubygems_version: !ruby/object:Gem::Requirement
157
+ none: false
158
+ requirements:
159
+ - - ! '>='
160
+ - !ruby/object:Gem::Version
161
+ version: '0'
162
+ requirements: []
163
+ rubyforge_project:
164
+ rubygems_version: 1.8.24
165
+ signing_key:
166
+ specification_version: 3
167
+ summary: Creates notification and text messages for users and other objects.
168
+ test_files:
169
+ - test/dummy/log/test.log
170
+ - test/dummy/log/development.log
171
+ - test/dummy/public/500.html
172
+ - test/dummy/public/422.html
173
+ - test/dummy/public/favicon.ico
174
+ - test/dummy/public/404.html
175
+ - test/dummy/app/assets/stylesheets/application.css
176
+ - test/dummy/app/assets/javascripts/application.js
177
+ - test/dummy/app/models/user.rb
178
+ - test/dummy/app/models/message.rb
179
+ - test/dummy/app/helpers/application_helper.rb
180
+ - test/dummy/app/controllers/application_controller.rb
181
+ - test/dummy/app/views/layouts/application.html.erb
182
+ - test/dummy/config.ru
183
+ - test/dummy/script/rails
184
+ - test/dummy/Rakefile
185
+ - test/dummy/README.rdoc
186
+ - test/dummy/test/support/locales/en_news_feed.yml
187
+ - test/dummy/test/fixtures/messages.yml
188
+ - test/dummy/test/fixtures/users.yml
189
+ - test/dummy/test/unit/messages_test.rb
190
+ - test/dummy/test/unit/user_test.rb
191
+ - test/dummy/db/schema.rb
192
+ - test/dummy/db/test.sqlite3
193
+ - test/dummy/db/development.sqlite3
194
+ - test/dummy/db/migrate/20120807021300_insert_news_feed_events.rb
195
+ - test/dummy/db/migrate/20120806220426_create_messages.rb
196
+ - test/dummy/db/migrate/20120806195421_create_users.rb
197
+ - test/dummy/db/migrate/20120806213224_create_news_feed.rb
198
+ - test/dummy/config/initializers/inflections.rb
199
+ - test/dummy/config/initializers/backtrace_silencers.rb
200
+ - test/dummy/config/initializers/mime_types.rb
201
+ - test/dummy/config/initializers/wrap_parameters.rb
202
+ - test/dummy/config/initializers/session_store.rb
203
+ - test/dummy/config/initializers/secret_token.rb
204
+ - test/dummy/config/application.rb
205
+ - test/dummy/config/boot.rb
206
+ - test/dummy/config/environments/test.rb
207
+ - test/dummy/config/environments/production.rb
208
+ - test/dummy/config/environments/development.rb
209
+ - test/dummy/config/environment.rb
210
+ - test/dummy/config/routes.rb
211
+ - test/dummy/config/database.yml
212
+ - test/dummy/config/locales/en_news_feed.yml
213
+ - test/news_feed_test.rb
214
+ - test/test_helper.rb
215
+ - test/generators/install_generator_test.rb