mm-friendable 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +18 -0
- data/Gemfile.lock +60 -0
- data/LICENSE.txt +20 -0
- data/README.rdoc +66 -0
- data/Rakefile +43 -0
- data/VERSION +1 -0
- data/lib/mm-friendable.rb +3 -0
- data/lib/mongo_mapper/plugins/friendable/friend_list.rb +6 -0
- data/lib/mongo_mapper/plugins/friendable.rb +76 -0
- data/mm-friendable.gemspec +93 -0
- data/spec/mm-friendable_spec.rb +64 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/models.rb +12 -0
- metadata +263 -0
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
gem 'mongo', '1.1.2'
|
5
|
+
gem 'bson_ext', '1.1.2'
|
6
|
+
gem 'mongo_ext'
|
7
|
+
gem 'mongo_mapper'
|
8
|
+
gem 'i18n'
|
9
|
+
|
10
|
+
gem 'log_buddy'
|
11
|
+
|
12
|
+
gem 'ruby-debug'
|
13
|
+
gem "rspec", "~> 2.1.0"
|
14
|
+
gem "yard", "~> 0.6.0"
|
15
|
+
gem "bundler", "~> 1.0.0"
|
16
|
+
gem "jeweler", "~> 1.5.1"
|
17
|
+
gem "rcov", ">= 0"
|
18
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (3.0.1)
|
5
|
+
bson (1.1.2)
|
6
|
+
bson_ext (1.1.2)
|
7
|
+
columnize (0.3.2)
|
8
|
+
diff-lcs (1.1.2)
|
9
|
+
git (1.2.5)
|
10
|
+
i18n (0.4.2)
|
11
|
+
jeweler (1.5.1)
|
12
|
+
bundler (~> 1.0.0)
|
13
|
+
git (>= 1.2.5)
|
14
|
+
rake
|
15
|
+
jnunemaker-validatable (1.8.4)
|
16
|
+
activesupport (>= 2.3.4)
|
17
|
+
linecache (0.43)
|
18
|
+
log_buddy (0.5.0)
|
19
|
+
mongo (1.1.2)
|
20
|
+
bson (>= 1.1.1)
|
21
|
+
mongo_ext (0.19.3)
|
22
|
+
mongo_mapper (0.8.6)
|
23
|
+
activesupport (>= 2.3.4)
|
24
|
+
jnunemaker-validatable (~> 1.8.4)
|
25
|
+
plucky (~> 0.3.6)
|
26
|
+
plucky (0.3.6)
|
27
|
+
mongo (~> 1.1)
|
28
|
+
rake (0.8.7)
|
29
|
+
rcov (0.9.9)
|
30
|
+
rspec (2.1.0)
|
31
|
+
rspec-core (~> 2.1.0)
|
32
|
+
rspec-expectations (~> 2.1.0)
|
33
|
+
rspec-mocks (~> 2.1.0)
|
34
|
+
rspec-core (2.1.0)
|
35
|
+
rspec-expectations (2.1.0)
|
36
|
+
diff-lcs (~> 1.1.2)
|
37
|
+
rspec-mocks (2.1.0)
|
38
|
+
ruby-debug (0.10.4)
|
39
|
+
columnize (>= 0.1)
|
40
|
+
ruby-debug-base (~> 0.10.4.0)
|
41
|
+
ruby-debug-base (0.10.4)
|
42
|
+
linecache (>= 0.3)
|
43
|
+
yard (0.6.2)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
bson_ext (= 1.1.2)
|
50
|
+
bundler (~> 1.0.0)
|
51
|
+
i18n
|
52
|
+
jeweler (~> 1.5.1)
|
53
|
+
log_buddy
|
54
|
+
mongo (= 1.1.2)
|
55
|
+
mongo_ext
|
56
|
+
mongo_mapper
|
57
|
+
rcov
|
58
|
+
rspec (~> 2.1.0)
|
59
|
+
ruby-debug
|
60
|
+
yard (~> 0.6.0)
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2010 Luke Cunningham
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
= mm-friendable
|
2
|
+
|
3
|
+
A simple MongoMapper plugin to add friendship functionality to your application
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
Install the gem
|
8
|
+
|
9
|
+
gem install mm-friendable
|
10
|
+
|
11
|
+
|
12
|
+
Or add it to your Gemfile
|
13
|
+
|
14
|
+
gem 'mm-friendable'
|
15
|
+
|
16
|
+
|
17
|
+
Then add the friendable plugin to you MongoMapper::Document
|
18
|
+
|
19
|
+
class User
|
20
|
+
include MongoMapper::Document
|
21
|
+
plugin MongoMapper::Plugins::Friendable
|
22
|
+
|
23
|
+
def on_add_friend(friend)
|
24
|
+
do something when a friend is added...
|
25
|
+
end
|
26
|
+
|
27
|
+
def on_remove_friend(friend)
|
28
|
+
do something when a friend is removed...
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
You must implement the on_add_friend and on_remove_friend callbacks! - however they can be empty implementations
|
33
|
+
|
34
|
+
@user_1 = User.create
|
35
|
+
@user_2 = User.create
|
36
|
+
|
37
|
+
@user_1.add_friend!(@user_2)
|
38
|
+
|
39
|
+
@user_1.following_count #=> 1
|
40
|
+
@user_1.following #=> [<User>]
|
41
|
+
@user_1.following.first == @user_2 #=> true
|
42
|
+
|
43
|
+
@user_2.followers_count #=> 1
|
44
|
+
@user_2.followers #=> [<User>]
|
45
|
+
@user_2.followers.first == @user_1 #=> true
|
46
|
+
|
47
|
+
@user_1.following(@user_2) #=> true
|
48
|
+
@user_2.following(@user_1) #=> false
|
49
|
+
|
50
|
+
|
51
|
+
== Contributing to mm-friendable
|
52
|
+
|
53
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
|
54
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
|
55
|
+
* Fork the project
|
56
|
+
* Start a feature/bugfix branch
|
57
|
+
* Commit and push until you are happy with your contribution
|
58
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
59
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
60
|
+
|
61
|
+
|
62
|
+
== Copyright
|
63
|
+
|
64
|
+
Copyright (c) 2010 Luke Cunningham. See LICENSE.txt for
|
65
|
+
further details.
|
66
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
begin
|
4
|
+
Bundler.setup(:default, :development)
|
5
|
+
rescue Bundler::BundlerError => e
|
6
|
+
$stderr.puts e.message
|
7
|
+
$stderr.puts "Run `bundle install` to install missing gems"
|
8
|
+
exit e.status_code
|
9
|
+
end
|
10
|
+
require 'rake'
|
11
|
+
|
12
|
+
require 'jeweler'
|
13
|
+
Jeweler::Tasks.new do |gem|
|
14
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
15
|
+
gem.name = "mm-friendable"
|
16
|
+
gem.homepage = "http://github.com/icaruswings/mm-friendable"
|
17
|
+
gem.license = "MIT"
|
18
|
+
gem.summary = %Q{A very simple mongomapper plugin to add friendship functionaity to your application}
|
19
|
+
gem.description = %Q{A very simple mongomapper plugin to add friendship functionality to your application}
|
20
|
+
gem.email = "luke@icaruswings.com"
|
21
|
+
gem.authors = ["Luke Cunningham"]
|
22
|
+
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
+
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
+
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
+
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
RSpec::Core::RakeTask.new(:rcov) do |spec|
|
36
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
37
|
+
spec.rcov = true
|
38
|
+
end
|
39
|
+
|
40
|
+
task :default => :spec
|
41
|
+
|
42
|
+
require 'yard'
|
43
|
+
YARD::Rake::YardocTask.new
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.0
|
@@ -0,0 +1,76 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), 'friendable', 'friend_list')
|
2
|
+
|
3
|
+
module MongoMapper
|
4
|
+
module Plugins
|
5
|
+
module Friendable
|
6
|
+
|
7
|
+
def self.configure(model)
|
8
|
+
model.class_eval do
|
9
|
+
key :friend_list, FriendList
|
10
|
+
|
11
|
+
key :followers_count, Integer, :default => 0
|
12
|
+
key :following_count, Integer, :default => 0
|
13
|
+
|
14
|
+
before_create :create_friend_list
|
15
|
+
|
16
|
+
def friendable?; true; end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
module InstanceMethods
|
21
|
+
|
22
|
+
def add_friend!(friend)
|
23
|
+
return false if friend == self
|
24
|
+
|
25
|
+
User.push_uniq(self.id, 'friend_list.following_ids' => friend.id)
|
26
|
+
User.push_uniq(friend.id, 'friend_list.followers_ids' => self.id)
|
27
|
+
User.increment(self.id, 'following_count' => 1)
|
28
|
+
User.increment(friend.id, 'followers_count' => 1)
|
29
|
+
|
30
|
+
on_add_friend(friend)
|
31
|
+
end
|
32
|
+
|
33
|
+
def on_add_friend(friend)
|
34
|
+
raise NotImplementedError
|
35
|
+
end
|
36
|
+
|
37
|
+
def remove_friend!(friend)
|
38
|
+
return false if friend == self
|
39
|
+
|
40
|
+
User.pull(self.id, 'friend_list.following_ids' => friend.id)
|
41
|
+
User.pull(friend.id, 'friend_list.followers_ids' => self.id)
|
42
|
+
User.decrement(self.id, 'following_count' => 1)
|
43
|
+
User.decrement(friend.id, 'followers_count' => 1)
|
44
|
+
|
45
|
+
on_remove_friend(friend)
|
46
|
+
end
|
47
|
+
|
48
|
+
def on_remove_friend(friend)
|
49
|
+
raise NotImplementedError
|
50
|
+
end
|
51
|
+
|
52
|
+
def followers
|
53
|
+
User.find(self.friend_list.followers_ids)
|
54
|
+
end
|
55
|
+
|
56
|
+
def following
|
57
|
+
User.find(self.friend_list.following_ids)
|
58
|
+
end
|
59
|
+
|
60
|
+
def following?(user)
|
61
|
+
self.friend_list.following_ids.include?(user.id)
|
62
|
+
end
|
63
|
+
|
64
|
+
protected
|
65
|
+
def create_friend_list
|
66
|
+
self.friend_list = FriendList.new unless self.friend_list.present?
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
|
71
|
+
module ClassMethods
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{mm-friendable}
|
8
|
+
s.version = "1.0.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Luke Cunningham"]
|
12
|
+
s.date = %q{2010-11-17}
|
13
|
+
s.description = %q{A very simple mongomapper plugin to add friendship functionality to your application}
|
14
|
+
s.email = %q{luke@icaruswings.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
".rspec",
|
22
|
+
"Gemfile",
|
23
|
+
"Gemfile.lock",
|
24
|
+
"LICENSE.txt",
|
25
|
+
"README.rdoc",
|
26
|
+
"Rakefile",
|
27
|
+
"VERSION",
|
28
|
+
"lib/mm-friendable.rb",
|
29
|
+
"lib/mongo_mapper/plugins/friendable.rb",
|
30
|
+
"lib/mongo_mapper/plugins/friendable/friend_list.rb",
|
31
|
+
"mm-friendable.gemspec",
|
32
|
+
"spec/mm-friendable_spec.rb",
|
33
|
+
"spec/spec_helper.rb",
|
34
|
+
"spec/support/models.rb"
|
35
|
+
]
|
36
|
+
s.homepage = %q{http://github.com/icaruswings/mm-friendable}
|
37
|
+
s.licenses = ["MIT"]
|
38
|
+
s.require_paths = ["lib"]
|
39
|
+
s.rubygems_version = %q{1.3.7}
|
40
|
+
s.summary = %q{A very simple mongomapper plugin to add friendship functionaity to your application}
|
41
|
+
s.test_files = [
|
42
|
+
"spec/mm-friendable_spec.rb",
|
43
|
+
"spec/spec_helper.rb",
|
44
|
+
"spec/support/models.rb"
|
45
|
+
]
|
46
|
+
|
47
|
+
if s.respond_to? :specification_version then
|
48
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
49
|
+
s.specification_version = 3
|
50
|
+
|
51
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
52
|
+
s.add_development_dependency(%q<mongo>, ["= 1.1.2"])
|
53
|
+
s.add_development_dependency(%q<bson_ext>, ["= 1.1.2"])
|
54
|
+
s.add_development_dependency(%q<mongo_ext>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<mongo_mapper>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<i18n>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<log_buddy>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<ruby-debug>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.1.0"])
|
60
|
+
s.add_development_dependency(%q<yard>, ["~> 0.6.0"])
|
61
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.5.1"])
|
63
|
+
s.add_development_dependency(%q<rcov>, [">= 0"])
|
64
|
+
else
|
65
|
+
s.add_dependency(%q<mongo>, ["= 1.1.2"])
|
66
|
+
s.add_dependency(%q<bson_ext>, ["= 1.1.2"])
|
67
|
+
s.add_dependency(%q<mongo_ext>, [">= 0"])
|
68
|
+
s.add_dependency(%q<mongo_mapper>, [">= 0"])
|
69
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
70
|
+
s.add_dependency(%q<log_buddy>, [">= 0"])
|
71
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
72
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
73
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
74
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
75
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
76
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
77
|
+
end
|
78
|
+
else
|
79
|
+
s.add_dependency(%q<mongo>, ["= 1.1.2"])
|
80
|
+
s.add_dependency(%q<bson_ext>, ["= 1.1.2"])
|
81
|
+
s.add_dependency(%q<mongo_ext>, [">= 0"])
|
82
|
+
s.add_dependency(%q<mongo_mapper>, [">= 0"])
|
83
|
+
s.add_dependency(%q<i18n>, [">= 0"])
|
84
|
+
s.add_dependency(%q<log_buddy>, [">= 0"])
|
85
|
+
s.add_dependency(%q<ruby-debug>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rspec>, ["~> 2.1.0"])
|
87
|
+
s.add_dependency(%q<yard>, ["~> 0.6.0"])
|
88
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
89
|
+
s.add_dependency(%q<jeweler>, ["~> 1.5.1"])
|
90
|
+
s.add_dependency(%q<rcov>, [">= 0"])
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe "MongoMapper::Plugins::Friendable" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@friendable = User.create(:email => 'lukec@icaruswings.com')
|
7
|
+
@friend = User.create(:email => 'luke@icaruswings.com')
|
8
|
+
end
|
9
|
+
|
10
|
+
it "should be friendable" do
|
11
|
+
@friendable.should be_friendable
|
12
|
+
end
|
13
|
+
|
14
|
+
it "should have followers_count and following_count attributes that default to 0" do
|
15
|
+
@friendable.followers_count.should equal 0
|
16
|
+
@friendable.following_count.should equal 0
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should have a method for retrieving followers" do
|
20
|
+
@friendable.should respond_to(:followers)
|
21
|
+
end
|
22
|
+
|
23
|
+
it "should have a method for retrieving friends" do
|
24
|
+
@friendable.should respond_to(:following)
|
25
|
+
end
|
26
|
+
|
27
|
+
it "should provide the User with a friend_list" do
|
28
|
+
@friendable.should respond_to(:friend_list)
|
29
|
+
@friendable.friend_list.should be_a(FriendList)
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "add_friend!" do
|
33
|
+
|
34
|
+
it "should increment the following_count attribute" do
|
35
|
+
lambda {
|
36
|
+
@friendable.add_friend!(@friend)
|
37
|
+
|
38
|
+
}.should change(@friendable, :following_count).by(1)
|
39
|
+
end
|
40
|
+
|
41
|
+
it "should increment the followers_count attribute" do
|
42
|
+
lambda {
|
43
|
+
@friendable.add_friend!(@friend)
|
44
|
+
|
45
|
+
}.should change(@friend, :followers_count).by(1)
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should add the friend to following list" do
|
49
|
+
@friendable.add_friend!(@friend)
|
50
|
+
|
51
|
+
@friendable.friend_list.following_ids.should include(@friend.id)
|
52
|
+
@friendable.following.should include(@friend)
|
53
|
+
end
|
54
|
+
|
55
|
+
it "should add the follower" do
|
56
|
+
@friendable.add_friend!(@friend)
|
57
|
+
|
58
|
+
@friend.friend_list.followers_ids.should include(@friendable.id)
|
59
|
+
@friend.followers.should include(@friendable)
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
6
|
+
|
7
|
+
require 'fileutils'
|
8
|
+
require 'ostruct'
|
9
|
+
require 'log_buddy'
|
10
|
+
|
11
|
+
require 'rspec'
|
12
|
+
|
13
|
+
require 'mm-friendable'
|
14
|
+
|
15
|
+
# Requires supporting files with custom matchers and macros, etc,
|
16
|
+
# in ./support/ and its subdirectories.
|
17
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
18
|
+
|
19
|
+
log_dir = File.expand_path('../../log', __FILE__)
|
20
|
+
FileUtils.mkdir_p(log_dir) unless File.exist?(log_dir)
|
21
|
+
|
22
|
+
logger = Logger.new(log_dir + '/test.log')
|
23
|
+
LogBuddy.init(:logger => logger)
|
24
|
+
|
25
|
+
MongoMapper.connection = Mongo::Connection.new('127.0.0.1', 27017, :logger => logger)
|
26
|
+
MongoMapper.database = "mm-test-#{RUBY_VERSION.gsub('.', '-')}"
|
27
|
+
MongoMapper.database.collections.each { |c| c.drop_indexes }
|
28
|
+
|
29
|
+
|
30
|
+
RSpec.configure do |config|
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,263 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mm-friendable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 23
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 1.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Luke Cunningham
|
14
|
+
autorequire:
|
15
|
+
bindir: bin
|
16
|
+
cert_chain: []
|
17
|
+
|
18
|
+
date: 2010-11-17 00:00:00 +11:00
|
19
|
+
default_executable:
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: &id001 !ruby/object:Gem::Requirement
|
24
|
+
none: false
|
25
|
+
requirements:
|
26
|
+
- - "="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
hash: 23
|
29
|
+
segments:
|
30
|
+
- 1
|
31
|
+
- 1
|
32
|
+
- 2
|
33
|
+
version: 1.1.2
|
34
|
+
name: mongo
|
35
|
+
requirement: *id001
|
36
|
+
type: :development
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: &id002 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - "="
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
hash: 23
|
45
|
+
segments:
|
46
|
+
- 1
|
47
|
+
- 1
|
48
|
+
- 2
|
49
|
+
version: 1.1.2
|
50
|
+
name: bson_ext
|
51
|
+
requirement: *id002
|
52
|
+
type: :development
|
53
|
+
- !ruby/object:Gem::Dependency
|
54
|
+
prerelease: false
|
55
|
+
version_requirements: &id003 !ruby/object:Gem::Requirement
|
56
|
+
none: false
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
hash: 3
|
61
|
+
segments:
|
62
|
+
- 0
|
63
|
+
version: "0"
|
64
|
+
name: mongo_ext
|
65
|
+
requirement: *id003
|
66
|
+
type: :development
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
prerelease: false
|
69
|
+
version_requirements: &id004 !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
75
|
+
segments:
|
76
|
+
- 0
|
77
|
+
version: "0"
|
78
|
+
name: mongo_mapper
|
79
|
+
requirement: *id004
|
80
|
+
type: :development
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
prerelease: false
|
83
|
+
version_requirements: &id005 !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
hash: 3
|
89
|
+
segments:
|
90
|
+
- 0
|
91
|
+
version: "0"
|
92
|
+
name: i18n
|
93
|
+
requirement: *id005
|
94
|
+
type: :development
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
prerelease: false
|
97
|
+
version_requirements: &id006 !ruby/object:Gem::Requirement
|
98
|
+
none: false
|
99
|
+
requirements:
|
100
|
+
- - ">="
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
hash: 3
|
103
|
+
segments:
|
104
|
+
- 0
|
105
|
+
version: "0"
|
106
|
+
name: log_buddy
|
107
|
+
requirement: *id006
|
108
|
+
type: :development
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
prerelease: false
|
111
|
+
version_requirements: &id007 !ruby/object:Gem::Requirement
|
112
|
+
none: false
|
113
|
+
requirements:
|
114
|
+
- - ">="
|
115
|
+
- !ruby/object:Gem::Version
|
116
|
+
hash: 3
|
117
|
+
segments:
|
118
|
+
- 0
|
119
|
+
version: "0"
|
120
|
+
name: ruby-debug
|
121
|
+
requirement: *id007
|
122
|
+
type: :development
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
prerelease: false
|
125
|
+
version_requirements: &id008 !ruby/object:Gem::Requirement
|
126
|
+
none: false
|
127
|
+
requirements:
|
128
|
+
- - ~>
|
129
|
+
- !ruby/object:Gem::Version
|
130
|
+
hash: 11
|
131
|
+
segments:
|
132
|
+
- 2
|
133
|
+
- 1
|
134
|
+
- 0
|
135
|
+
version: 2.1.0
|
136
|
+
name: rspec
|
137
|
+
requirement: *id008
|
138
|
+
type: :development
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
prerelease: false
|
141
|
+
version_requirements: &id009 !ruby/object:Gem::Requirement
|
142
|
+
none: false
|
143
|
+
requirements:
|
144
|
+
- - ~>
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
hash: 7
|
147
|
+
segments:
|
148
|
+
- 0
|
149
|
+
- 6
|
150
|
+
- 0
|
151
|
+
version: 0.6.0
|
152
|
+
name: yard
|
153
|
+
requirement: *id009
|
154
|
+
type: :development
|
155
|
+
- !ruby/object:Gem::Dependency
|
156
|
+
prerelease: false
|
157
|
+
version_requirements: &id010 !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ~>
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
hash: 23
|
163
|
+
segments:
|
164
|
+
- 1
|
165
|
+
- 0
|
166
|
+
- 0
|
167
|
+
version: 1.0.0
|
168
|
+
name: bundler
|
169
|
+
requirement: *id010
|
170
|
+
type: :development
|
171
|
+
- !ruby/object:Gem::Dependency
|
172
|
+
prerelease: false
|
173
|
+
version_requirements: &id011 !ruby/object:Gem::Requirement
|
174
|
+
none: false
|
175
|
+
requirements:
|
176
|
+
- - ~>
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
hash: 1
|
179
|
+
segments:
|
180
|
+
- 1
|
181
|
+
- 5
|
182
|
+
- 1
|
183
|
+
version: 1.5.1
|
184
|
+
name: jeweler
|
185
|
+
requirement: *id011
|
186
|
+
type: :development
|
187
|
+
- !ruby/object:Gem::Dependency
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: &id012 !ruby/object:Gem::Requirement
|
190
|
+
none: false
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
hash: 3
|
195
|
+
segments:
|
196
|
+
- 0
|
197
|
+
version: "0"
|
198
|
+
name: rcov
|
199
|
+
requirement: *id012
|
200
|
+
type: :development
|
201
|
+
description: A very simple mongomapper plugin to add friendship functionality to your application
|
202
|
+
email: luke@icaruswings.com
|
203
|
+
executables: []
|
204
|
+
|
205
|
+
extensions: []
|
206
|
+
|
207
|
+
extra_rdoc_files:
|
208
|
+
- LICENSE.txt
|
209
|
+
- README.rdoc
|
210
|
+
files:
|
211
|
+
- .document
|
212
|
+
- .rspec
|
213
|
+
- Gemfile
|
214
|
+
- Gemfile.lock
|
215
|
+
- LICENSE.txt
|
216
|
+
- README.rdoc
|
217
|
+
- Rakefile
|
218
|
+
- VERSION
|
219
|
+
- lib/mm-friendable.rb
|
220
|
+
- lib/mongo_mapper/plugins/friendable.rb
|
221
|
+
- lib/mongo_mapper/plugins/friendable/friend_list.rb
|
222
|
+
- mm-friendable.gemspec
|
223
|
+
- spec/mm-friendable_spec.rb
|
224
|
+
- spec/spec_helper.rb
|
225
|
+
- spec/support/models.rb
|
226
|
+
has_rdoc: true
|
227
|
+
homepage: http://github.com/icaruswings/mm-friendable
|
228
|
+
licenses:
|
229
|
+
- MIT
|
230
|
+
post_install_message:
|
231
|
+
rdoc_options: []
|
232
|
+
|
233
|
+
require_paths:
|
234
|
+
- lib
|
235
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
236
|
+
none: false
|
237
|
+
requirements:
|
238
|
+
- - ">="
|
239
|
+
- !ruby/object:Gem::Version
|
240
|
+
hash: 3
|
241
|
+
segments:
|
242
|
+
- 0
|
243
|
+
version: "0"
|
244
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
245
|
+
none: false
|
246
|
+
requirements:
|
247
|
+
- - ">="
|
248
|
+
- !ruby/object:Gem::Version
|
249
|
+
hash: 3
|
250
|
+
segments:
|
251
|
+
- 0
|
252
|
+
version: "0"
|
253
|
+
requirements: []
|
254
|
+
|
255
|
+
rubyforge_project:
|
256
|
+
rubygems_version: 1.3.7
|
257
|
+
signing_key:
|
258
|
+
specification_version: 3
|
259
|
+
summary: A very simple mongomapper plugin to add friendship functionaity to your application
|
260
|
+
test_files:
|
261
|
+
- spec/mm-friendable_spec.rb
|
262
|
+
- spec/spec_helper.rb
|
263
|
+
- spec/support/models.rb
|