Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 118 lines (72 sloc) 3.769 kB
faf7ae1 @steveklabnik gemified
authored
1 = EXTRA! EXTRA! READ ALL ABOUT IT!
4db26d9 @steveklabnik Initial commit to extraextra.
authored
2
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
3 Need to add a news feed to your application? EXTRA! EXTRA! is just the Gem for you! This is a common need for many social applications. EXTRA! EXTRA! uses MongoDB to give you super fast, super convenient feeds.
faf7ae1 @steveklabnik gemified
authored
4
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
5 Oh, and when I say "news feed", think "activity feed," not RSS. The stuff that's on the dashboard of every social app ever.
faf7ae1 @steveklabnik gemified
authored
6
7 == Install
8
9 EXTRA! EXTRA! will be distributed via Rubygems, so just
10
11 $ gem install extraextra
12
13 and you'll be reading the news in no time!
14
15 == Source
16
17 The source of EXTRA! EXTRA! is on GitHub, and can be found here:
18
19 http://github.com/steveklabnik/extraextra
20
21 It can be cloned via
22
23 $ git clone git://github.com/steveklabnik/extraextra.git
24
25 == Requirements
26
3429296 @steveklabnik adding scope_the_scene
authored
27 * Ruby 1.9: Sorry for you 1.8 people, 1.9 is the current version of Ruby. I test with 1.9.2.
28 * mongo: If you're going to use MongoDB...
faf7ae1 @steveklabnik gemified
authored
29
30 == Usage
31
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
32 The first thing you'll need to do is configure EXTRA! EXTRA! to connect to your MongoDB:
faf7ae1 @steveklabnik gemified
authored
33
34 Extra::Extra.source :host => "localhost", :port => "1337"
35
36 To record something newsworthy, just do this:
37
38 $ Extra::Extra::! :breaking, user, "has just done something awesome!"
39
40 To find out what interesting things a particular user has done:
41
42 $ Extra::Extra.read_all_about_it user
43
44 or
45
46 $ Extra::Extra.the_scoop user
47
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
48 This returns an array of Extra objects. To find out more about a particular Extra:
faf7ae1 @steveklabnik gemified
authored
49
50 $ extra = Extra::Extra::! :sports, user, "hit a home run!"
51
5fc6517 @steveklabnik Fixing extra README, adding factories, a bug.
authored
52 $ extra.who
faf7ae1 @steveklabnik gemified
authored
53 => #<User:0x0000010089ea80>
5fc6517 @steveklabnik Fixing extra README, adding factories, a bug.
authored
54 $ extra.what
faf7ae1 @steveklabnik gemified
authored
55 => "hit a home run"
5fc6517 @steveklabnik Fixing extra README, adding factories, a bug.
authored
56 $ extra.where
faf7ae1 @steveklabnik gemified
authored
57 => nil # currently undecided
5fc6517 @steveklabnik Fixing extra README, adding factories, a bug.
authored
58 $ extra.when
faf7ae1 @steveklabnik gemified
authored
59 => 1283311813
5fc6517 @steveklabnik Fixing extra README, adding factories, a bug.
authored
60 $ extra.how
faf7ae1 @steveklabnik gemified
authored
61 => nil # currently undecided
62 $ extra.to_s
63 => "Steve hit a home run"
64
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
65 Two things: 'who' instantiates the object by sending it the find message, passing an id. So that has to be defined in your user object. Secondly, the name in to_s comes from user#username. If you use something else... I'll provide a way to override these eventually.
faf7ae1 @steveklabnik gemified
authored
66
67 To only see breaking news:
68
a65a1c2 @steveklabnik Fixing up some docs.
authored
69 $ Extra::Extra.breaking_news
faf7ae1 @steveklabnik gemified
authored
70
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
71 This will filter out only the news in the 'breaking' category. You can pass an optional user:
a65a1c2 @steveklabnik Fixing up some docs.
authored
72
73 $ Extra::Extra.breaking_news user
74
75 This will only show breaking news for this specific user.
faf7ae1 @steveklabnik gemified
authored
76
77 To find out what interesting things a users's friends have done:
78
a65a1c2 @steveklabnik Fixing up some docs.
authored
79 $ Extra::Extra.scope_the_scene user
80
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
81 This also takes a user, just like *_news.
faf7ae1 @steveklabnik gemified
authored
82
83 To define what who you're friends with, make a method on your user model
84 named my_peeps. For a (hypothetical) example:
85
86 class User
87 def my_peeps
88 User.friends.collect(&:id)
89 end
90 end
91
92 The my_peeps method should return an Array of ids. This method will be
93 called during scope_the_scene to determine what results get returned.
4db26d9 @steveklabnik Initial commit to extraextra.
authored
94
d89bbe5 @steveklabnik Adding versions to Gemfile, updating README
authored
95 == Roadmap
96
97 1.0.0 was the release that implements the most basic functionality that I needed. I plan on integrating EXTRA! EXTRA! into a few of my projects, and seeing what could be useful. But here's a few things that are rolling around in my brain:
98
99 * Limits on most queries. This'll probably get added real quick.
100 * Generators for Rails that cover common use cases.
101 * Possibly allowing for extra metadata to be attached to each Extra.
102
103 We'll just roll with the punches. I'd love to hear some ideas.
104
4db26d9 @steveklabnik Initial commit to extraextra.
authored
105 == Note on Patches/Pull Requests
106
107 * Fork the project.
108 * Make your feature addition or bug fix.
109 * Add tests for it. This is important so I don't break it in a
110 future version unintentionally.
111 * Commit, do not mess with rakefile, version, or history.
112 (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
113 * Send me a pull request. Bonus points for topic branches.
114
115 == Copyright
116
117 Copyright (c) 2010 Steve Klabnik. See LICENSE for details.
Something went wrong with that request. Please try again.