acts_as_taggable_on 3.0.0.rc1 → 3.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/.travis.yml +10 -1
- data/Appraisals +8 -4
- data/CHANGELOG.md +21 -0
- data/Gemfile +7 -1
- data/Rakefile +20 -2
- data/acts_as_taggable_on.gemspec +5 -5
- data/gemfiles/{rails_3.gemfile → rails_3.2.gemfile} +1 -2
- data/gemfiles/rails_4.0.gemfile +7 -0
- data/gemfiles/rails_4.1.gemfile +7 -0
- data/lib/acts-as-taggable-on.rb +7 -0
- data/lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb +7 -7
- data/lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb +10 -3
- data/lib/acts_as_taggable_on/acts_as_taggable_on/compatibility.rb +1 -1
- data/lib/acts_as_taggable_on/acts_as_taggable_on/core.rb +9 -9
- data/lib/acts_as_taggable_on/taggable.rb +6 -6
- data/lib/acts_as_taggable_on/tagger.rb +6 -6
- data/lib/acts_as_taggable_on/tags_helper.rb +1 -1
- data/lib/acts_as_taggable_on/version.rb +1 -1
- data/spec/acts_as_taggable_on/tags_helper_spec.rb +10 -10
- data/spec/spec_helper.rb +9 -26
- metadata +41 -61
- data/gemfiles/rails_4.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YmEzMjhkODU3MmQyN2NhNzk4MTBmYzdmMGI0NmY1N2FkOWQ4NWE4NQ==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0a4d9c60b736d124d299e9133f1c2bb8b3dfdf4e
|
4
|
+
data.tar.gz: 50ada0957de1ffd3b4f8e6b3ac9fca5d8fa364fe
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
Y2U0YWVlM2IxZmMwYzUzNmY0MWZjNGM1OTkwNDhkNjIyMGY4YzNmNjM2MmMz
|
11
|
-
ODQzYzljZTk2MTA3YWIxNWI4OTkyNjVjMjZiOTMwNWJlN2M1MWE=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTE1MTcxNzIxMmQ2ZTY5OTAxYmM5NzJmN2Y0ZTQ5MjM4NDY2NzU3NjYxYjI5
|
14
|
-
NjIwODI5YjM4ZDI5YWJiMzk0OGYzZjM2OTlkNmU0ZjlmOWRlZDRlOTZkYWU0
|
15
|
-
MmNmYWJiYTA0ZjQzZjIwNmI3NWE5ZjQ4YmZjZDNiMjc3ZjU2N2I=
|
6
|
+
metadata.gz: d27a9f5df388cb96817a754f8eacedece8cd91a632470e324845071e6f022859dd491989b21fd9068c61d432b529de9cf7759f18714a17fab6b324fe9e275e7e
|
7
|
+
data.tar.gz: 8fa51e04558d65593ee6d95afaa67d2e0ac2fd9453f6665864895033798e36416d35464dcbdd97f6fd21bbaf9716d2a8f6367839b4de61d2ee280c2baf3ba7e6
|
data/.travis.yml
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
script: "cp spec/database.yml.sample spec/database.yml && bundle install && bundle exec rake"
|
2
1
|
rvm:
|
3
2
|
- 1.9.3
|
4
3
|
- 2.0.0
|
@@ -6,4 +5,14 @@ env:
|
|
6
5
|
- DB=sqlite3
|
7
6
|
- DB=mysql
|
8
7
|
- DB=postgresql
|
8
|
+
gemfile:
|
9
|
+
- gemfiles/rails_3.2.gemfile
|
10
|
+
- gemfiles/rails_4.0.gemfile
|
11
|
+
- gemfiles/rails_4.1.gemfile
|
9
12
|
cache: bundler
|
13
|
+
script: bundle exec rake
|
14
|
+
before_install:
|
15
|
+
- gem install bundler
|
16
|
+
bundler_args: '--without local_development'
|
17
|
+
matrix:
|
18
|
+
fast_finish: true
|
data/Appraisals
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
appraise "rails-3" do
|
2
|
-
gem "rails", "3.2
|
1
|
+
appraise "rails-3.2" do
|
2
|
+
gem "rails", "~> 3.2"
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise "rails-4" do
|
6
|
-
gem "rails", "4.0
|
5
|
+
appraise "rails-4.0" do
|
6
|
+
gem "rails", "~> 4.0"
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise "rails-4.1" do
|
10
|
+
gem "rails", "~> 4.1.0.beta1"
|
7
11
|
end
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
Changes are below categorized as `Features, Fixes, or Misc`.
|
2
|
+
|
3
|
+
Each change should fall into categories that would affect whether the release is major (breaking changes), minor (new behavior), or patch (bug fix). See [semver](http://semver.org/) and [pessimistic versioning](http://guides.rubygems.org/patterns/#pessimistic_version_constraint)
|
4
|
+
|
5
|
+
As such, a _Feature_ would map to either major or minor. A _bug fix_ to a patch. And _misc_ is either minor or patch, the difference being kind of fuzzy for the purposes of history. Adding tests would be patch level.
|
6
|
+
|
7
|
+
### Master [changes](https://github.com/mbleigh/acts-as-taggable-on/compare/v2.4.1...master)
|
8
|
+
|
9
|
+
* Features
|
10
|
+
* Fixes
|
11
|
+
* Misc
|
12
|
+
|
13
|
+
### 3.0.0.rc2 [changes](https://github.com/mbleigh/acts-as-taggable-on/compare/fork-v3.0.0.rc1...fork-v3.0.0.rc2)
|
14
|
+
|
15
|
+
### 3.0.0.rc1 [changes](https://github.com/mbleigh/acts-as-taggable-on/compare/v2.4.1...fork-v3.0.0.rc1)
|
16
|
+
|
17
|
+
### [2.4.1 / 2013-05-07](https://github.com/mbleigh/acts-as-taggable-on/compare/v2.4.0...v2.4.1)
|
18
|
+
|
19
|
+
* Features
|
20
|
+
* Fixes
|
21
|
+
* Misc
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,28 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
|
3
|
-
require '
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
STDERR.puts "Bundler not loaded"
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Copy sample spec database.yml over if not exists'
|
9
|
+
task :copy_db_config do
|
10
|
+
cp 'spec/database.yml.sample', 'spec/database.yml'
|
11
|
+
end
|
12
|
+
|
13
|
+
task :spec => [:copy_db_config]
|
4
14
|
|
5
15
|
desc 'Default: run specs'
|
6
16
|
task :default => :spec
|
7
17
|
|
18
|
+
begin
|
19
|
+
require 'appraisal'
|
20
|
+
desc 'Run tests across gemfiles specified in Appraisals'
|
21
|
+
task :appraise => ['appraisal:cleanup', 'appraisal:install', 'appraisal']
|
22
|
+
rescue LoadError
|
23
|
+
puts "appraisal tasks not available"
|
24
|
+
end
|
25
|
+
|
8
26
|
require 'rspec/core/rake_task'
|
9
27
|
RSpec::Core::RakeTask.new do |t|
|
10
28
|
t.pattern = "spec/**/*_spec.rb"
|
data/acts_as_taggable_on.gemspec
CHANGED
@@ -24,12 +24,12 @@ Gem::Specification.new do |gem|
|
|
24
24
|
|
25
25
|
gem.add_runtime_dependency 'rails', ['>= 3', '< 5']
|
26
26
|
|
27
|
-
gem.add_development_dependency 'rspec-rails', '2.13.0' # 2.13.1 is broken
|
28
|
-
gem.add_development_dependency 'rspec', '~> 2.6'
|
29
|
-
gem.add_development_dependency 'ammeter'
|
30
27
|
gem.add_development_dependency 'sqlite3'
|
31
28
|
gem.add_development_dependency 'mysql2', '~> 0.3.7'
|
32
29
|
gem.add_development_dependency 'pg'
|
33
|
-
|
34
|
-
gem.add_development_dependency '
|
30
|
+
|
31
|
+
gem.add_development_dependency 'rspec-rails', '2.13.0' # 2.13.1 is broken
|
32
|
+
gem.add_development_dependency 'rspec', '~> 2.6'
|
33
|
+
gem.add_development_dependency 'ammeter'
|
34
|
+
|
35
35
|
end
|
@@ -0,0 +1,7 @@
|
|
1
|
+
$stderr.puts <<EOF
|
2
|
+
You are requiring 'acts-as-taggable-on' in the 'acts_as_taggable_on' gem.
|
3
|
+
This gem is a fork where new versions of the library are published.
|
4
|
+
|
5
|
+
Please change your require to 'acts_as_taggable_on'.
|
6
|
+
EOF
|
7
|
+
require_relative 'acts_as_taggable_on'
|
@@ -5,7 +5,7 @@ module ActsAsTaggableOn::Taggable
|
|
5
5
|
# has any "cached_#{tag_type}_list" column
|
6
6
|
base.instance_eval do
|
7
7
|
# @private
|
8
|
-
def
|
8
|
+
def _has_tags_cache_columns?(db_columns)
|
9
9
|
db_column_names = db_columns.map(&:name)
|
10
10
|
tag_types.any? {|context|
|
11
11
|
db_column_names.include?("cached_#{context.to_s.singularize}_list")
|
@@ -13,13 +13,13 @@ module ActsAsTaggableOn::Taggable
|
|
13
13
|
end
|
14
14
|
|
15
15
|
# @private
|
16
|
-
def
|
16
|
+
def _add_tags_caching_methods
|
17
17
|
send :include, ActsAsTaggableOn::Taggable::Cache::InstanceMethods
|
18
18
|
extend ActsAsTaggableOn::Taggable::Cache::ClassMethods
|
19
19
|
|
20
20
|
before_save :save_cached_tag_list
|
21
21
|
|
22
|
-
|
22
|
+
initialize_tags_cache
|
23
23
|
end
|
24
24
|
|
25
25
|
# ActiveRecord::Base.columns makes a database connection and caches the calculated
|
@@ -32,8 +32,8 @@ module ActsAsTaggableOn::Taggable
|
|
32
32
|
def columns
|
33
33
|
@acts_as_taggable_on_columns ||= begin
|
34
34
|
db_columns = super
|
35
|
-
if
|
36
|
-
|
35
|
+
if _has_tags_cache_columns?(db_columns)
|
36
|
+
_add_tags_caching_methods
|
37
37
|
end
|
38
38
|
db_columns
|
39
39
|
end
|
@@ -43,7 +43,7 @@ module ActsAsTaggableOn::Taggable
|
|
43
43
|
end
|
44
44
|
|
45
45
|
module ClassMethods
|
46
|
-
def
|
46
|
+
def initialize_tags_cache
|
47
47
|
tag_types.map(&:to_s).each do |tag_type|
|
48
48
|
class_eval <<-RUBY, __FILE__, __LINE__ + 1
|
49
49
|
def self.caching_#{tag_type.singularize}_list?
|
@@ -55,7 +55,7 @@ module ActsAsTaggableOn::Taggable
|
|
55
55
|
|
56
56
|
def acts_as_taggable_on(*args)
|
57
57
|
super(*args)
|
58
|
-
|
58
|
+
initialize_tags_cache
|
59
59
|
end
|
60
60
|
|
61
61
|
def caching_tag_list_on?(context)
|
@@ -90,7 +90,7 @@ module ActsAsTaggableOn::Taggable
|
|
90
90
|
tagging_scope = tagging_scope.where("#{ActsAsTaggableOn::Tagging.table_name}.taggable_id IN(#{safe_to_sql(select(scoped_select))})").group(group_columns)
|
91
91
|
|
92
92
|
tag_scope = tag_scope.joins("JOIN (#{safe_to_sql(tagging_scope)}) AS #{ActsAsTaggableOn::Tagging.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.id")
|
93
|
-
tag_scope
|
93
|
+
tag_scope.extending(CalculationMethods)
|
94
94
|
end
|
95
95
|
|
96
96
|
##
|
@@ -170,7 +170,7 @@ module ActsAsTaggableOn::Taggable
|
|
170
170
|
tagging_scope = tagging_scope.group(group_columns).having(having)
|
171
171
|
|
172
172
|
tag_scope = tag_scope.joins("JOIN (#{safe_to_sql(tagging_scope)}) AS #{ActsAsTaggableOn::Tagging.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.id")
|
173
|
-
tag_scope
|
173
|
+
tag_scope.extending(CalculationMethods)
|
174
174
|
end
|
175
175
|
|
176
176
|
def safe_to_sql(relation)
|
@@ -183,5 +183,12 @@ module ActsAsTaggableOn::Taggable
|
|
183
183
|
self.class.tag_counts_on(context, options.merge(:id => id))
|
184
184
|
end
|
185
185
|
end
|
186
|
+
|
187
|
+
module CalculationMethods
|
188
|
+
def count
|
189
|
+
# https://github.com/rails/rails/commit/da9b5d4a8435b744fcf278fffd6d7f1e36d4a4f2
|
190
|
+
super(:all)
|
191
|
+
end
|
192
|
+
end
|
186
193
|
end
|
187
|
-
end
|
194
|
+
end
|
@@ -104,14 +104,14 @@ module ActsAsTaggableOn::Taggable
|
|
104
104
|
tags_conditions = tag_list.map { |t| sanitize_sql(["#{ActsAsTaggableOn::Tag.table_name}.name #{like_operator} ?", t]) }.join(" OR ")
|
105
105
|
end
|
106
106
|
|
107
|
-
conditions << "#{table_name}.#{primary_key} NOT IN (SELECT #{ActsAsTaggableOn::Tagging.table_name}.taggable_id FROM #{ActsAsTaggableOn::Tagging.table_name} JOIN #{ActsAsTaggableOn::Tag.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.#{ActsAsTaggableOn::Tag.primary_key} AND (#{tags_conditions}) WHERE #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name)})"
|
107
|
+
conditions << "#{table_name}.#{primary_key} NOT IN (SELECT #{ActsAsTaggableOn::Tagging.table_name}.taggable_id FROM #{ActsAsTaggableOn::Tagging.table_name} JOIN #{ActsAsTaggableOn::Tag.table_name} ON #{ActsAsTaggableOn::Tagging.table_name}.tag_id = #{ActsAsTaggableOn::Tag.table_name}.#{ActsAsTaggableOn::Tag.primary_key} AND (#{tags_conditions}) WHERE #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name, nil)})"
|
108
108
|
|
109
109
|
if owned_by
|
110
110
|
joins << "JOIN #{ActsAsTaggableOn::Tagging.table_name}" +
|
111
111
|
" ON #{ActsAsTaggableOn::Tagging.table_name}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" +
|
112
|
-
" AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name)}" +
|
113
|
-
" AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_id = #{quote_value(owned_by.id)}" +
|
114
|
-
" AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_type = #{quote_value(owned_by.class.base_class.to_s)}"
|
112
|
+
" AND #{ActsAsTaggableOn::Tagging.table_name}.taggable_type = #{quote_value(base_class.name, nil)}" +
|
113
|
+
" AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_id = #{quote_value(owned_by.id, nil)}" +
|
114
|
+
" AND #{ActsAsTaggableOn::Tagging.table_name}.tagger_type = #{quote_value(owned_by.class.base_class.to_s, nil)}"
|
115
115
|
end
|
116
116
|
|
117
117
|
elsif options.delete(:any)
|
@@ -134,11 +134,11 @@ module ActsAsTaggableOn::Taggable
|
|
134
134
|
|
135
135
|
tagging_join = "JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" +
|
136
136
|
" ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" +
|
137
|
-
" AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name)}"
|
137
|
+
" AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name, nil)}"
|
138
138
|
tagging_join << " AND " + sanitize_sql(["#{taggings_alias}.context = ?", context.to_s]) if context
|
139
139
|
|
140
140
|
# don't need to sanitize sql, map all ids and join with OR logic
|
141
|
-
conditions << tags.map { |t| "#{taggings_alias}.tag_id = #{quote_value(t.id)}" }.join(" OR ")
|
141
|
+
conditions << tags.map { |t| "#{taggings_alias}.tag_id = #{quote_value(t.id, nil)}" }.join(" OR ")
|
142
142
|
select_clause = "DISTINCT #{table_name}.*" unless context and tag_types.one?
|
143
143
|
|
144
144
|
if owned_by
|
@@ -160,8 +160,8 @@ module ActsAsTaggableOn::Taggable
|
|
160
160
|
taggings_alias = adjust_taggings_alias("#{alias_base_name[0..11]}_taggings_#{sha_prefix(tag.name)}")
|
161
161
|
tagging_join = "JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" +
|
162
162
|
" ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" +
|
163
|
-
" AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name)}" +
|
164
|
-
" AND #{taggings_alias}.tag_id = #{quote_value(tag.id)}"
|
163
|
+
" AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name, nil)}" +
|
164
|
+
" AND #{taggings_alias}.tag_id = #{quote_value(tag.id, nil)}"
|
165
165
|
|
166
166
|
tagging_join << " AND " + sanitize_sql(["#{taggings_alias}.context = ?", context.to_s]) if context
|
167
167
|
|
@@ -183,7 +183,7 @@ module ActsAsTaggableOn::Taggable
|
|
183
183
|
if options.delete(:match_all)
|
184
184
|
joins << "LEFT OUTER JOIN #{ActsAsTaggableOn::Tagging.table_name} #{taggings_alias}" +
|
185
185
|
" ON #{taggings_alias}.taggable_id = #{quote}#{table_name}#{quote}.#{primary_key}" +
|
186
|
-
" AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name)}"
|
186
|
+
" AND #{taggings_alias}.taggable_type = #{quote_value(base_class.name, nil)}"
|
187
187
|
|
188
188
|
|
189
189
|
group_columns = ActsAsTaggableOn::Tag.using_postgresql? ? grouped_column_names_for(self) : "#{table_name}.#{primary_key}"
|
@@ -25,7 +25,7 @@ module ActsAsTaggableOn
|
|
25
25
|
def acts_as_ordered_taggable
|
26
26
|
acts_as_ordered_taggable_on :tags
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
##
|
30
30
|
# Make a model taggable on specified contexts.
|
31
31
|
#
|
@@ -38,8 +38,8 @@ module ActsAsTaggableOn
|
|
38
38
|
def acts_as_taggable_on(*tag_types)
|
39
39
|
taggable_on(false, tag_types)
|
40
40
|
end
|
41
|
-
|
42
|
-
|
41
|
+
|
42
|
+
|
43
43
|
##
|
44
44
|
# Make a model taggable on specified contexts
|
45
45
|
# and preserves the order in which tags are created
|
@@ -53,9 +53,9 @@ module ActsAsTaggableOn
|
|
53
53
|
def acts_as_ordered_taggable_on(*tag_types)
|
54
54
|
taggable_on(true, tag_types)
|
55
55
|
end
|
56
|
-
|
56
|
+
|
57
57
|
private
|
58
|
-
|
58
|
+
|
59
59
|
# Make a model taggable on specified contexts
|
60
60
|
# and optionally preserves the order in which tags are created
|
61
61
|
#
|
@@ -78,7 +78,7 @@ module ActsAsTaggableOn
|
|
78
78
|
self.tag_types = tag_types
|
79
79
|
class_attribute :preserve_tag_order
|
80
80
|
self.preserve_tag_order = preserve_tag_order
|
81
|
-
|
81
|
+
|
82
82
|
class_eval do
|
83
83
|
has_many :taggings, :as => :taggable, :dependent => :destroy, :class_name => "ActsAsTaggableOn::Tagging"
|
84
84
|
has_many :base_tags, :through => :taggings, :source => :tag, :class_name => "ActsAsTaggableOn::Tag"
|
@@ -15,17 +15,17 @@ module ActsAsTaggableOn
|
|
15
15
|
# end
|
16
16
|
def acts_as_tagger(opts={})
|
17
17
|
class_eval do
|
18
|
-
has_many_with_compatibility :owned_taggings,
|
18
|
+
has_many_with_compatibility :owned_taggings,
|
19
19
|
opts.merge(
|
20
|
-
:as => :tagger,
|
20
|
+
:as => :tagger,
|
21
21
|
:dependent => :destroy,
|
22
22
|
:class_name => "ActsAsTaggableOn::Tagging"
|
23
23
|
)
|
24
24
|
|
25
|
-
has_many_with_compatibility :owned_tags,
|
26
|
-
:through => :owned_taggings,
|
27
|
-
:source => :tag,
|
28
|
-
:class_name => "ActsAsTaggableOn::Tag",
|
25
|
+
has_many_with_compatibility :owned_tags,
|
26
|
+
:through => :owned_taggings,
|
27
|
+
:source => :tag,
|
28
|
+
:class_name => "ActsAsTaggableOn::Tag",
|
29
29
|
:uniq => true
|
30
30
|
end
|
31
31
|
|
@@ -3,40 +3,40 @@ require 'spec_helper'
|
|
3
3
|
describe ActsAsTaggableOn::TagsHelper do
|
4
4
|
before(:each) do
|
5
5
|
clean_database!
|
6
|
-
|
6
|
+
|
7
7
|
@bob = TaggableModel.create(:name => "Bob Jones", :language_list => "ruby, php")
|
8
8
|
@tom = TaggableModel.create(:name => "Tom Marley", :language_list => "ruby, java")
|
9
9
|
@eve = TaggableModel.create(:name => "Eve Nodd", :language_list => "ruby, c++")
|
10
|
-
|
10
|
+
|
11
11
|
@helper = class Helper
|
12
12
|
include ActsAsTaggableOn::TagsHelper
|
13
13
|
end.new
|
14
14
|
end
|
15
|
-
|
16
|
-
it "should yield the proper css classes" do
|
15
|
+
|
16
|
+
it "should yield the proper css classes" do
|
17
17
|
tags = { }
|
18
|
-
|
18
|
+
|
19
19
|
@helper.tag_cloud(TaggableModel.tag_counts_on(:languages), ["sucky", "awesome"]) do |tag, css_class|
|
20
20
|
tags[tag.name] = css_class
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
tags["ruby"].should == "awesome"
|
24
24
|
tags["java"].should == "sucky"
|
25
25
|
tags["c++"].should == "sucky"
|
26
26
|
tags["php"].should == "sucky"
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
it "should handle tags with zero counts (build for empty)" do
|
30
30
|
bob = ActsAsTaggableOn::Tag.create(:name => "php")
|
31
31
|
tom = ActsAsTaggableOn::Tag.create(:name => "java")
|
32
32
|
eve = ActsAsTaggableOn::Tag.create(:name => "c++")
|
33
|
-
|
33
|
+
|
34
34
|
tags = { }
|
35
|
-
|
35
|
+
|
36
36
|
@helper.tag_cloud(ActsAsTaggableOn::Tag.all, ["sucky", "awesome"]) do |tag, css_class|
|
37
37
|
tags[tag.name] = css_class
|
38
38
|
end
|
39
|
-
|
39
|
+
|
40
40
|
tags["java"].should == "sucky"
|
41
41
|
tags["c++"].should == "sucky"
|
42
42
|
tags["php"].should == "sucky"
|
data/spec/spec_helper.rb
CHANGED
@@ -2,24 +2,7 @@ $LOAD_PATH << "." unless $LOAD_PATH.include?(".")
|
|
2
2
|
$LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__))
|
3
3
|
require 'logger'
|
4
4
|
|
5
|
-
|
6
|
-
require "rubygems"
|
7
|
-
require "bundler"
|
8
|
-
|
9
|
-
if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.5")
|
10
|
-
raise RuntimeError, "Your bundler version is too old." +
|
11
|
-
"Run `gem install bundler` to upgrade."
|
12
|
-
end
|
13
|
-
|
14
|
-
# Set up load paths for all bundled gems
|
15
|
-
Bundler.setup
|
16
|
-
rescue Bundler::GemNotFound
|
17
|
-
raise RuntimeError, "Bundler couldn't find some gems." +
|
18
|
-
"Did you run \`bundle install\`?"
|
19
|
-
end
|
20
|
-
|
21
|
-
Bundler.require
|
22
|
-
require File.expand_path('../../lib/acts_as_taggable_on', __FILE__)
|
5
|
+
require File.expand_path('../../lib/acts-as-taggable-on', __FILE__)
|
23
6
|
require 'ammeter/init'
|
24
7
|
|
25
8
|
unless [].respond_to?(:freq)
|
@@ -39,39 +22,39 @@ database_yml = File.expand_path('../database.yml', __FILE__)
|
|
39
22
|
|
40
23
|
if File.exists?(database_yml)
|
41
24
|
active_record_configuration = YAML.load_file(database_yml)
|
42
|
-
|
25
|
+
|
43
26
|
ActiveRecord::Base.configurations = active_record_configuration
|
44
27
|
config = ActiveRecord::Base.configurations[db_name]
|
45
|
-
|
28
|
+
|
46
29
|
begin
|
47
30
|
ActiveRecord::Base.establish_connection(db_name)
|
48
31
|
ActiveRecord::Base.connection
|
49
32
|
rescue
|
50
33
|
case db_name
|
51
|
-
when /mysql/
|
34
|
+
when /mysql/
|
52
35
|
ActiveRecord::Base.establish_connection(config.merge('database' => nil))
|
53
36
|
ActiveRecord::Base.connection.create_database(config['database'], {:charset => 'utf8', :collation => 'utf8_unicode_ci'})
|
54
37
|
when 'postgresql'
|
55
38
|
ActiveRecord::Base.establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
|
56
39
|
ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => 'utf8'))
|
57
40
|
end
|
58
|
-
|
41
|
+
|
59
42
|
ActiveRecord::Base.establish_connection(config)
|
60
43
|
end
|
61
|
-
|
44
|
+
|
62
45
|
logger = ActiveRecord::Base.logger = Logger.new(File.join(File.dirname(__FILE__), "debug.log"))
|
63
46
|
ActiveRecord::Base.default_timezone = :utc
|
64
|
-
|
47
|
+
|
65
48
|
begin
|
66
49
|
old_logger_level, logger.level = logger.level, ::Logger::ERROR
|
67
50
|
ActiveRecord::Migration.verbose = false
|
68
|
-
|
51
|
+
|
69
52
|
load(File.dirname(__FILE__) + '/schema.rb')
|
70
53
|
load(File.dirname(__FILE__) + '/models.rb')
|
71
54
|
ensure
|
72
55
|
logger.level = old_logger_level
|
73
56
|
end
|
74
|
-
|
57
|
+
|
75
58
|
else
|
76
59
|
raise "Please create #{database_yml} first to configure your database. Take a look at: #{database_yml}.sample"
|
77
60
|
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.0.0.
|
4
|
+
version: 3.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Bleigh
|
@@ -9,13 +9,13 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-12-
|
12
|
+
date: 2013-12-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '3'
|
21
21
|
- - <
|
@@ -25,122 +25,94 @@ dependencies:
|
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
27
27
|
requirements:
|
28
|
-
- -
|
28
|
+
- - '>='
|
29
29
|
- !ruby/object:Gem::Version
|
30
30
|
version: '3'
|
31
31
|
- - <
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '5'
|
34
34
|
- !ruby/object:Gem::Dependency
|
35
|
-
name:
|
35
|
+
name: sqlite3
|
36
36
|
requirement: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '
|
38
|
+
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: '0'
|
41
41
|
type: :development
|
42
42
|
prerelease: false
|
43
43
|
version_requirements: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - '
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
|
-
name:
|
49
|
+
name: mysql2
|
50
50
|
requirement: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 0.3.7
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
57
|
version_requirements: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 0.3.7
|
62
62
|
- !ruby/object:Gem::Dependency
|
63
|
-
name:
|
63
|
+
name: pg
|
64
64
|
requirement: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
type: :development
|
70
70
|
prerelease: false
|
71
71
|
version_requirements: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
- !ruby/object:Gem::Dependency
|
77
|
-
name:
|
77
|
+
name: rspec-rails
|
78
78
|
requirement: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 2.13.0
|
83
83
|
type: :development
|
84
84
|
prerelease: false
|
85
85
|
version_requirements: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version:
|
89
|
+
version: 2.13.0
|
90
90
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
91
|
+
name: rspec
|
92
92
|
requirement: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version:
|
96
|
+
version: '2.6'
|
97
97
|
type: :development
|
98
98
|
prerelease: false
|
99
99
|
version_requirements: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
104
|
-
- !ruby/object:Gem::Dependency
|
105
|
-
name: pg
|
106
|
-
requirement: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ! '>='
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
|
-
type: :development
|
112
|
-
prerelease: false
|
113
|
-
version_requirements: !ruby/object:Gem::Requirement
|
114
|
-
requirements:
|
115
|
-
- - ! '>='
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
version: '0'
|
118
|
-
- !ruby/object:Gem::Dependency
|
119
|
-
name: guard
|
120
|
-
requirement: !ruby/object:Gem::Requirement
|
121
|
-
requirements:
|
122
|
-
- - ! '>='
|
123
|
-
- !ruby/object:Gem::Version
|
124
|
-
version: '0'
|
125
|
-
type: :development
|
126
|
-
prerelease: false
|
127
|
-
version_requirements: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ! '>='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
103
|
+
version: '2.6'
|
132
104
|
- !ruby/object:Gem::Dependency
|
133
|
-
name:
|
105
|
+
name: ammeter
|
134
106
|
requirement: !ruby/object:Gem::Requirement
|
135
107
|
requirements:
|
136
|
-
- -
|
108
|
+
- - '>='
|
137
109
|
- !ruby/object:Gem::Version
|
138
110
|
version: '0'
|
139
111
|
type: :development
|
140
112
|
prerelease: false
|
141
113
|
version_requirements: !ruby/object:Gem::Requirement
|
142
114
|
requirements:
|
143
|
-
- -
|
115
|
+
- - '>='
|
144
116
|
- !ruby/object:Gem::Version
|
145
117
|
version: '0'
|
146
118
|
description: With ActsAsTaggableOn, you can tag a single model on several contexts,
|
@@ -156,6 +128,7 @@ files:
|
|
156
128
|
- .rspec
|
157
129
|
- .travis.yml
|
158
130
|
- Appraisals
|
131
|
+
- CHANGELOG.md
|
159
132
|
- Gemfile
|
160
133
|
- Guardfile
|
161
134
|
- LICENSE.md
|
@@ -165,8 +138,10 @@ files:
|
|
165
138
|
- acts_as_taggable_on.gemspec
|
166
139
|
- db/migrate/1_acts_as_taggable_on_migration.rb
|
167
140
|
- db/migrate/2_add_missing_unique_indices.rb
|
168
|
-
- gemfiles/rails_3.gemfile
|
169
|
-
- gemfiles/rails_4.gemfile
|
141
|
+
- gemfiles/rails_3.2.gemfile
|
142
|
+
- gemfiles/rails_4.0.gemfile
|
143
|
+
- gemfiles/rails_4.1.gemfile
|
144
|
+
- lib/acts-as-taggable-on.rb
|
170
145
|
- lib/acts_as_taggable_on.rb
|
171
146
|
- lib/acts_as_taggable_on/acts_as_taggable_on/cache.rb
|
172
147
|
- lib/acts_as_taggable_on/acts_as_taggable_on/collection.rb
|
@@ -205,20 +180,25 @@ homepage: https://github.com/mbleigh/acts-as-taggable-on
|
|
205
180
|
licenses:
|
206
181
|
- MIT
|
207
182
|
metadata: {}
|
208
|
-
post_install_message:
|
209
|
-
|
210
|
-
|
183
|
+
post_install_message: |
|
184
|
+
When upgrading
|
185
|
+
|
186
|
+
Re-run the migrations generator
|
187
|
+
|
188
|
+
rake railties:install:migrations FROM=acts_as_taggable_on_engine db:migrate
|
189
|
+
|
190
|
+
It will create any new migrations and skip existing ones
|
211
191
|
rdoc_options: []
|
212
192
|
require_paths:
|
213
193
|
- lib
|
214
194
|
required_ruby_version: !ruby/object:Gem::Requirement
|
215
195
|
requirements:
|
216
|
-
- -
|
196
|
+
- - '>='
|
217
197
|
- !ruby/object:Gem::Version
|
218
198
|
version: '0'
|
219
199
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
200
|
requirements:
|
221
|
-
- -
|
201
|
+
- - '>'
|
222
202
|
- !ruby/object:Gem::Version
|
223
203
|
version: 1.3.1
|
224
204
|
requirements: []
|