acts-as-taggable-on 3.2.3 → 3.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +8 -7
  3. data/Gemfile +0 -1
  4. data/acts-as-taggable-on.gemspec +6 -7
  5. data/gemfiles/activerecord_3.2.gemfile +0 -1
  6. data/gemfiles/activerecord_4.0.gemfile +0 -1
  7. data/gemfiles/activerecord_4.1.gemfile +0 -1
  8. data/gemfiles/activerecord_edge.gemfile +0 -1
  9. data/lib/acts-as-taggable-on.rb +26 -20
  10. data/lib/acts_as_taggable_on/{acts_as_taggable_on/compatibility.rb → compatibility.rb} +0 -0
  11. data/lib/acts_as_taggable_on/tag_list.rb +13 -77
  12. data/lib/acts_as_taggable_on/tag_list_parser.rb +78 -0
  13. data/lib/acts_as_taggable_on/taggable.rb +7 -6
  14. data/lib/acts_as_taggable_on/{acts_as_taggable_on → taggable}/cache.rb +0 -0
  15. data/lib/acts_as_taggable_on/{acts_as_taggable_on → taggable}/collection.rb +0 -0
  16. data/lib/acts_as_taggable_on/{acts_as_taggable_on → taggable}/core.rb +14 -10
  17. data/lib/acts_as_taggable_on/{acts_as_taggable_on → taggable}/dirty.rb +0 -0
  18. data/lib/acts_as_taggable_on/{acts_as_taggable_on → taggable}/ownership.rb +1 -1
  19. data/lib/acts_as_taggable_on/{acts_as_taggable_on → taggable}/related.rb +0 -0
  20. data/lib/acts_as_taggable_on/utils.rb +2 -26
  21. data/lib/acts_as_taggable_on/version.rb +1 -1
  22. data/spec/acts_as_taggable_on/acts_as_taggable_on_spec.rb +1 -1
  23. data/spec/acts_as_taggable_on/acts_as_tagger_spec.rb +1 -0
  24. data/spec/acts_as_taggable_on/caching_spec.rb +1 -0
  25. data/spec/acts_as_taggable_on/related_spec.rb +1 -0
  26. data/spec/acts_as_taggable_on/single_table_inheritance_spec.rb +1 -0
  27. data/spec/acts_as_taggable_on/tag_list_parser_spec.rb +46 -0
  28. data/spec/acts_as_taggable_on/tag_list_spec.rb +3 -40
  29. data/spec/acts_as_taggable_on/tag_spec.rb +29 -35
  30. data/spec/acts_as_taggable_on/taggable_spec.rb +55 -55
  31. data/spec/acts_as_taggable_on/tagger_spec.rb +1 -0
  32. data/spec/acts_as_taggable_on/tagging_spec.rb +2 -1
  33. data/spec/acts_as_taggable_on/tags_helper_spec.rb +1 -0
  34. data/spec/acts_as_taggable_on/utils_spec.rb +1 -0
  35. data/spec/internal/app/models/cached_model_with_array.rb +1 -1
  36. data/spec/internal/app/models/models.rb +2 -2
  37. data/spec/internal/db/schema.rb +2 -2
  38. data/spec/spec_helper.rb +0 -1
  39. data/spec/support/0-helpers.rb +32 -0
  40. metadata +36 -47
  41. data/spec/schema.rb +0 -82
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe 'Tagger' do
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe ActsAsTaggableOn::Tagging do
@@ -48,4 +49,4 @@ describe ActsAsTaggableOn::Tagging do
48
49
 
49
50
  end
50
51
 
51
- end
52
+ end
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe ActsAsTaggableOn::TagsHelper do
@@ -1,3 +1,4 @@
1
+ # -*- encoding : utf-8 -*-
1
2
  require 'spec_helper'
2
3
 
3
4
  describe ActsAsTaggableOn::Utils do
@@ -1,4 +1,4 @@
1
- if ActsAsTaggableOn::Utils.using_postgresql?
1
+ if using_postgresql?
2
2
  class CachedModelWithArray < ActiveRecord::Base
3
3
  acts_as_taggable
4
4
  end
@@ -77,11 +77,11 @@ class OrderedTaggableModel < ActiveRecord::Base
77
77
  acts_as_ordered_taggable_on :colours
78
78
  end
79
79
 
80
- if ActsAsTaggableOn::Utils.using_postgresql?
80
+ if using_postgresql?
81
81
  class CachedModelWithArray < ActiveRecord::Base
