gutentag 3.0.0 → 3.0.1
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/.github/workflows/ci.yml +1 -1
- data/.rubocop.yml +1 -1
- data/CHANGELOG.md +10 -0
- data/gutentag.gemspec +5 -3
- data/lib/gutentag/active_record/instance_methods.rb +5 -0
- data/lib/gutentag/generators/migration_versions_generator.rb +2 -3
- data/spec/acceptance/dirty_state_spec.rb +25 -25
- data/spec/acceptance/tag_names_spec.rb +1 -1
- data/spec/models/gutentag/tag_spec.rb +3 -6
- metadata +7 -8
- data/spec/support/mysql.rb +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5afcb64119c9fff07b6c4cb8786da632f3ad66d230ea049b45b7780440b9692a
|
|
4
|
+
data.tar.gz: ed0b54305d58152e70ec3de7b5cc324c5a443a1b0f73ade5e136cedb785b77f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4457511634f9ffee17502b8deab34ff6a306750dc0886864cd913c68f0e60c52873a4716ef6941ee23955477ca5b72847b3d644d8dfca6e0ccc16a8d7e27bf6f
|
|
7
|
+
data.tar.gz: 355801ea0a573f02a509ece9c9175786672c79d457e7ed5935ca6b73552a9fcc6cad065c9c65bb42b29adce1958957f73ef5dc1ef7244ac65dedfdcae7f4c772
|
data/.github/workflows/ci.yml
CHANGED
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
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
|
+
## 3.0.1 - 2025-11-24
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
* Fixed dirty state after reload is called on a tagged instance. ([Michael Grosser](https://github.com/grosser) in [#54](https://github.com/pat/gutentag/pull/92))
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
|
|
13
|
+
* Updated syntax to be for Ruby 3.0 and newer.
|
|
14
|
+
|
|
5
15
|
## 3.0.0 - 2025-11-21
|
|
6
16
|
|
|
7
17
|
### Breaking
|
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 = "3.0.
|
|
5
|
+
s.version = "3.0.1"
|
|
6
6
|
s.authors = ["Pat Allan"]
|
|
7
7
|
s.email = ["pat@freelancing-gods.com"]
|
|
8
8
|
s.homepage = "https://github.com/pat/gutentag"
|
|
@@ -14,6 +14,8 @@ Gem::Specification.new do |s|
|
|
|
14
14
|
s.test_files = `git ls-files -- {spec}/*`.split("\n")
|
|
15
15
|
s.require_paths = ["lib"]
|
|
16
16
|
|
|
17
|
+
s.required_ruby_version = ">= 3.0.0"
|
|
18
|
+
|
|
17
19
|
s.add_runtime_dependency "activerecord", ">= 3.2.0"
|
|
18
20
|
|
|
19
21
|
s.add_development_dependency "appraisal", "~> 2.5.0"
|
|
@@ -22,6 +24,6 @@ Gem::Specification.new do |s|
|
|
|
22
24
|
s.add_development_dependency "database_cleaner", "~> 2.1"
|
|
23
25
|
s.add_development_dependency "rails"
|
|
24
26
|
s.add_development_dependency "rspec-rails", ">= 5.1.2"
|
|
25
|
-
s.add_development_dependency "rubocop", "~>
|
|
26
|
-
s.add_development_dependency "rubocop-performance", "~> 1"
|
|
27
|
+
s.add_development_dependency "rubocop", "~> 1.81.7"
|
|
28
|
+
s.add_development_dependency "rubocop-performance", "~> 1.26"
|
|
27
29
|
end
|
|
@@ -28,11 +28,10 @@ module Gutentag
|
|
|
28
28
|
end
|
|
29
29
|
|
|
30
30
|
def known_migration_names
|
|
31
|
-
@known_migration_names ||=
|
|
31
|
+
@known_migration_names ||=
|
|
32
32
|
Dir[File.join(__dir__, "../../../db/migrate/*.rb")].collect do |path|
|
|
33
|
-
File.basename(path).gsub(/\A\d+_/, "").
|
|
33
|
+
File.basename(path).gsub(/\A\d+_/, "").delete_suffix(".rb")
|
|
34
34
|
end
|
|
35
|
-
end
|
|
36
35
|
end
|
|
37
36
|
|
|
38
37
|
def rails_version
|
|
@@ -12,17 +12,11 @@ RSpec.describe "Dirty state of tag names" do
|
|
|
12
12
|
expect(article.tag_names_changed?).to eq(true)
|
|
13
13
|
expect(article.tag_names_was).to eq([])
|
|
14
14
|
expect(article.tag_names_change).to eq([[], ["pancakes"]])
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if ActiveRecord::VERSION::STRING.to_f > 5.0
|
|
22
|
-
expect(article.will_save_change_to_tag_names?).to eq(true)
|
|
23
|
-
expect(article.tag_names_change_to_be_saved).to eq([[], ["pancakes"]])
|
|
24
|
-
expect(article.tag_names_in_database).to eq([])
|
|
25
|
-
end
|
|
15
|
+
expect(article.tag_names_changed?(:from => [], :to => ["pancakes"])).
|
|
16
|
+
to eq(true)
|
|
17
|
+
expect(article.will_save_change_to_tag_names?).to eq(true)
|
|
18
|
+
expect(article.tag_names_change_to_be_saved).to eq([[], ["pancakes"]])
|
|
19
|
+
expect(article.tag_names_in_database).to eq([])
|
|
26
20
|
end
|
|
27
21
|
|
|
28
22
|
it "knows what tag names have changed" do
|
|
@@ -34,20 +28,14 @@ RSpec.describe "Dirty state of tag names" do
|
|
|
34
28
|
expect(article).to_not be_changed
|
|
35
29
|
expect(article.tag_names_changed?).to eq(false)
|
|
36
30
|
expect(article.previous_changes["tag_names"]).to eq([[], ["pancakes"]])
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
expect(article.saved_change_to_tag_names).to eq([[], ["pancakes"]])
|
|
46
|
-
expect(article.saved_changes["tag_names"]).to eq([[], ["pancakes"]])
|
|
47
|
-
expect(article.tag_names_before_last_save).to eq([])
|
|
48
|
-
expect(article.tag_names_change_to_be_saved).to eq(nil)
|
|
49
|
-
expect(article.tag_names_in_database).to eq(["pancakes"])
|
|
50
|
-
end
|
|
31
|
+
expect(article.tag_names_previously_changed?).to eq(true)
|
|
32
|
+
expect(article.tag_names_previous_change).to eq([[], ["pancakes"]])
|
|
33
|
+
expect(article.saved_change_to_tag_names?).to eq(true)
|
|
34
|
+
expect(article.saved_change_to_tag_names).to eq([[], ["pancakes"]])
|
|
35
|
+
expect(article.saved_changes["tag_names"]).to eq([[], ["pancakes"]])
|
|
36
|
+
expect(article.tag_names_before_last_save).to eq([])
|
|
37
|
+
expect(article.tag_names_change_to_be_saved).to eq(nil)
|
|
38
|
+
expect(article.tag_names_in_database).to eq(["pancakes"])
|
|
51
39
|
end
|
|
52
40
|
|
|
53
41
|
it "knows when tags have not changed" do
|
|
@@ -57,4 +45,16 @@ RSpec.describe "Dirty state of tag names" do
|
|
|
57
45
|
article.tag_names = ["pancakes"]
|
|
58
46
|
expect(article.changes).to eq({})
|
|
59
47
|
end
|
|
48
|
+
|
|
49
|
+
it "knows when a saved instance is reloaded (and thus has no changes)" do
|
|
50
|
+
article.update!(:tag_names => ["pancakes"])
|
|
51
|
+
article.reload
|
|
52
|
+
article.tag_names = ["pancakes"]
|
|
53
|
+
|
|
54
|
+
expect(article).not_to be_changed
|
|
55
|
+
expect(article.changes).to eq({})
|
|
56
|
+
expect(article.tag_names_changed?).to eq(false)
|
|
57
|
+
expect(article.tag_names_was).to eq(["pancakes"])
|
|
58
|
+
expect(article.tag_names_change).to eq(nil)
|
|
59
|
+
end
|
|
60
60
|
end
|
|
@@ -21,7 +21,7 @@ RSpec.describe "Managing tags via names" do
|
|
|
21
21
|
end
|
|
22
22
|
|
|
23
23
|
it "allows for different tag normalisation" do
|
|
24
|
-
Gutentag.normaliser = lambda
|
|
24
|
+
Gutentag.normaliser = lambda(&:upcase)
|
|
25
25
|
|
|
26
26
|
tag = Gutentag::Tag.create(:name => "melbourne")
|
|
27
27
|
expect(tag.name).to eq("MELBOURNE")
|
|
@@ -64,12 +64,9 @@ RSpec.describe Gutentag::Tag, :type => :model do
|
|
|
64
64
|
expect(tag.errors[:name].length).to eq(1)
|
|
65
65
|
end
|
|
66
66
|
|
|
67
|
-
if ENV["DATABASE"] == "mysql"
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
# When using MySQL or Rails before 4.2, string columns convert to
|
|
71
|
-
# VARCHAR(255), therefore the column has a limit of 255, even though we
|
|
72
|
-
# did not specify a limit
|
|
67
|
+
if ENV["DATABASE"] == "mysql"
|
|
68
|
+
# When using MySQL, string columns convert to VARCHAR(255), therefore the
|
|
69
|
+
# column has a limit of 255, even though we did not specify a limit.
|
|
73
70
|
it "validates the length of the name" do
|
|
74
71
|
tag = Gutentag::Tag.create(:name => "a" * 256)
|
|
75
72
|
expect(tag.errors[:name].length).to eq(1)
|
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: 3.0.
|
|
4
|
+
version: 3.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pat Allan
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2025-11-
|
|
11
|
+
date: 2025-11-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: activerecord
|
|
@@ -114,28 +114,28 @@ dependencies:
|
|
|
114
114
|
requirements:
|
|
115
115
|
- - "~>"
|
|
116
116
|
- !ruby/object:Gem::Version
|
|
117
|
-
version:
|
|
117
|
+
version: 1.81.7
|
|
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:
|
|
124
|
+
version: 1.81.7
|
|
125
125
|
- !ruby/object:Gem::Dependency
|
|
126
126
|
name: rubocop-performance
|
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
|
128
128
|
requirements:
|
|
129
129
|
- - "~>"
|
|
130
130
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '1'
|
|
131
|
+
version: '1.26'
|
|
132
132
|
type: :development
|
|
133
133
|
prerelease: false
|
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
135
|
requirements:
|
|
136
136
|
- - "~>"
|
|
137
137
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '1'
|
|
138
|
+
version: '1.26'
|
|
139
139
|
description: A good, simple, solid tagging extension for ActiveRecord
|
|
140
140
|
email:
|
|
141
141
|
- pat@freelancing-gods.com
|
|
@@ -192,7 +192,6 @@ files:
|
|
|
192
192
|
- spec/models/gutentag/tagging_spec.rb
|
|
193
193
|
- spec/spec_helper.rb
|
|
194
194
|
- spec/support/adjust_migrations.rb
|
|
195
|
-
- spec/support/mysql.rb
|
|
196
195
|
homepage: https://github.com/pat/gutentag
|
|
197
196
|
licenses:
|
|
198
197
|
- MIT
|
|
@@ -205,7 +204,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
205
204
|
requirements:
|
|
206
205
|
- - ">="
|
|
207
206
|
- !ruby/object:Gem::Version
|
|
208
|
-
version:
|
|
207
|
+
version: 3.0.0
|
|
209
208
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
210
209
|
requirements:
|
|
211
210
|
- - ">="
|
data/spec/support/mysql.rb
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require "active_record"
|
|
4
|
-
|
|
5
|
-
# New versions of MySQL don't allow NULL values for primary keys, but old
|
|
6
|
-
# versions of Rails do. To use both at the same time, we need to update Rails'
|
|
7
|
-
# default primary key type to no longer have a default NULL value.
|
|
8
|
-
#
|
|
9
|
-
class PatchAdapter
|
|
10
|
-
def call
|
|
11
|
-
return unless using_mysql? && using_rails_pre_4_1?
|
|
12
|
-
|
|
13
|
-
require "active_record/connection_adapters/abstract_mysql_adapter"
|
|
14
|
-
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::
|
|
15
|
-
NATIVE_DATABASE_TYPES[:primary_key] = "int(11) auto_increment PRIMARY KEY"
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
def using_mysql?
|
|
19
|
-
ENV.fetch("DATABASE", "sqlite") == "mysql"
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
def using_rails_pre_4_1?
|
|
23
|
-
ActiveRecord::VERSION::STRING.to_f < 4.1
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
PatchAdapter.new.call
|