tagalong 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +2 -0
- data/assets/tagalong.png +0 -0
- data/lib/tagalong/taggable.rb +1 -1
- data/lib/tagalong/tagger.rb +1 -1
- data/lib/tagalong/version.rb +1 -1
- data/spec/lib/tagalong/taggable_spec.rb +12 -0
- data/spec/lib/tagalong/tagger_spec.rb +20 -0
- data/tagalong.gemspec +1 -1
- metadata +55 -18
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
[![Build Status](https://secure.travis-ci.org/cyphactor/tagalong.png?branch=master)](http://travis-ci.org/cyphactor/tagalong)
|
4
4
|
|
5
|
+
![Logo](http://github.com/cyphactor/tagalong/raw/master/assets/tagalong.png)
|
6
|
+
|
5
7
|
[Tagalong](http://github.com/cyphactor/tagalong) is a Rails tagging plugin that is intended to be clean, efficient, and simple. I have tried hard to keep the API slim and intelligable in terms of Object Oriented Programming. I focused heavily on this as I feel most other Rails tagging plugins seriously neglect OO in their APIs.
|
6
8
|
|
7
9
|
The other key differentiation between [Tagalong](http://github.com/cyphactor/tagalong) and other tagging libraries is the relational database structure behind the scenes. This database structure allows [Tagalong](http://github.com/cyphactor/tagalong) to provide not only an Object Oriented API, but also a set of features that help differentiate it from other Rails tagging plugins.
|
data/assets/tagalong.png
ADDED
Binary file
|
data/lib/tagalong/taggable.rb
CHANGED
@@ -7,7 +7,7 @@ module Tagalong
|
|
7
7
|
module ClassMethods
|
8
8
|
def tagalong_taggable
|
9
9
|
class_eval do
|
10
|
-
has_many :tagalong_taggings, :class_name => 'Tagalong::TagalongTagging', :as => :taggable
|
10
|
+
has_many :tagalong_taggings, :class_name => 'Tagalong::TagalongTagging', :as => :taggable, :dependent => :destroy
|
11
11
|
has_many :tagalong_tags, :class_name => 'Tagalong::TagalongTag', :through => :tagalong_taggings
|
12
12
|
include Tagalong::Taggable::InstanceMethods
|
13
13
|
end
|
data/lib/tagalong/tagger.rb
CHANGED
@@ -7,7 +7,7 @@ module Tagalong
|
|
7
7
|
module ClassMethods
|
8
8
|
def tagalong_tagger
|
9
9
|
class_eval do
|
10
|
-
has_many :tagalong_tags, :class_name => 'Tagalong::TagalongTag', :as => :tagger
|
10
|
+
has_many :tagalong_tags, :class_name => 'Tagalong::TagalongTag', :as => :tagger, :dependent => :destroy
|
11
11
|
include Tagalong::Tagger::InstanceMethods
|
12
12
|
end
|
13
13
|
end
|
data/lib/tagalong/version.rb
CHANGED
@@ -37,6 +37,18 @@ describe "Taggable" do
|
|
37
37
|
@contact.tags.should == ["doopty", "hoopty", "toopty"]
|
38
38
|
end
|
39
39
|
end
|
40
|
+
|
41
|
+
describe "dependent on destroy" do
|
42
|
+
let(:user) { User.create!(:name => "My Owner") }
|
43
|
+
let(:contact) { Contact.create!(:name => "My Taggable") }
|
44
|
+
|
45
|
+
it "removes the tagalong_taggings when destroyed" do
|
46
|
+
tag = user.tagalong_tags.create!(:name => "foo")
|
47
|
+
contact.tagalong_taggings.create!(:tagalong_tag_id => tag.id)
|
48
|
+
contact.destroy
|
49
|
+
expect(Tagalong::TagalongTagging.count).to be(0)
|
50
|
+
end
|
51
|
+
end
|
40
52
|
end
|
41
53
|
|
42
54
|
describe "Isolation" do
|
@@ -244,6 +244,26 @@ describe "Tagger" do
|
|
244
244
|
@user.taggables_with("jackson_five").should == []
|
245
245
|
end
|
246
246
|
end
|
247
|
+
|
248
|
+
describe "dependent on destroy" do
|
249
|
+
let(:user) { User.create!(:name => "My Owner") }
|
250
|
+
let(:contact) { Contact.create!(:name => "My Taggable") }
|
251
|
+
|
252
|
+
it "removes the tagalong_taggings when destroyed" do
|
253
|
+
tag = user.tagalong_tags.create!(:name => "foo")
|
254
|
+
contact.tagalong_taggings.create!(:tagalong_tag_id => tag.id)
|
255
|
+
user.destroy
|
256
|
+
expect(Tagalong::TagalongTagging.count).to be(0)
|
257
|
+
end
|
258
|
+
|
259
|
+
it "removes the tagalong_tags when destroyed" do
|
260
|
+
tag = user.tagalong_tags.create!(:name => "foo")
|
261
|
+
contact.tagalong_taggings.create!(:tagalong_tag_id => tag.id)
|
262
|
+
user.destroy
|
263
|
+
expect(Tagalong::TagalongTag.count).to be(0)
|
264
|
+
end
|
265
|
+
end
|
266
|
+
|
247
267
|
end
|
248
268
|
|
249
269
|
describe "Isolation" do
|
data/tagalong.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Tagalong::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency "activerecord"
|
18
|
+
gem.add_dependency "activerecord", ">= 3.0.0"
|
19
19
|
gem.add_development_dependency "sqlite3"
|
20
20
|
gem.add_development_dependency "rspec"
|
21
21
|
gem.add_development_dependency "rake"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tagalong
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,22 +10,27 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2013-04-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activerecord
|
17
|
-
requirement:
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 3.0.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements:
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ! '>='
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
version: 3.0.0
|
26
31
|
- !ruby/object:Gem::Dependency
|
27
32
|
name: sqlite3
|
28
|
-
requirement:
|
33
|
+
requirement: !ruby/object:Gem::Requirement
|
29
34
|
none: false
|
30
35
|
requirements:
|
31
36
|
- - ! '>='
|
@@ -33,10 +38,15 @@ dependencies:
|
|
33
38
|
version: '0'
|
34
39
|
type: :development
|
35
40
|
prerelease: false
|
36
|
-
version_requirements:
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ! '>='
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0'
|
37
47
|
- !ruby/object:Gem::Dependency
|
38
48
|
name: rspec
|
39
|
-
requirement:
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
40
50
|
none: false
|
41
51
|
requirements:
|
42
52
|
- - ! '>='
|
@@ -44,10 +54,15 @@ dependencies:
|
|
44
54
|
version: '0'
|
45
55
|
type: :development
|
46
56
|
prerelease: false
|
47
|
-
version_requirements:
|
57
|
+
version_requirements: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
59
|
+
requirements:
|
60
|
+
- - ! '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
48
63
|
- !ruby/object:Gem::Dependency
|
49
64
|
name: rake
|
50
|
-
requirement:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
51
66
|
none: false
|
52
67
|
requirements:
|
53
68
|
- - ! '>='
|
@@ -55,10 +70,15 @@ dependencies:
|
|
55
70
|
version: '0'
|
56
71
|
type: :development
|
57
72
|
prerelease: false
|
58
|
-
version_requirements:
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
none: false
|
75
|
+
requirements:
|
76
|
+
- - ! '>='
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '0'
|
59
79
|
- !ruby/object:Gem::Dependency
|
60
80
|
name: sunspot_rails
|
61
|
-
requirement:
|
81
|
+
requirement: !ruby/object:Gem::Requirement
|
62
82
|
none: false
|
63
83
|
requirements:
|
64
84
|
- - ! '>='
|
@@ -66,10 +86,15 @@ dependencies:
|
|
66
86
|
version: '0'
|
67
87
|
type: :development
|
68
88
|
prerelease: false
|
69
|
-
version_requirements:
|
89
|
+
version_requirements: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
70
95
|
- !ruby/object:Gem::Dependency
|
71
96
|
name: sunspot_solr
|
72
|
-
requirement:
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
73
98
|
none: false
|
74
99
|
requirements:
|
75
100
|
- - ! '>='
|
@@ -77,10 +102,15 @@ dependencies:
|
|
77
102
|
version: '0'
|
78
103
|
type: :development
|
79
104
|
prerelease: false
|
80
|
-
version_requirements:
|
105
|
+
version_requirements: !ruby/object:Gem::Requirement
|
106
|
+
none: false
|
107
|
+
requirements:
|
108
|
+
- - ! '>='
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
81
111
|
- !ruby/object:Gem::Dependency
|
82
112
|
name: sunspot_test
|
83
|
-
requirement:
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
84
114
|
none: false
|
85
115
|
requirements:
|
86
116
|
- - ! '>='
|
@@ -88,7 +118,12 @@ dependencies:
|
|
88
118
|
version: '0'
|
89
119
|
type: :development
|
90
120
|
prerelease: false
|
91
|
-
version_requirements:
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
none: false
|
123
|
+
requirements:
|
124
|
+
- - ! '>='
|
125
|
+
- !ruby/object:Gem::Version
|
126
|
+
version: '0'
|
92
127
|
description: A Rails tagging plugin that makes sense.
|
93
128
|
email:
|
94
129
|
- cyphactor@gmail.com
|
@@ -99,11 +134,13 @@ extra_rdoc_files: []
|
|
99
134
|
files:
|
100
135
|
- .gitignore
|
101
136
|
- .rvmrc
|
137
|
+
- .tagalong.gemspec.swp
|
102
138
|
- .travis.yml
|
103
139
|
- Gemfile
|
104
140
|
- LICENSE
|
105
141
|
- README.md
|
106
142
|
- Rakefile
|
143
|
+
- assets/tagalong.png
|
107
144
|
- lib/generators/tagalong/migration/migration_generator.rb
|
108
145
|
- lib/generators/tagalong/migration/templates/active_record/migration.rb
|
109
146
|
- lib/tagalong.rb
|
@@ -146,7 +183,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
183
|
version: '0'
|
147
184
|
requirements: []
|
148
185
|
rubyforge_project:
|
149
|
-
rubygems_version: 1.8.
|
186
|
+
rubygems_version: 1.8.25
|
150
187
|
signing_key:
|
151
188
|
specification_version: 3
|
152
189
|
summary: A Rails tagging plugin that makes sense.
|