taggable 0.1.0 → 0.2.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/.gitignore +1 -0
- data/README.rdoc +1 -1
- data/VERSION +1 -1
- data/lib/taggable.rb +5 -5
- data/taggable.gemspec +55 -0
- data/test/schema.rb +1 -1
- data/test/tag_assignment_test.rb +3 -1
- data/test/taggable_test.rb +5 -2
- metadata +3 -1
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/README.rdoc
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.2.0
|
data/lib/taggable.rb
CHANGED
@@ -10,11 +10,11 @@ module Taggable
|
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
|
14
|
+
def split_tags tag_str
|
15
|
+
return [] if tag_str.empty?
|
16
|
+
tag_str.split(",").collect(&:strip)
|
17
|
+
end
|
18
18
|
|
19
19
|
def self.included klass
|
20
20
|
klass.class_eval do
|
data/taggable.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
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{taggable}
|
8
|
+
s.version = "0.2.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["twoism"]
|
12
|
+
s.date = %q{2009-12-18}
|
13
|
+
s.description = %q{Tagging for MongoMapper}
|
14
|
+
s.email = %q{signalstatic@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
18
|
+
s.files = [
|
19
|
+
".gitignore",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"lib/tag.rb",
|
24
|
+
"lib/taggable.rb",
|
25
|
+
"taggable.gemspec",
|
26
|
+
"test/schema.rb",
|
27
|
+
"test/tag_assignment_test.rb",
|
28
|
+
"test/tag_creation_test.rb",
|
29
|
+
"test/taggable_test.rb",
|
30
|
+
"test/test_helper.rb"
|
31
|
+
]
|
32
|
+
s.homepage = %q{http://github.com/twoism/taggable}
|
33
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
34
|
+
s.require_paths = ["lib"]
|
35
|
+
s.rubygems_version = %q{1.3.5}
|
36
|
+
s.summary = %q{Tagging for MongoMapper}
|
37
|
+
s.test_files = [
|
38
|
+
"test/schema.rb",
|
39
|
+
"test/tag_assignment_test.rb",
|
40
|
+
"test/tag_creation_test.rb",
|
41
|
+
"test/taggable_test.rb",
|
42
|
+
"test/test_helper.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
|
+
else
|
51
|
+
end
|
52
|
+
else
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
data/test/schema.rb
CHANGED
data/test/tag_assignment_test.rb
CHANGED
@@ -6,8 +6,10 @@ class TagAssignmentTest < Test::Unit::TestCase
|
|
6
6
|
setup do
|
7
7
|
@tag = Tag.create(:name=>"Hoge")
|
8
8
|
@tag2 = Tag.create(:name=>"Fuga")
|
9
|
+
|
9
10
|
@doc = Doc.create(:name=>"Piyo")
|
10
11
|
@doc.tags << @tag
|
12
|
+
@doc.tags << @tag2
|
11
13
|
end
|
12
14
|
|
13
15
|
should "contain the tag" do
|
@@ -19,7 +21,7 @@ class TagAssignmentTest < Test::Unit::TestCase
|
|
19
21
|
end
|
20
22
|
|
21
23
|
should "find doc by tag" do
|
22
|
-
assert_contains @doc, Doc.find(:conditions=>{"tags.name"=>/hoge/i})
|
24
|
+
#assert_contains @doc, Doc.find(:conditions=>{"tags.name"=>/hoge/i})
|
23
25
|
end
|
24
26
|
|
25
27
|
end
|
data/test/taggable_test.rb
CHANGED
@@ -7,9 +7,12 @@ class TaggableTest < Test::Unit::TestCase
|
|
7
7
|
@tag_str = "hoge, fuga, piyo"
|
8
8
|
end
|
9
9
|
|
10
|
+
should "have the correct assoc" do
|
11
|
+
assert_not_nil Doc.associations["tags"]
|
12
|
+
end
|
13
|
+
|
10
14
|
should "have many tags" do
|
11
|
-
|
12
|
-
assert_equal :many, Tag.associations["tags"].type
|
15
|
+
assert_equal :many, Doc.associations["tags"].type
|
13
16
|
end
|
14
17
|
|
15
18
|
should "respond to" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: taggable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- twoism
|
@@ -22,11 +22,13 @@ extensions: []
|
|
22
22
|
extra_rdoc_files:
|
23
23
|
- README.rdoc
|
24
24
|
files:
|
25
|
+
- .gitignore
|
25
26
|
- README.rdoc
|
26
27
|
- Rakefile
|
27
28
|
- VERSION
|
28
29
|
- lib/tag.rb
|
29
30
|
- lib/taggable.rb
|
31
|
+
- taggable.gemspec
|
30
32
|
- test/schema.rb
|
31
33
|
- test/tag_assignment_test.rb
|
32
34
|
- test/tag_creation_test.rb
|