Permalink
Browse files

gemified

  • Loading branch information...
1 parent 0c0b894 commit faf7ae1b3375f84a4ccc388428d89e0037437f5a @steveklabnik committed Sep 2, 2010
Showing with 137 additions and 84 deletions.
  1. +3 −0 Gemfile
  2. +14 −0 Gemfile.lock
  3. +12 −19 LICENSE
  4. +6 −3 README.md
  5. +94 −2 README.rdoc
  6. +8 −7 Rakefile
  7. +0 −1 lib/extra.rb
  8. +0 −52 spec/extra_spec.rb
View
@@ -2,6 +2,9 @@ source "http://rubygems.org"
# gem "candy" #not for now
gem "mongo"
+gem "bson_ext"
+gem "jeweler"
+gem "rake"
group :test do
gem "rspec"
View
@@ -2,13 +2,27 @@ GEM
remote: http://rubygems.org/
specs:
bson (1.0.7)
+ bson_ext (1.0.7)
+ gemcutter (0.6.1)
+ git (1.2.5)
+ jeweler (1.4.0)
+ gemcutter (>= 0.1.0)
+ git (>= 1.2.5)
+ rubyforge (>= 2.0.0)
+ json_pure (1.4.6)
mongo (1.0.8)
bson (>= 1.0.5)
+ rake (0.8.7)
rspec (1.3.0)
+ rubyforge (2.0.4)
+ json_pure (>= 1.1.7)
PLATFORMS
ruby
DEPENDENCIES
+ bson_ext
+ jeweler
mongo
+ rake
rspec
View
31 LICENSE
@@ -1,20 +1,13 @@
-Copyright (c) 2009 Steve Klabnik
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ Version 2, December 2004
+
+Copyright (C) 2010 Steve Klabnik, steve@steveklabnik.com
+Everyone is permitted to copy and distribute verbatim or modified
+copies of this license document, and changing it is allowed as long
+as the name is changed.
+
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -5,6 +5,11 @@ 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.
+## Quick Note ###############################################################
+
+Not all of this works yet. This is just a prerelease. README driven
+development FTW!
+
## Install ##################################################################
EXTRA! EXTRA! will be distributed via Rubygems, so just
@@ -13,7 +18,6 @@ EXTRA! EXTRA! will be distributed via Rubygems, so just
and you'll be reading the news in no time!
-
## Source ###################################################################
The source of EXTRA! EXTRA! is on GitHub, and can be found here:
@@ -27,8 +31,7 @@ It can be cloned via
## Requirements #############################################################
* **Ruby 1.9** Sorry for you 1.8 people, 1.9 is the current version of Ruby.
-* **candy** Simple, lightweight, 'orm' for MongoDB.
-* **MongoDB 1.4** This is a candy requirement, and 1.6 is current, anyway.
+* **mongo** If you're going to use MongoDB...
## Usage ####################################################################
View
@@ -1,6 +1,98 @@
-= extraextra
+= EXTRA! EXTRA! READ ALL ABOUT IT!
-Description goes here.
+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.
+
+== Quick Note
+
+Not all of this works yet. This is just a prerelease. README driven
+development FTW!
+
+== Install
+
+EXTRA! EXTRA! will be distributed via Rubygems, so just
+
+ $ gem install extraextra
+
+and you'll be reading the news in no time!
+
+== Source
+
+The source of EXTRA! EXTRA! is on GitHub, and can be found here:
+
+ http://github.com/steveklabnik/extraextra
+
+It can be cloned via
+
+ $ git clone git://github.com/steveklabnik/extraextra.git
+
+== Requirements
+
+* **Ruby 1.9** Sorry for you 1.8 people, 1.9 is the current version of Ruby.
+* **mongo** If you're going to use MongoDB...
+
+== Usage
+
+The first thing you'll need to do is configure EXTRA! EXTRA! to use your
+MongoDB installation.
+
+ Extra::Extra.source :host => "localhost", :port => "1337"
+
+To record something newsworthy, just do this:
+
+ $ Extra::Extra::! :breaking, user, "has just done something awesome!"
+
+To find out what interesting things a particular user has done:
+
+ $ Extra::Extra.read_all_about_it user
+
+or
+
+ $ Extra::Extra.the_scoop user
+
+This returns an array of Extra objects. To find out more about a particular
+ Extra:
+
+ $ extra = Extra::Extra::! :sports, user, "hit a home run!"
+
+ $ extra.who?
+ => #<User:0x0000010089ea80>
+ $ extra.what?
+ => "hit a home run"
+ $ extra.where?
+ => nil # currently undecided
+ $ extra.when?
+ => 1283311813
+ $ extra.how?
+ => nil # currently undecided
+ $ extra.to_s
+ => "Steve hit a home run"
+
+The name in to_s comes from user#username. If you use something else...
+I'll provide a way to override this eventually.
+
+To only see breaking news:
+
+ $ user.breaking_news
+
+This will filter out only the news in the 'breaking' category.
+
+To find out what interesting things a users's friends have done:
+
+ $ user.scope_the_scene
+
+To define what who you're friends with, make a method on your user model
+named my_peeps. For a (hypothetical) example:
+
+ class User
+ def my_peeps
+ User.friends.collect(&:id)
+ end
+ end
+
+The my_peeps method should return an Array of ids. This method will be
+called during scope_the_scene to determine what results get returned.
== Note on Patches/Pull Requests
View
@@ -1,17 +1,19 @@
-<<<<<<< HEAD
-require 'rubygems'
-require 'rake'
+require "rubygems"
+require "bundler/setup"
+
+#require 'rake'
begin
require 'jeweler'
Jeweler::Tasks.new do |gem|
gem.name = "extraextra"
- gem.summary = %Q{TODO: one-line summary of your gem}
- gem.description = %Q{TODO: longer description of your gem}
+ gem.summary = %Q{Super simple news feeds powered by MongoDB.}
+ gem.description = %Q{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.}
gem.email = "steve@steveklabnik.com"
gem.homepage = "http://github.com/steveklabnik/extraextra"
gem.authors = ["Steve Klabnik"]
- gem.add_development_dependency "rspec", ">= 1.2.9"
+ gem.add_development_dependency "rspec", "=1.3.0"
+ gem.add_dependency "mongo", "=1.0.8"
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
end
Jeweler::GemcutterTasks.new
@@ -44,4 +46,3 @@ Rake::RDocTask.new do |rdoc|
rdoc.rdoc_files.include('README*')
rdoc.rdoc_files.include('lib/**/*.rb')
end
-
View
@@ -1 +0,0 @@
-require "extra/extra.rb"
View
@@ -1,52 +0,0 @@
-require_relative "../lib/extra.rb"
-
-describe Extra::Extra do
- describe "#source" do
- it "should exist" do
- Extra::Extra.respond_to?(:source).should == true
- end
-
- it "should set up a connection" do
- obj = mock("Connection")
- db = mock("db")
- db.should_receive(:[])
- obj.should_receive(:db).with("extraextra").and_return(db)
- Mongo::Connection.should_receive(:new).with("localhost", 1337).and_return(obj)
- Extra::Extra.should_receive(:db=).and_return(db)
- Extra::Extra.should_receive(:db).and_return(db)
-
- Extra::Extra.source :host => "localhost", :port => 1337
- end
- end
-
- describe "self#!" do
-
- it "should take three args and save them" do
- #holy setup batman
- collection = mock("collection")
- Extra::Extra.should_receive(:collection).and_return(collection)
- collection.should_receive(:insert).with(:category => :breaking, :who_id => 1, :who_name => "steve", :who_class => 'User', :what => "hit a home run", :when => Time.now.to_s)
-
- user = mock("User", :id => 1, :class => 'User', :username => "steve")
- Extra::Extra::! :breaking, user, "hit a home run"
- end
- end
-
- describe "#read_all_about_it" do
-
- it "should exist" do
- Extra::Extra.respond_to?(:read_all_about_it).should == true
- end
-
- it "should return Extras for the user" do
- user = mock("User", :id => 1, :class => "User")
- extra = mock("Extra")
- collection = mock("collection")
- collection.should_receive(:find).with(:who_id=>1, :who_class=>"User").and_return([extra])
- Extra::Extra.should_receive(:collection).and_return(collection)
-
- extras = Extra::Extra.read_all_about_it(user)
- extras.should == [extra]
- end
- end
-end

0 comments on commit faf7ae1

Please sign in to comment.