82
82
  acts_as_taggable
83
83
  end
84
- if ActsAsTaggableOn::Utils.postgresql_support_json?
84
+ if postgresql_support_json?
85
85
  class TaggableModelWithJson < ActiveRecord::Base
86
86
  acts_as_taggable
87
87
  acts_as_taggable_on :skills
@@ -76,7 +76,7 @@ ActiveRecord::Schema.define version: 0 do
76
76
 
77
77
 
78
78
  # Special cases for postgresql
79
- if ActsAsTaggableOn::Utils.using_postgresql?
79
+ if using_postgresql?
80
80
 
81
81
  create_table :other_cached_with_array_models, force: true do |t|
82
82
  t.column :name, :string
@@ -86,7 +86,7 @@ ActiveRecord::Schema.define version: 0 do
86
86
  t.column :cached_glass_list, :string, array: true
87
87
  end
88
88
 
89
- if ActsAsTaggableOn::Utils.postgresql_support_json?
89
+ if postgresql_support_json?
90
90
  create_table :taggable_model_with_jsons, :force => true do |t|
91
91
  t.column :name, :string
92
92
  t.column :type, :string
data/spec/spec_helper.rb CHANGED
@@ -6,7 +6,6 @@ require File.expand_path('../../lib/acts-as-taggable-on', __FILE__)
6
6
  I18n.enforce_available_locales = true
7
7
  require 'rails'
8
8
  require 'rspec/its'
9
- require 'ammeter/init' # <= You are next
10
9
  require 'barrier'
11
10
  require 'database_cleaner'
12
11
 
@@ -0,0 +1,32 @@
1
+ def using_sqlite?
2
+ ActsAsTaggableOn::Utils.connection && ActsAsTaggableOn::Utils.connection.adapter_name == 'SQLite'
3
+ end
4
+
5
+ def supports_concurrency?
6
+ !using_sqlite?
7
+ end
8
+
9
+ def using_postgresql?
10
+ ActsAsTaggableOn::Utils.using_postgresql?
11
+ end
12
+
13
+ def postgresql_version
14
+ if using_postgresql?
15
+ ActsAsTaggableOn::Utils.connection.execute('SHOW SERVER_VERSION').first['server_version'].to_f
16
+ else
17
+ 0.0
18
+ end
19
+ end
20
+
21
+ def postgresql_support_json?
22
+ postgresql_version >= 9.2
23
+ end
24
+
25
+
26
+ def using_mysql?
27
+ ActsAsTaggableOn::Utils.using_mysql?
28
+ end
29
+
30
+ def using_case_insensitive_collation?
31
+ using_mysql? && ActsAsTaggableOn::Utils.connection.collation =~ /_ci\Z/
32
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts-as-taggable-on
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.3
4
+ version: 3.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Bleigh
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-05-16 00:00:00.000000000 Z
12
+ date: 2014-05-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -69,16 +69,16 @@ dependencies:
69
69
  name: mysql2
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '0'
74
+ version: 0.3.7
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - "~>"
80
80
  - !ruby/object:Gem::Version
81
- version: '0'
81
+ version: 0.3.7
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: pg
84
84
  requirement: !ruby/object:Gem::Requirement
@@ -99,84 +99,70 @@ dependencies:
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 3.0.0.beta1
102
+ version: 3.0.0.beta
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
107
  - - "~>"
108
108
  - !ruby/object:Gem::Version
109
- version: 3.0.0.beta1
109
+ version: 3.0.0.beta
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: rspec-its
112
112
  requirement: !ruby/object:Gem::Requirement
113
113
  requirements:
114
- - - "~>"
114
+ - - ">="
115
115
  - !ruby/object:Gem::Version
116
- version: '1.0'
116
+ version: '0'
117
117
  type: :development
118
118
  prerelease: false
119
119
  version_requirements: !ruby/object:Gem::Requirement
120
120
  requirements:
121
- - - "~>"
121
+ - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: '1.0'
123
+ version: '0'
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: rspec
126
126
  requirement: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - '='
129
- - !ruby/object:Gem::Version
130
- version: 3.0.0.beta2
131
- type: :development
132
- prerelease: false
133
- version_requirements: !ruby/object:Gem::Requirement
134
- requirements:
135
- - - '='
136
- - !ruby/object:Gem::Version
137
- version: 3.0.0.beta2
138
- - !ruby/object:Gem::Dependency
139
- name: ammeter
140
- requirement: !ruby/object:Gem::Requirement
141
- requirements:
142
- - - "~>"
128
+ - - ">="
143
129
  - !ruby/object:Gem::Version
