gutentag 2.5.2 → 2.5.3
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.
- checksums.yaml +4 -4
- data/.rubocop.yml +16 -0
- data/.travis.yml +4 -3
- data/Appraisals +2 -2
- data/CHANGELOG.md +7 -0
- data/README.md +3 -3
- data/app/models/gutentag/tag.rb +3 -1
- data/gutentag.gemspec +3 -3
- data/lib/gutentag/active_record/instance_methods.rb +8 -1
- data/spec/acceptance/removing_unused_spec.rb +1 -1
- data/spec/acceptance/tag_names_for_scope_spec.rb +8 -0
- data/spec/acceptance/tag_names_spec.rb +1 -1
- data/spec/acceptance/tags_spec.rb +1 -1
- data/spec/gutentag/active_record_spec.rb +1 -1
- data/spec/gutentag_spec.rb +1 -1
- data/spec/models/gutentag/tag_spec.rb +1 -1
- data/spec/models/gutentag/tagging_spec.rb +1 -1
- data/spec/spec_helper.rb +3 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b86cbc2c649e92b40be12e9be738e3b57f57cb10241103e02d2aa5ea82a0d0a
|
4
|
+
data.tar.gz: 916b5eabf6121b235ca9136ac2eaf0113bde665f532bd21afe5b728825718fee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3dcd7dcae2889b2ab496966bbb5b57c332f46546cbc7dd8f3e557f710c5ae89cfebe833a25bc6efb73c18fb74b858422943072407b328f59251543a000da4e
|
7
|
+
data.tar.gz: e7c60af1366e1afbc647162cbd72618be7884c9dc3bf8f580a8b6ddfa61684c7c1546f2fd9f85f0aadceaa2ac7b1dd22b70332b1061c162c2b3695d1fea111ac
|
data/.rubocop.yml
CHANGED
@@ -20,3 +20,19 @@ Style/MultilineIfModifier:
|
|
20
20
|
Style/MultilineTernaryOperator:
|
21
21
|
Exclude:
|
22
22
|
- db/migrate/*.rb
|
23
|
+
|
24
|
+
# 0.80
|
25
|
+
|
26
|
+
Style/HashEachMethods:
|
27
|
+
Enabled: true
|
28
|
+
Style/HashTransformKeys:
|
29
|
+
Enabled: true
|
30
|
+
Style/HashTransformValues:
|
31
|
+
Enabled: true
|
32
|
+
|
33
|
+
# 0.81
|
34
|
+
|
35
|
+
Lint/RaiseException:
|
36
|
+
Enabled: true
|
37
|
+
Lint/StructNewOverride:
|
38
|
+
Enabled: true
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
@@ -17,7 +17,7 @@ appraise "rails_4_2" do
|
|
17
17
|
gem "activerecord-jdbcmysql-adapter", "~> 1.3.23", :platform => :jruby
|
18
18
|
gem "activerecord-jdbcpostgresql-adapter", "~> 1.3.23", :platform => :jruby
|
19
19
|
gem "activerecord-jdbcsqlite3-adapter", "~> 1.3.23", :platform => :jruby
|
20
|
-
end
|
20
|
+
end if RUBY_VERSION.to_f < 2.7
|
21
21
|
|
22
22
|
appraise "rails_5_0" do
|
23
23
|
gem "rails", "~> 5.0.3"
|
@@ -36,7 +36,7 @@ appraise "rails_5_2" do
|
|
36
36
|
end if RUBY_VERSION.to_f >= 2.2
|
37
37
|
|
38
38
|
appraise "rails_6_0" do
|
39
|
-
gem "rails", "~> 6.0.0
|
39
|
+
gem "rails", "~> 6.0.0"
|
40
40
|
gem "pg", "~> 1.0", :platform => :ruby
|
41
41
|
gem "mysql2", "~> 0.5.0", :platform => :ruby
|
42
42
|
gem "sqlite3", "~> 1.4", :platform => :ruby
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
|
3
3
|
All notable changes to this project (at least, from v0.5.0 onwards) will be documented in this file.
|
4
4
|
|
5
|
+
## 2.5.3 - 2020-06-28
|
6
|
+
|
7
|
+
### Fixed
|
8
|
+
|
9
|
+
* Use `saved_change_to_tag_names?` instead of `tag_names_previously_changed?` for Rails 5.1+ ([Morten Trolle](https://github.com/mtrolle) in [70](https://github.com/pat/gutentag/pull/70)).
|
10
|
+
* `Gutentag::Tag.names_for_scope` now handles empty scopes ([Mike Gunderloy](https://github.com/ffmike) in [#73](https://github.com/pat/gutentag/pull/73)).
|
11
|
+
|
5
12
|
## 2.5.2 - 2019-07-08
|
6
13
|
|
7
14
|
### Fixed
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# Gutentag
|
2
2
|
|
3
|
-
[](http://badge.fury.io/rb/gutentag)
|
4
|
+
[](https://travis-ci.org/pat/gutentag)
|
5
|
+
[](https://codeclimate.com/github/pat/gutentag)
|
6
6
|
|
7
7
|
A good, simple, solid tagging extension for ActiveRecord.
|
8
8
|
|
data/app/models/gutentag/tag.rb
CHANGED
@@ -21,7 +21,9 @@ class Gutentag::Tag < ActiveRecord::Base
|
|
21
21
|
|
22
22
|
def self.names_for_scope(scope)
|
23
23
|
join_conditions = {:taggable_type => scope.name}
|
24
|
-
if scope.
|
24
|
+
if scope.is_a?(ActiveRecord::Relation)
|
25
|
+
return Gutentag::Tag.none unless scope.current_scope.present?
|
26
|
+
|
25
27
|
join_conditions[:taggable_id] = scope.select(:id)
|
26
28
|
end
|
27
29
|
|
data/gutentag.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "gutentag"
|
5
|
-
s.version = "2.5.
|
5
|
+
s.version = "2.5.3"
|
6
6
|
s.authors = ["Pat Allan"]
|
7
7
|
s.email = ["pat@freelancing-gods.com"]
|
8
8
|
s.homepage = "https://github.com/pat/gutentag"
|
@@ -17,11 +17,11 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_runtime_dependency "activerecord", ">= 3.2.0"
|
18
18
|
|
19
19
|
s.add_development_dependency "appraisal", "~> 2.1.0"
|
20
|
-
s.add_development_dependency "bundler", "
|
20
|
+
s.add_development_dependency "bundler", ">= 1.17"
|
21
21
|
s.add_development_dependency "combustion", "~> 1.1"
|
22
22
|
s.add_development_dependency "database_cleaner", "~> 1.6"
|
23
23
|
s.add_development_dependency "rails"
|
24
24
|
s.add_development_dependency "rspec-rails", "~> 3.1"
|
25
|
-
s.add_development_dependency "rubocop", "~> 0.
|
25
|
+
s.add_development_dependency "rubocop", "~> 0.81.0"
|
26
26
|
s.add_development_dependency "rubocop-performance", "~> 1"
|
27
27
|
end
|
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
# For Rails 5.0+
|
4
4
|
module Gutentag::ActiveRecord::InstanceMethods
|
5
|
+
AR_VERSION = ActiveRecord::VERSION::STRING.to_f
|
6
|
+
|
5
7
|
# If the tag_names attribute was one of the modified values, then let's just
|
6
8
|
# use the modifications, rather than overwriting the stored value.
|
7
9
|
#
|
@@ -9,7 +11,12 @@ module Gutentag::ActiveRecord::InstanceMethods
|
|
9
11
|
# the instance directly (e.g. article.tags << tag), which invokes the save
|
10
12
|
# callbacks, but the old tag_names value is stored but not updated.
|
11
13
|
def reset_tag_names
|
12
|
-
|
14
|
+
# Rails 5.1 introduces major changes to how ActiveModel::Dirty works:
|
15
|
+
# https://github.com/pat/gutentag/pull/70#issuecomment-524605448
|
16
|
+
# For Rails <5.1 we'll use *_previously_changed?
|
17
|
+
# and for 5.1+ we'll use saved_change_to_*?
|
18
|
+
return if AR_VERSION < 5.1 && tag_names_previously_changed?
|
19
|
+
return if AR_VERSION >= 5.1 && saved_change_to_tag_names?
|
13
20
|
|
14
21
|
# Update the underlying value rather than going through the setter, to
|
15
22
|
# ensure this update doesn't get marked as a 'change'.
|
@@ -27,4 +27,12 @@ RSpec.describe "Tag names for scopes" do
|
|
27
27
|
expect(Gutentag::Tag.names_for_scope(Article)).
|
28
28
|
to match_array(%w[ koala wombat cassowary ])
|
29
29
|
end
|
30
|
+
|
31
|
+
it "returns an empty array for an empty scope" do
|
32
|
+
Article.create :title => "mammals", :tag_names => %w[ koala wombat ]
|
33
|
+
Article.create :title => "birds", :tag_names => %w[ cassowary ]
|
34
|
+
|
35
|
+
expect(Gutentag::Tag.names_for_scope(Article.where(:title => "reptiles"))).
|
36
|
+
to match_array([])
|
37
|
+
end
|
30
38
|
end
|
data/spec/gutentag_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -4,7 +4,7 @@ require "bundler/setup"
|
|
4
4
|
|
5
5
|
Bundler.require :default, :development
|
6
6
|
|
7
|
-
Dir["#{__dir__}/support/**/*.rb"].each { |file| require file }
|
7
|
+
Dir["#{__dir__}/support/**/*.rb"].sort.each { |file| require file }
|
8
8
|
|
9
9
|
Combustion.initialize! :active_record
|
10
10
|
ActiveSupport.run_load_hooks :gutentag unless defined?(Gutentag::Engine)
|
@@ -12,6 +12,8 @@ ActiveSupport.run_load_hooks :gutentag unless defined?(Gutentag::Engine)
|
|
12
12
|
require "rspec/rails"
|
13
13
|
|
14
14
|
RSpec.configure do |config|
|
15
|
+
config.disable_monkey_patching!
|
16
|
+
|
15
17
|
if config.respond_to?(:use_transactional_tests)
|
16
18
|
config.use_transactional_tests = false
|
17
19
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gutentag
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.5.
|
4
|
+
version: 2.5.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pat Allan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -42,14 +42,14 @@ dependencies:
|
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.17'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.17'
|
55
55
|
- !ruby/object:Gem::Dependency
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 0.
|
117
|
+
version: 0.81.0
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: 0.
|
124
|
+
version: 0.81.0
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rubocop-performance
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
211
211
|
- !ruby/object:Gem::Version
|
212
212
|
version: '0'
|
213
213
|
requirements: []
|
214
|
-
rubygems_version: 3.
|
214
|
+
rubygems_version: 3.1.2
|
215
215
|
signing_key:
|
216
216
|
specification_version: 4
|
217
217
|
summary: Good Tags
|