extraextra 0.1.0

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/.document ADDED
@@ -0,0 +1,5 @@
1
+ README.rdoc
2
+ lib/**/*.rb
3
+ bin/*
4
+ features/**/*.feature
5
+ LICENSE
data/.gitignore ADDED
@@ -0,0 +1,19 @@
1
+ .DS_Store
2
+
3
+ *.tmproj
4
+ tmtags
5
+
6
+ *~
7
+ <<<<<<< HEAD
8
+ \#*
9
+ .\#*
10
+
11
+ *.swp
12
+
13
+ coverage
14
+ rdoc
15
+ pkg
16
+ =======
17
+ .bundle/*
18
+ *.swp
19
+ >>>>>>> setting up rspec
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ # gem "candy" #not for now
4
+ gem "mongo"
5
+ gem "bson_ext"
6
+ gem "jeweler"
7
+ gem "rake"
8
+
9
+ group :test do
10
+ gem "rspec"
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,28 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ bson (1.0.7)
5
+ bson_ext (1.0.7)
6
+ gemcutter (0.6.1)
7
+ git (1.2.5)
8
+ jeweler (1.4.0)
9
+ gemcutter (>= 0.1.0)
10
+ git (>= 1.2.5)
11
+ rubyforge (>= 2.0.0)
12
+ json_pure (1.4.6)
13
+ mongo (1.0.8)
14
+ bson (>= 1.0.5)
15
+ rake (0.8.7)
16
+ rspec (1.3.0)
17
+ rubyforge (2.0.4)
18
+ json_pure (>= 1.1.7)
19
+
20
+ PLATFORMS
21
+ ruby
22
+
23
+ DEPENDENCIES
24
+ bson_ext
25
+ jeweler
26
+ mongo
27
+ rake
28
+ rspec
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
2
+ Version 2, December 2004
3
+
4
+ Copyright (C) 2010 Steve Klabnik, steve@steveklabnik.com
5
+ Everyone is permitted to copy and distribute verbatim or modified
6
+ copies of this license document, and changing it is allowed as long
7
+ as the name is changed.
8
+
9
+ DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
10
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
11
+
12
+ 0. You just DO WHAT THE FUCK YOU WANT TO.
13
+
data/README.md ADDED
@@ -0,0 +1,107 @@
1
+ EXTRA! EXTRA! READ ALL ABOUT IT!
2
+ ================================
3
+
4
+ Need to add a news feed to your application? EXTRA! EXTRA! is just the Gem
5
+ for you! This is a common need for many social applications. EXTRA! EXTRA!
6
+ uses MongoDB to give you super fast, super convenient feeds.
7
+
8
+ ## Quick Note ###############################################################
9
+
10
+ Not all of this works yet. This is just a prerelease. README driven
11
+ development FTW!
12
+
13
+ ## Install ##################################################################
14
+
15
+ EXTRA! EXTRA! will be distributed via Rubygems, so just
16
+
17
+ $ gem install extraextra
18
+
19
+ and you'll be reading the news in no time!
20
+
21
+ ## Source ###################################################################
22
+
23
+ The source of EXTRA! EXTRA! is on GitHub, and can be found here:
24
+
25
+ http://github.com/steveklabnik/extraextra
26
+
27
+ It can be cloned via
28
+
29
+ $ git clone git://github.com/steveklabnik/extraextra.git
30
+
31
+ ## Requirements #############################################################
32
+
33
+ * **Ruby 1.9** Sorry for you 1.8 people, 1.9 is the current version of Ruby.
34
+ * **mongo** If you're going to use MongoDB...
35
+
36
+ ## Usage ####################################################################
37
+
38
+ The first thing you'll need to do is configure EXTRA! EXTRA! to use your
39
+ MongoDB installation.
40
+
41
+ Extra::Extra.source :host => "localhost", :port => "1337"
42
+
43
+ To record something newsworthy, just do this:
44
+
45
+ $ Extra::Extra::! :breaking, user, "has just done something awesome!"
46
+
47
+ To find out what interesting things a particular user has done:
48
+
49
+ $ Extra::Extra.read_all_about_it user
50
+
51
+ or
52
+
53
+ $ Extra::Extra.the_scoop user
54
+
55
+ This returns an array of Extra objects. To find out more about a particular
56
+ Extra:
57
+
58
+ $ extra = Extra::Extra::! :sports, user, "hit a home run!"
59
+
60
+ $ extra.who?
61
+ => #<User:0x0000010089ea80>
62
+ $ extra.what?
63
+ => "hit a home run"
64
+ $ extra.where?
65
+ => nil # currently undecided
66
+ $ extra.when?
67
+ => 1283311813
68
+ $ extra.how?
69
+ => nil # currently undecided
70
+ $ extra.to_s
71
+ => "Steve hit a home run"
72
+
73
+ The name in to_s comes from user#username. If you use something else...
74
+ I'll provide a way to override this eventually.
75
+
76
+ To only see breaking news:
77
+
78
+ $ user.breaking_news
79
+
80
+ This will filter out only the news in the 'breaking' category.
81
+
82
+ To find out what interesting things a users's friends have done:
83
+
84
+ $ user.scope_the_scene
85
+
86
+ To define what who you're friends with, make a method on your user model
87
+ named my_peeps. For a (hypothetical) example:
88
+
89
+ class User
90
+ def my_peeps
91
+ User.friends.collect(&:id)
92
+ end
93
+ end
94
+
95
+ The my_peeps method should return an Array of ids. This method will be
96
+ called during scope_the_scene to determine what results get returned.
97
+
98
+ ## Contributing #############################################################
99
+
100
+ Fork, commit, pull request. Bonus points for topic branches and great commit
101
+ messages.
102
+
103
+ In particular, I will accept most patches that add good aliases for methods.
104
+
105
+ ## This is just a cleverly named logging framework ##########################
106
+
107
+ No, it's not. Shut up.
data/README.rdoc ADDED
@@ -0,0 +1,109 @@
1
+ = EXTRA! EXTRA! READ ALL ABOUT IT!
2
+
3
+ Need to add a news feed to your application? EXTRA! EXTRA! is just the Gem
4
+ for you! This is a common need for many social applications. EXTRA! EXTRA!
5
+ uses MongoDB to give you super fast, super convenient feeds.
6
+
7
+ == Quick Note
8
+
9
+ Not all of this works yet. This is just a prerelease. README driven
10
+ development FTW!
11
+
12
+ == Install
13
+
14
+ EXTRA! EXTRA! will be distributed via Rubygems, so just
15
+
16
+ $ gem install extraextra
17
+
18
+ and you'll be reading the news in no time!
19
+
20
+ == Source
21
+
22
+ The source of EXTRA! EXTRA! is on GitHub, and can be found here:
23
+
24
+ http://github.com/steveklabnik/extraextra
25
+
26
+ It can be cloned via
27
+
28
+ $ git clone git://github.com/steveklabnik/extraextra.git
29
+
30
+ == Requirements
31
+
32
+ * **Ruby 1.9** Sorry for you 1.8 people, 1.9 is the current version of Ruby.
33
+ * **mongo** If you're going to use MongoDB...
34
+
35
+ == Usage
36
+
37
+ The first thing you'll need to do is configure EXTRA! EXTRA! to use your
38
+ MongoDB installation.
39
+
40
+ Extra::Extra.source :host => "localhost", :port => "1337"
41
+
42
+ To record something newsworthy, just do this:
43
+
44
+ $ Extra::Extra::! :breaking, user, "has just done something awesome!"
45
+
46
+ To find out what interesting things a particular user has done:
47
+
48
+ $ Extra::Extra.read_all_about_it user
49
+
50
+ or
51
+
52
+ $ Extra::Extra.the_scoop user
53
+
54
+ This returns an array of Extra objects. To find out more about a particular
55
+ Extra:
56
+
57
+ $ extra = Extra::Extra::! :sports, user, "hit a home run!"
58
+
59
+ $ extra.who?
60
+ => #<User:0x0000010089ea80>
61
+ $ extra.what?
62
+ => "hit a home run"
63
+ $ extra.where?
64
+ => nil # currently undecided
65
+ $ extra.when?
66
+ => 1283311813
67
+ $ extra.how?
68
+ => nil # currently undecided
69
+ $ extra.to_s
70
+ => "Steve hit a home run"
71
+
72
+ The name in to_s comes from user#username. If you use something else...
73
+ I'll provide a way to override this eventually.
74
+
75
+ To only see breaking news:
76
+
77
+ $ user.breaking_news
78
+
79
+ This will filter out only the news in the 'breaking' category.
80
+
81
+ To find out what interesting things a users's friends have done:
82
+
83
+ $ user.scope_the_scene
84
+
85
+ To define what who you're friends with, make a method on your user model
86
+ named my_peeps. For a (hypothetical) example:
87
+
88
+ class User
89
+ def my_peeps
90
+ User.friends.collect(&:id)
91
+ end
92
+ end
93
+
94
+ The my_peeps method should return an Array of ids. This method will be
95
+ called during scope_the_scene to determine what results get returned.
96
+
97
+ == Note on Patches/Pull Requests
98
+
99
+ * Fork the project.
100
+ * Make your feature addition or bug fix.
101
+ * Add tests for it. This is important so I don't break it in a
102
+ future version unintentionally.
103
+ * Commit, do not mess with rakefile, version, or history.
104
+ (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)
105
+ * Send me a pull request. Bonus points for topic branches.
106
+
107
+ == Copyright
108
+
109
+ Copyright (c) 2010 Steve Klabnik. See LICENSE for details.
data/Rakefile ADDED
@@ -0,0 +1,48 @@
1
+ require "rubygems"
2
+ require "bundler/setup"
3
+
4
+ #require 'rake'
5
+
6
+ begin
7
+ require 'jeweler'
8
+ Jeweler::Tasks.new do |gem|
9
+ gem.name = "extraextra"
10
+ gem.summary = %Q{Super simple news feeds powered by MongoDB.}
11
+ 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.}
12
+ gem.email = "steve@steveklabnik.com"
13
+ gem.homepage = "http://github.com/steveklabnik/extraextra"
14
+ gem.authors = ["Steve Klabnik"]
15
+ gem.add_development_dependency "rspec", "=1.3.0"
16
+ gem.add_dependency "mongo", "=1.0.8"
17
+ # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
18
+ end
19
+ Jeweler::GemcutterTasks.new
20
+ rescue LoadError
21
+ puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
22
+ end
23
+
24
+ require 'spec/rake/spectask'
25
+ Spec::Rake::SpecTask.new(:spec) do |spec|
26
+ spec.libs << 'lib' << 'spec'
27
+ spec.spec_files = FileList['spec/**/*_spec.rb']
28
+ end
29
+
30
+ Spec::Rake::SpecTask.new(:rcov) do |spec|
31
+ spec.libs << 'lib' << 'spec'
32
+ spec.pattern = 'spec/**/*_spec.rb'
33
+ spec.rcov = true
34
+ end
35
+
36
+ task :spec => :check_dependencies
37
+
38
+ task :default => :spec
39
+
40
+ require 'rake/rdoctask'
41
+ Rake::RDocTask.new do |rdoc|
42
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
43
+
44
+ rdoc.rdoc_dir = 'rdoc'
45
+ rdoc.title = "extraextra #{version}"
46
+ rdoc.rdoc_files.include('README*')
47
+ rdoc.rdoc_files.include('lib/**/*.rb')
48
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,64 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{extraextra}
8
+ s.version = "0.1.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Steve Klabnik"]
12
+ s.date = %q{2010-09-01}
13
+ s.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.}
14
+ s.email = %q{steve@steveklabnik.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE",
17
+ "README.md",
18
+ "README.rdoc"
19
+ ]
20
+ s.files = [
21
+ ".document",
22
+ ".gitignore",
23
+ "Gemfile",
24
+ "Gemfile.lock",
25
+ "LICENSE",
26
+ "README.md",
27
+ "README.rdoc",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "extraextra.gemspec",
31
+ "lib/extra/extra.rb",
32
+ "lib/extraextra.rb",
33
+ "spec/extraextra_spec.rb",
34
+ "spec/spec.opts",
35
+ "spec/spec_helper.rb",
36
+ "test.rb"
37
+ ]
38
+ s.homepage = %q{http://github.com/steveklabnik/extraextra}
39
+ s.rdoc_options = ["--charset=UTF-8"]
40
+ s.require_paths = ["lib"]
41
+ s.rubygems_version = %q{1.3.7}
42
+ s.summary = %q{Super simple news feeds powered by MongoDB.}
43
+ s.test_files = [
44
+ "spec/extraextra_spec.rb",
45
+ "spec/spec_helper.rb"
46
+ ]
47
+
48
+ if s.respond_to? :specification_version then
49
+ current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
50
+ s.specification_version = 3
51
+
52
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
+ s.add_development_dependency(%q<rspec>, ["= 1.3.0"])
54
+ s.add_runtime_dependency(%q<mongo>, ["= 1.0.8"])
55
+ else
56
+ s.add_dependency(%q<rspec>, ["= 1.3.0"])
57
+ s.add_dependency(%q<mongo>, ["= 1.0.8"])
58
+ end
59
+ else
60
+ s.add_dependency(%q<rspec>, ["= 1.3.0"])
61
+ s.add_dependency(%q<mongo>, ["= 1.0.8"])
62
+ end
63
+ end
64
+
@@ -0,0 +1,38 @@
1
+ require 'mongo'
2
+ include Mongo
3
+
4
+ module Extra
5
+
6
+ class Extra
7
+
8
+
9
+ class << self
10
+ attr_accessor :db, :collection
11
+
12
+ def source opts={}
13
+ opts[:host] ||= "localhost"
14
+ opts[:port] ||= 27017
15
+ self.db = Mongo::Connection.new(opts[:host], opts[:port]).db("extraextra")
16
+ self.collection = db["extras"]
17
+ end
18
+
19
+ def !(category, user, text)
20
+ collection.insert category: category,
21
+ who_id: user.id,
22
+ who_name: user.username,
23
+ who_class: user.class.to_s,
24
+ what: text,
25
+ when: Time.now.to_s
26
+ end
27
+
28
+ def read_all_about_it user
29
+
30
+ collection.find(who_id: user.id,
31
+ who_class: user.class.to_s
32
+ ).to_a
33
+
34
+ end
35
+ end
36
+
37
+ end
38
+ end
data/lib/extraextra.rb ADDED
File without changes
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "Extraextra" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --color
@@ -0,0 +1,9 @@
1
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
2
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
+ require 'extraextra'
4
+ require 'spec'
5
+ require 'spec/autorun'
6
+
7
+ Spec::Runner.configure do |config|
8
+
9
+ end
data/test.rb ADDED
@@ -0,0 +1,19 @@
1
+ require './lib/extra/extra.rb'
2
+
3
+ class User
4
+ attr_accessor :id, :username
5
+ end
6
+
7
+ steve = User.new
8
+ steve.id = 1
9
+ steve.username = "steve"
10
+
11
+ Extra::Extra.source
12
+
13
+ Extra::Extra.! :breaking, steve, "won at everything!"
14
+
15
+ extras = Extra::Extra.read_all_about_it(steve)
16
+
17
+ extras.each do |extra|
18
+ puts extra.to_s
19
+ end
metadata ADDED
@@ -0,0 +1,112 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: extraextra
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 1
8
+ - 0
9
+ version: 0.1.0
10
+ platform: ruby
11
+ authors:
12
+ - Steve Klabnik
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-09-01 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ requirement: &id001 !ruby/object:Gem::Requirement
23
+ none: false
24
+ requirements:
25
+ - - "="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 1
29
+ - 3
30
+ - 0
31
+ version: 1.3.0
32
+ type: :development
33
+ prerelease: false
34
+ version_requirements: *id001
35
+ - !ruby/object:Gem::Dependency
36
+ name: mongo
37
+ requirement: &id002 !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - "="
41
+ - !ruby/object:Gem::Version
42
+ segments:
43
+ - 1
44
+ - 0
45
+ - 8
46
+ version: 1.0.8
47
+ type: :runtime
48
+ prerelease: false
49
+ version_requirements: *id002
50
+ description: 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.
51
+ email: steve@steveklabnik.com
52
+ executables: []
53
+
54
+ extensions: []
55
+
56
+ extra_rdoc_files:
57
+ - LICENSE
58
+ - README.md
59
+ - README.rdoc
60
+ files:
61
+ - .document
62
+ - .gitignore
63
+ - Gemfile
64
+ - Gemfile.lock
65
+ - LICENSE
66
+ - README.md
67
+ - README.rdoc
68
+ - Rakefile
69
+ - VERSION
70
+ - extraextra.gemspec
71
+ - lib/extra/extra.rb
72
+ - lib/extraextra.rb
73
+ - spec/extraextra_spec.rb
74
+ - spec/spec.opts
75
+ - spec/spec_helper.rb
76
+ - test.rb
77
+ has_rdoc: true
78
+ homepage: http://github.com/steveklabnik/extraextra
79
+ licenses: []
80
+
81
+ post_install_message:
82
+ rdoc_options:
83
+ - --charset=UTF-8
84
+ require_paths:
85
+ - lib
86
+ required_ruby_version: !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ hash: 4012342464942348992
92
+ segments:
93
+ - 0
94
+ version: "0"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ segments:
101
+ - 0
102
+ version: "0"
103
+ requirements: []
104
+
105
+ rubyforge_project:
106
+ rubygems_version: 1.3.7
107
+ signing_key:
108
+ specification_version: 3
109
+ summary: Super simple news feeds powered by MongoDB.
110
+ test_files:
111
+ - spec/extraextra_spec.rb
112
+ - spec/spec_helper.rb