144
- version: '1.0'
130
+ version: '0'
145
131
  type: :development
146
132
  prerelease: false
147
133
  version_requirements: !ruby/object:Gem::Requirement
148
134
  requirements:
149
- - - "~>"
135
+ - - ">="
150
136
  - !ruby/object:Gem::Version
151
- version: '1.0'
137
+ version: '0'
152
138
  - !ruby/object:Gem::Dependency
153
139
  name: barrier
154
140
  requirement: !ruby/object:Gem::Requirement
155
141
  requirements:
156
- - - "~>"
142
+ - - ">="
157
143
  - !ruby/object:Gem::Version
158
- version: '1.0'
144
+ version: '0'
159
145
  type: :development
160
146
  prerelease: false
161
147
  version_requirements: !ruby/object:Gem::Requirement
162
148
  requirements:
163
- - - "~>"
149
+ - - ">="
164
150
  - !ruby/object:Gem::Version
165
- version: '1.0'
151
+ version: '0'
166
152
  - !ruby/object:Gem::Dependency
167
153
  name: database_cleaner
168
154
  requirement: !ruby/object:Gem::Requirement
169
155
  requirements:
170
- - - "~>"
156
+ - - ">="
171
157
  - !ruby/object:Gem::Version
172
- version: '1.2'
158
+ version: '0'
173
159
  type: :development
174
160
  prerelease: false
175
161
  version_requirements: !ruby/object:Gem::Requirement
176
162
  requirements:
177
- - - "~>"
163
+ - - ">="
178
164
  - !ruby/object:Gem::Version
179
- version: '1.2'
165
+ version: '0'
180
166
  description: With ActsAsTaggableOn, you can tag a single model on several contexts,
181
167
  such as skills, interests, and awards. It also provides other advanced functionality.
182
168
  email:
@@ -208,17 +194,18 @@ files:
208
194
  - gemfiles/activerecord_edge.gemfile
209
195
  - lib/acts-as-taggable-on.rb
210
196
  - lib/acts_as_taggable_on.rb
211
- - lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb
212
- - lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
213
- - lib/acts_as_taggable_on/acts_as_taggable_on/compatibility.rb
214
- - lib/acts_as_taggable_on/acts_as_taggable_on/core.rb
215
- - lib/acts_as_taggable_on/acts_as_taggable_on/dirty.rb
216
- - lib/acts_as_taggable_on/acts_as_taggable_on/ownership.rb
217
- - lib/acts_as_taggable_on/acts_as_taggable_on/related.rb
197
+ - lib/acts_as_taggable_on/compatibility.rb
218
198
  - lib/acts_as_taggable_on/engine.rb
219
199
  - lib/acts_as_taggable_on/tag.rb
220
200
  - lib/acts_as_taggable_on/tag_list.rb
201
+ - lib/acts_as_taggable_on/tag_list_parser.rb
221
202
  - lib/acts_as_taggable_on/taggable.rb
203
+ - lib/acts_as_taggable_on/taggable/cache.rb
204
+ - lib/acts_as_taggable_on/taggable/collection.rb
205
+ - lib/acts_as_taggable_on/taggable/core.rb
206
+ - lib/acts_as_taggable_on/taggable/dirty.rb
207
+ - lib/acts_as_taggable_on/taggable/ownership.rb
208
+ - lib/acts_as_taggable_on/taggable/related.rb
222
209
  - lib/acts_as_taggable_on/tagger.rb
223
210
  - lib/acts_as_taggable_on/tagging.rb
224
211
  - lib/acts_as_taggable_on/tags_helper.rb
@@ -229,6 +216,7 @@ files:
229
216
  - spec/acts_as_taggable_on/caching_spec.rb
230
217
  - spec/acts_as_taggable_on/related_spec.rb
231
218
  - spec/acts_as_taggable_on/single_table_inheritance_spec.rb
219
+ - spec/acts_as_taggable_on/tag_list_parser_spec.rb
232
220
  - spec/acts_as_taggable_on/tag_list_spec.rb
233
221
  - spec/acts_as_taggable_on/tag_spec.rb
