mongoid-simple-tags 0.0.1 → 0.0.2
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/Gemfile +2 -2
- data/README.rdoc +9 -0
- data/VERSION +1 -1
- data/lib/mongoid-simple-tags.rb +1 -23
- data/mongoid-simple-tags.gemspec +59 -0
- metadata +13 -12
data/Gemfile
CHANGED
data/README.rdoc
CHANGED
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
mongoid-simple-tags is a basic and simple tagging system for mongoid using map-reduce function
|
4
4
|
|
5
|
+
== Install
|
6
|
+
Add the following to Gemfile:
|
7
|
+
|
8
|
+
gem "mongoid-simple-tags"
|
9
|
+
|
5
10
|
== Usage
|
6
11
|
|
7
12
|
=== Model
|
@@ -27,6 +32,10 @@ mongoid-simple-tags is a basic and simple tagging system for mongoid using map-r
|
|
27
32
|
|
28
33
|
User.tagged_with("linux") # => [u, u2]
|
29
34
|
|
35
|
+
#using map-reduce function
|
36
|
+
|
37
|
+
User.all_tags #=>[{:name=>"free software", :count=>1}, {:name=>"linux", :count=>2}, {:name=>"tucuman", :count=>1}]
|
38
|
+
|
30
39
|
|
31
40
|
== Copyright
|
32
41
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/lib/mongoid-simple-tags.rb
CHANGED
@@ -1,25 +1,3 @@
|
|
1
|
-
# Basic tagging system for mongoid documents implemented with map-reduce function.
|
2
|
-
# chebyte.com 2011
|
3
|
-
#
|
4
|
-
# class User
|
5
|
-
# include Mongoid::Document
|
6
|
-
# include Mongoid::Document::Taggable
|
7
|
-
# end
|
8
|
-
#
|
9
|
-
# u = User.new(:name => "Tuquito")
|
10
|
-
# u.tag_list = "linux, tucuman, free software"
|
11
|
-
# u.tags # => ["linux","tucuman","free software"]
|
12
|
-
# u.save
|
13
|
-
#
|
14
|
-
# User.tagged_with("linux") # => u
|
15
|
-
# User.tagged_with(["tucuman", "free software"]) # => u
|
16
|
-
#
|
17
|
-
# u2 = User.new(:name => "ubuntu")
|
18
|
-
# u2.tag_list = "linux"
|
19
|
-
# u2.save
|
20
|
-
#
|
21
|
-
# User.tagged_with("linux") # => [u, u2]
|
22
|
-
|
23
1
|
module Mongoid
|
24
2
|
module Document
|
25
3
|
module Taggable
|
@@ -65,7 +43,7 @@ module Mongoid
|
|
65
43
|
|
66
44
|
def tagged_with(tags)
|
67
45
|
tags = [tags] unless tags.is_a? Array
|
68
|
-
|
46
|
+
criteria.in(:tags => tags).to_a
|
69
47
|
end
|
70
48
|
end
|
71
49
|
|
@@ -0,0 +1,59 @@
|
|
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{mongoid-simple-tags}
|
8
|
+
s.version = "0.0.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["chebyte"]
|
12
|
+
s.date = %q{2011-06-15}
|
13
|
+
s.description = %q{basic and simple tagging system for mongoid}
|
14
|
+
s.email = %q{maurotorres@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"LICENSE.txt",
|
17
|
+
"README.rdoc"
|
18
|
+
]
|
19
|
+
s.files = [
|
20
|
+
".document",
|
21
|
+
"Gemfile",
|
22
|
+
"Gemfile.lock",
|
23
|
+
"LICENSE.txt",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"VERSION",
|
27
|
+
"lib/mongoid-simple-tags.rb",
|
28
|
+
"mongoid-simple-tags.gemspec",
|
29
|
+
"test/helper.rb",
|
30
|
+
"test/test_mongoid-simple-tags.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/chebyte/mongoid-simple-tags}
|
33
|
+
s.licenses = ["MIT"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.5.2}
|
36
|
+
s.summary = %q{tags on mongoid made easy}
|
37
|
+
|
38
|
+
if s.respond_to? :specification_version then
|
39
|
+
s.specification_version = 3
|
40
|
+
|
41
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
42
|
+
s.add_runtime_dependency(%q<mongoid>, [">= 2.0.2"])
|
43
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
44
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.2"])
|
45
|
+
s.add_runtime_dependency(%q<mongoid>, [">= 2.0.2"])
|
46
|
+
else
|
47
|
+
s.add_dependency(%q<mongoid>, [">= 2.0.2"])
|
48
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
49
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
50
|
+
s.add_dependency(%q<mongoid>, [">= 2.0.2"])
|
51
|
+
end
|
52
|
+
else
|
53
|
+
s.add_dependency(%q<mongoid>, [">= 2.0.2"])
|
54
|
+
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
55
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.2"])
|
56
|
+
s.add_dependency(%q<mongoid>, [">= 2.0.2"])
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: mongoid-simple-tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0.
|
5
|
+
version: 0.0.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- chebyte
|
@@ -10,39 +10,39 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-06-
|
13
|
+
date: 2011-06-15 00:00:00 -03:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: mongoid
|
18
18
|
requirement: &id001 !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
|
-
- -
|
21
|
+
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version:
|
24
|
-
type: :
|
23
|
+
version: 2.0.2
|
24
|
+
type: :runtime
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: *id001
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: bundler
|
29
29
|
requirement: &id002 !ruby/object:Gem::Requirement
|
30
30
|
none: false
|
31
31
|
requirements:
|
32
32
|
- - ~>
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: 1.0.0
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: *id002
|
38
38
|
- !ruby/object:Gem::Dependency
|
39
|
-
name:
|
39
|
+
name: jeweler
|
40
40
|
requirement: &id003 !ruby/object:Gem::Requirement
|
41
41
|
none: false
|
42
42
|
requirements:
|
43
|
-
- -
|
43
|
+
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 1.6.2
|
46
46
|
type: :development
|
47
47
|
prerelease: false
|
48
48
|
version_requirements: *id003
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- Rakefile
|
76
76
|
- VERSION
|
77
77
|
- lib/mongoid-simple-tags.rb
|
78
|
+
- mongoid-simple-tags.gemspec
|
78
79
|
- test/helper.rb
|
79
80
|
- test/test_mongoid-simple-tags.rb
|
80
81
|
has_rdoc: true
|
@@ -91,7 +92,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
91
92
|
requirements:
|
92
93
|
- - ">="
|
93
94
|
- !ruby/object:Gem::Version
|
94
|
-
hash: -
|
95
|
+
hash: -3325967701609044584
|
95
96
|
segments:
|
96
97
|
- 0
|
97
98
|
version: "0"
|