acts-as-taggable-on 2.0.6 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/.rspec +2 -0
- data/.travis.yml +9 -0
- data/CHANGELOG +10 -0
- data/Gemfile +2 -9
- data/Guardfile +5 -0
- data/README.rdoc +47 -63
- data/Rakefile +9 -55
- data/acts-as-taggable-on.gemspec +28 -0
- data/lib/acts-as-taggable-on/version.rb +4 -0
- data/lib/acts-as-taggable-on.rb +7 -3
- data/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb +4 -4
- data/lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb +38 -43
- data/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb +81 -30
- data/lib/acts_as_taggable_on/acts_as_taggable_on/ownership.rb +7 -3
- data/lib/acts_as_taggable_on/acts_as_taggable_on/related.rb +23 -15
- data/lib/acts_as_taggable_on/tag.rb +21 -12
- data/lib/acts_as_taggable_on/{acts_as_taggable_on.rb → taggable.rb} +6 -5
- data/lib/acts_as_taggable_on/tagging.rb +12 -2
- data/lib/acts_as_taggable_on/tags_helper.rb +2 -2
- data/lib/acts_as_taggable_on/utils.rb +34 -0
- data/lib/generators/acts_as_taggable_on/migration/migration_generator.rb +9 -2
- data/lib/generators/acts_as_taggable_on/migration/templates/active_record/migration.rb +3 -1
- data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +242 -54
- data/spec/acts_as_taggable_on/tag_list_spec.rb +4 -0
- data/spec/acts_as_taggable_on/tag_spec.rb +52 -13
- data/spec/acts_as_taggable_on/taggable_spec.rb +131 -35
- data/spec/acts_as_taggable_on/tagger_spec.rb +14 -0
- data/spec/acts_as_taggable_on/tagging_spec.rb +2 -5
- data/spec/acts_as_taggable_on/tags_helper_spec.rb +16 -0
- data/spec/acts_as_taggable_on/utils_spec.rb +21 -0
- data/spec/database.yml.sample +4 -2
- data/spec/generators/acts_as_taggable_on/migration/migration_generator_spec.rb +22 -0
- data/spec/models.rb +14 -1
- data/spec/schema.rb +13 -0
- data/spec/spec_helper.rb +27 -6
- data/uninstall.rb +1 -0
- metadata +136 -51
- data/VERSION +0 -1
- data/generators/acts_as_taggable_on_migration/acts_as_taggable_on_migration_generator.rb +0 -7
- data/generators/acts_as_taggable_on_migration/templates/migration.rb +0 -29
- data/lib/acts_as_taggable_on/compatibility/Gemfile +0 -8
- data/lib/acts_as_taggable_on/compatibility/active_record_backports.rb +0 -17
- data/lib/acts_as_taggable_on/compatibility/postgresql.rb +0 -44
- data/spec/database.yml +0 -17
- /data/lib/acts_as_taggable_on/{acts_as_tagger.rb → tagger.rb} +0 -0
metadata
CHANGED
@@ -1,55 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts-as-taggable-on
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 2
|
7
|
-
- 0
|
8
|
-
- 6
|
9
|
-
version: 2.0.6
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.2.2
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Michael Bleigh
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
12
|
+
date: 2012-01-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: &70356686875400 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70356686875400
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: rspec
|
27
|
+
requirement: &70356686901300 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '2.5'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70356686901300
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: ammeter
|
38
|
+
requirement: &70356686900800 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.1.3
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70356686900800
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: sqlite3
|
49
|
+
requirement: &70356686900420 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70356686900420
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: mysql2
|
60
|
+
requirement: &70356686899780 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.3.7
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70356686899780
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pg
|
71
|
+
requirement: &70356686899280 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70356686899280
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: guard
|
82
|
+
requirement: &70356686898580 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70356686898580
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: guard-rspec
|
93
|
+
requirement: &70356686897920 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70356686897920
|
102
|
+
description: With ActsAsTaggableOn, you can tag a single model on several contexts,
|
103
|
+
such as skills, interests, and awards. It also provides other advanced functionality.
|
22
104
|
email: michael@intridea.com
|
23
105
|
executables: []
|
24
|
-
|
25
106
|
extensions: []
|
26
|
-
|
27
|
-
|
28
|
-
-
|
29
|
-
|
107
|
+
extra_rdoc_files: []
|
108
|
+
files:
|
109
|
+
- .gitignore
|
110
|
+
- .rspec
|
111
|
+
- .travis.yml
|
30
112
|
- CHANGELOG
|
31
113
|
- Gemfile
|
114
|
+
- Guardfile
|
32
115
|
- MIT-LICENSE
|
33
116
|
- README.rdoc
|
34
117
|
- Rakefile
|
35
|
-
-
|
36
|
-
- generators/acts_as_taggable_on_migration/acts_as_taggable_on_migration_generator.rb
|
37
|
-
- generators/acts_as_taggable_on_migration/templates/migration.rb
|
118
|
+
- acts-as-taggable-on.gemspec
|
38
119
|
- lib/acts-as-taggable-on.rb
|
39
|
-
- lib/
|
120
|
+
- lib/acts-as-taggable-on/version.rb
|
40
121
|
- lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb
|
41
122
|
- lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
|
42
123
|
- lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
|
43
124
|
- lib/acts_as_taggable_on/acts_as_taggable_on/ownership.rb
|
44
125
|
- lib/acts_as_taggable_on/acts_as_taggable_on/related.rb
|
45
|
-
- lib/acts_as_taggable_on/acts_as_tagger.rb
|
46
|
-
- lib/acts_as_taggable_on/compatibility/Gemfile
|
47
|
-
- lib/acts_as_taggable_on/compatibility/active_record_backports.rb
|
48
|
-
- lib/acts_as_taggable_on/compatibility/postgresql.rb
|
49
126
|
- lib/acts_as_taggable_on/tag.rb
|
50
127
|
- lib/acts_as_taggable_on/tag_list.rb
|
128
|
+
- lib/acts_as_taggable_on/taggable.rb
|
129
|
+
- lib/acts_as_taggable_on/tagger.rb
|
51
130
|
- lib/acts_as_taggable_on/tagging.rb
|
52
131
|
- lib/acts_as_taggable_on/tags_helper.rb
|
132
|
+
- lib/acts_as_taggable_on/utils.rb
|
53
133
|
- lib/generators/acts_as_taggable_on/migration/migration_generator.rb
|
54
134
|
- lib/generators/acts_as_taggable_on/migration/templates/active_record/migration.rb
|
55
135
|
- rails/init.rb
|
@@ -61,43 +141,45 @@ files:
|
|
61
141
|
- spec/acts_as_taggable_on/tagger_spec.rb
|
62
142
|
- spec/acts_as_taggable_on/tagging_spec.rb
|
63
143
|
- spec/acts_as_taggable_on/tags_helper_spec.rb
|
144
|
+
- spec/acts_as_taggable_on/utils_spec.rb
|
64
145
|
- spec/bm.rb
|
65
|
-
- spec/database.yml
|
66
146
|
- spec/database.yml.sample
|
147
|
+
- spec/generators/acts_as_taggable_on/migration/migration_generator_spec.rb
|
67
148
|
- spec/models.rb
|
68
149
|
- spec/schema.rb
|
69
150
|
- spec/spec_helper.rb
|
70
|
-
|
71
|
-
homepage:
|
151
|
+
- uninstall.rb
|
152
|
+
homepage: ''
|
72
153
|
licenses: []
|
73
|
-
|
74
154
|
post_install_message:
|
75
|
-
rdoc_options:
|
76
|
-
|
77
|
-
require_paths:
|
155
|
+
rdoc_options: []
|
156
|
+
require_paths:
|
78
157
|
- lib
|
79
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
159
|
+
none: false
|
160
|
+
requirements:
|
161
|
+
- - ! '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
segments:
|
84
165
|
- 0
|
85
|
-
|
86
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
166
|
+
hash: -1793358145648125
|
167
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
168
|
+
none: false
|
169
|
+
requirements:
|
170
|
+
- - ! '>='
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: '0'
|
173
|
+
segments:
|
91
174
|
- 0
|
92
|
-
|
175
|
+
hash: -1793358145648125
|
93
176
|
requirements: []
|
94
|
-
|
95
177
|
rubyforge_project:
|
96
|
-
rubygems_version: 1.
|
178
|
+
rubygems_version: 1.8.10
|
97
179
|
signing_key:
|
98
180
|
specification_version: 3
|
99
|
-
summary:
|
100
|
-
test_files:
|
181
|
+
summary: Advanced tagging for Rails.
|
182
|
+
test_files:
|
101
183
|
- spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb
|
102
184
|
- spec/acts_as_taggable_on/acts_as_tagger_spec.rb
|
103
185
|
- spec/acts_as_taggable_on/tag_list_spec.rb
|
@@ -106,7 +188,10 @@ test_files:
|
|
106
188
|
- spec/acts_as_taggable_on/tagger_spec.rb
|
107
189
|
- spec/acts_as_taggable_on/tagging_spec.rb
|
108
190
|
- spec/acts_as_taggable_on/tags_helper_spec.rb
|
191
|
+
- spec/acts_as_taggable_on/utils_spec.rb
|
109
192
|
- spec/bm.rb
|
193
|
+
- spec/database.yml.sample
|
194
|
+
- spec/generators/acts_as_taggable_on/migration/migration_generator_spec.rb
|
110
195
|
- spec/models.rb
|
111
196
|
- spec/schema.rb
|
112
197
|
- spec/spec_helper.rb
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
2.0.6
|
@@ -1,29 +0,0 @@
|
|
1
|
-
class ActsAsTaggableOnMigration < ActiveRecord::Migration
|
2
|
-
def self.up
|
3
|
-
create_table :tags do |t|
|
4
|
-
t.column :name, :string
|
5
|
-
end
|
6
|
-
|
7
|
-
create_table :taggings do |t|
|
8
|
-
t.column :tag_id, :integer
|
9
|
-
t.column :taggable_id, :integer
|
10
|
-
t.column :tagger_id, :integer
|
11
|
-
t.column :tagger_type, :string
|
12
|
-
|
13
|
-
# You should make sure that the column created is
|
14
|
-
# long enough to store the required class names.
|
15
|
-
t.column :taggable_type, :string
|
16
|
-
t.column :context, :string
|
17
|
-
|
18
|
-
t.column :created_at, :datetime
|
19
|
-
end
|
20
|
-
|
21
|
-
add_index :taggings, :tag_id
|
22
|
-
add_index :taggings, [:taggable_id, :taggable_type, :context]
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.down
|
26
|
-
drop_table :taggings
|
27
|
-
drop_table :tags
|
28
|
-
end
|
29
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
module ActsAsTaggableOn
|
2
|
-
module ActiveRecord
|
3
|
-
module Backports
|
4
|
-
def self.included(base)
|
5
|
-
base.class_eval do
|
6
|
-
named_scope :where, lambda { |conditions| { :conditions => conditions } }
|
7
|
-
named_scope :joins, lambda { |joins| { :joins => joins } }
|
8
|
-
named_scope :group, lambda { |group| { :group => group } }
|
9
|
-
named_scope :order, lambda { |order| { :order => order } }
|
10
|
-
named_scope :select, lambda { |select| { :select => select } }
|
11
|
-
named_scope :limit, lambda { |limit| { :limit => limit } }
|
12
|
-
named_scope :readonly, lambda { |readonly| { :readonly => readonly } }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
module ActsAsTaggableOn
|
2
|
-
module Taggable
|
3
|
-
module PostgreSQL
|
4
|
-
def self.included(base)
|
5
|
-
base.send :include, ActsAsTaggableOn::Taggable::PostgreSQL::InstanceMethods
|
6
|
-
base.extend ActsAsTaggableOn::Taggable::PostgreSQL::ClassMethods
|
7
|
-
|
8
|
-
ActsAsTaggableOn::Tag.class_eval do
|
9
|
-
def self.named(name)
|
10
|
-
where(["name ILIKE ?", name])
|
11
|
-
end
|
12
|
-
|
13
|
-
def self.named_any(list)
|
14
|
-
where(list.map { |tag| sanitize_sql(["name ILIKE ?", tag.to_s]) }.join(" OR "))
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.named_like(name)
|
18
|
-
where(["name ILIKE ?", "%#{name}%"])
|
19
|
-
end
|
20
|
-
|
21
|
-
def self.named_like_any(list)
|
22
|
-
where(list.map { |tag| sanitize_sql(["name ILIKE ?", "%#{tag.to_s}%"]) }.join(" OR "))
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module InstanceMethods
|
28
|
-
end
|
29
|
-
|
30
|
-
module ClassMethods
|
31
|
-
# all column names are necessary for PostgreSQL group clause
|
32
|
-
def grouped_column_names_for(*objects)
|
33
|
-
object = objects.shift
|
34
|
-
columns = object.column_names.map { |column| "#{object.table_name}.#{column}" }
|
35
|
-
columns << objects.map do |object|
|
36
|
-
"#{object.table_name}.created_at"
|
37
|
-
end.flatten
|
38
|
-
|
39
|
-
columns.flatten.join(", ")
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/database.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
sqlite3:
|
2
|
-
adapter: sqlite3
|
3
|
-
database: acts_as_taggable_on.sqlite3
|
4
|
-
|
5
|
-
mysql:
|
6
|
-
adapter: mysql
|
7
|
-
hostname: localhost
|
8
|
-
username: root
|
9
|
-
password:
|
10
|
-
database: acts_as_taggable_on
|
11
|
-
|
12
|
-
postgresql:
|
13
|
-
adapter: postgresql
|
14
|
-
hostname: localhost
|
15
|
-
username: postgres
|
16
|
-
password:
|
17
|
-
database: acts_as_taggable_on
|
File without changes
|