234
222
  - spec/acts_as_taggable_on/taggable_spec.rb
@@ -253,8 +241,8 @@ files:
253
241
  - spec/internal/app/models/user.rb
254
242
  - spec/internal/config/database.yml.sample
255
243
  - spec/internal/db/schema.rb
256
- - spec/schema.rb
257
244
  - spec/spec_helper.rb
245
+ - spec/support/0-helpers.rb
258
246
  - spec/support/array.rb
259
247
  - spec/support/database.rb
260
248
  - spec/support/database_cleaner.rb
@@ -301,6 +289,7 @@ test_files:
301
289
  - spec/acts_as_taggable_on/caching_spec.rb
302
290
  - spec/acts_as_taggable_on/related_spec.rb
303
291
  - spec/acts_as_taggable_on/single_table_inheritance_spec.rb
292
+ - spec/acts_as_taggable_on/tag_list_parser_spec.rb
304
293
  - spec/acts_as_taggable_on/tag_list_spec.rb
305
294
  - spec/acts_as_taggable_on/tag_spec.rb
306
295
  - spec/acts_as_taggable_on/taggable_spec.rb
@@ -325,8 +314,8 @@ test_files:
325
314
  - spec/internal/app/models/user.rb
326
315
  - spec/internal/config/database.yml.sample
327
316
  - spec/internal/db/schema.rb
328
- - spec/schema.rb
329
317
  - spec/spec_helper.rb
318
+ - spec/support/0-helpers.rb
330
319
  - spec/support/array.rb
331
320
  - spec/support/database.rb
332
321
  - spec/support/database_cleaner.rb
data/spec/schema.rb DELETED
@@ -1,82 +0,0 @@
1
- ActiveRecord::Schema.define :version => 0 do
2
- create_table :tags, :force => true do |t|
3
- t.string :name
4
- t.integer :taggings_count, :default => 0
5
- end
6
- add_index "tags", ["name"], name: "index_tags_on_name", unique: true
7
-
8
- create_table :taggings, :force => true do |t|
9
- t.references :tag
10
-
11
- # You should make sure that the column created is
12
- # long enough to store the required class names.
13
- t.references :taggable, :polymorphic => true
14
- t.references :tagger, :polymorphic => true
15
-
16
- # Limit is created to prevent MySQL error on index
17
- # length for MyISAM table type: http://bit.ly/vgW2Ql
18
- t.string :context, :limit => 128
19
-
20
- t.datetime :created_at
21
- end
22
- add_index "taggings",
23
- ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"],
24
- unique: true, name: "taggings_idx"
25
-
26
- # above copied from
27
- # generators/acts_as_taggable_on/migration/migration_generator
28
-
29
- create_table :taggable_models, :force => true do |t|
30
- t.column :name, :string
31
- t.column :type, :string
32
- end
33
-
34
- create_table :non_standard_id_taggable_models, :primary_key => "an_id", :force => true do |t|
35
- t.column :name, :string
36
- t.column :type, :string
37
- end
38
-
39
- create_table :untaggable_models, :force => true do |t|
40
- t.column :taggable_model_id, :integer
41
- t.column :name, :string
42
- end
43
-
44
- create_table :cached_models, :force => true do |t|
45
- t.column :name, :string
46
- t.column :type, :string
47
- t.column :cached_tag_list, :string
48
- end
49
-
50
- create_table :other_cached_models, :force => true do |t|
51
- t.column :name, :string
52
- t.column :type, :string
53
- t.column :cached_language_list, :string
54
- t.column :cached_status_list, :string
55
- t.column :cached_glass_list, :string
56
- end
57
-
58
- create_table :users, :force => true do |t|
59
- t.column :name, :string
60
- end
61
-
62
- create_table :other_taggable_models, :force => true do |t|
63
- t.column :name, :string
64
- t.column :type, :string
65
- end
66
-
67
- create_table :ordered_taggable_models, :force => true do |t|
68
- t.column :name, :string
69
- t.column :type, :string
70
- end
71
-
72
- create_table :taggable_model_with_jsons, :force => true do |t|
73
- t.column :name, :string
74
- t.column :type, :string
75
- if self.connection.adapter_name == 'PostgreSQL' && self.connection.execute("SHOW SERVER_VERSION").first["server_version"].to_f >= 9.2
76
- type = :json
77
- else
78
- type = :string
79
- end
80
- t.column :opts, type
81
- end
82
- end