make_taggable 0.7.5 → 1.0.0
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/CHANGELOG.md +79 -0
- data/CONTRIBUTING.md +65 -22
- data/LICENSE.md +18 -17
- data/README.md +73 -444
- data/UPGRADING.md +28 -2
- data/docs/caching.md +93 -0
- data/docs/configuration.md +108 -0
- data/docs/contexts.md +147 -0
- data/docs/database.md +106 -0
- data/docs/getting-started.md +114 -0
- data/docs/migrating-from-aato.md +67 -0
- data/docs/ownership.md +111 -0
- data/docs/parsers.md +109 -0
- data/docs/querying.md +163 -0
- data/docs/tag-clouds.md +74 -0
- data/lib/make_taggable/default_parser.rb +45 -32
- data/lib/make_taggable/engine.rb +6 -0
- data/lib/make_taggable/generic_parser.rb +30 -4
- data/lib/make_taggable/tag.rb +121 -19
- data/lib/make_taggable/tag_list.rb +77 -24
- data/lib/make_taggable/taggable/cache.rb +61 -11
- data/lib/make_taggable/taggable/collection.rb +102 -30
- data/lib/make_taggable/taggable/core.rb +154 -34
- data/lib/make_taggable/taggable/ownership.rb +82 -4
- data/lib/make_taggable/taggable/related.rb +66 -3
- data/lib/make_taggable/taggable/tag_list_type.rb +8 -0
- data/lib/make_taggable/taggable/tagged_with_query/all_tags_query.rb +10 -0
- data/lib/make_taggable/taggable/tagged_with_query/any_tags_query.rb +10 -0
- data/lib/make_taggable/taggable/tagged_with_query/exclude_tags_query.rb +10 -0
- data/lib/make_taggable/taggable/tagged_with_query/query_base.rb +15 -0
- data/lib/make_taggable/taggable/tagged_with_query.rb +17 -0
- data/lib/make_taggable/taggable.rb +34 -33
- data/lib/make_taggable/tagger.rb +73 -12
- data/lib/make_taggable/tagging.rb +30 -3
- data/lib/make_taggable/tags_helper.rb +22 -1
- data/lib/make_taggable/utils.rb +40 -5
- data/lib/make_taggable/version.rb +8 -1
- data/lib/make_taggable.rb +153 -8
- data/make_taggable.gemspec +13 -20
- metadata +50 -165
- data/.dummyrc +0 -17
- data/.github/workflows/ci.yml +0 -140
- data/.github/workflows/standard-ci.yml +0 -27
- data/.gitignore +0 -17
- data/.rspec +0 -3
- data/Appraisals +0 -15
- data/Gemfile +0 -16
- data/Rakefile +0 -13
- data/gemfiles/rails_5.gemfile +0 -9
- data/gemfiles/rails_6.gemfile +0 -9
- data/gemfiles/rails_6_1.gemfile +0 -9
- data/gemfiles/rails_master.gemfile +0 -9
- data/lib/tasks/setup_test_db.rake +0 -8
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: be8e033e4d750a0bc75a77f652351843c096f38d8f8332f56e9d642e2085f12b
|
|
4
|
+
data.tar.gz: 698531499c7e7636b241b854cf60e2e2aee3799af3dba3d2d8a5f1ae2ff954f1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2f772cac980b2bab6c101c087916f3083f519aaec61c8c45ad4cd8750ab95dc6f9534d4ac2a511a6411872590dcfb4a58c3af7f68611458365ff8e5ce024866
|
|
7
|
+
data.tar.gz: 50aae450f2dfd5923ecf8c18a348b6e7e27b761d71d7fd59b61498c338341f607b735194b2a56da154624ad71e84a748f3a3aebec84beb0a6a21b3a7d0f244b0
|
data/CHANGELOG.md
CHANGED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
|
|
6
|
+
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [1.0.0] - unreleased
|
|
9
|
+
|
|
10
|
+
### Breaking
|
|
11
|
+
|
|
12
|
+
- **Removed the `acts_as_*` method names.** Use `make_taggable`, `make_ordered_taggable` and
|
|
13
|
+
`make_tagger` in place of `acts_as_taggable`, `acts_as_taggable_on`, `acts_as_ordered_taggable`,
|
|
14
|
+
`acts_as_ordered_taggable_on` and `acts_as_tagger`.
|
|
15
|
+
- **Delimiters are literal strings.** They were previously interpolated into a pattern unescaped,
|
|
16
|
+
so a delimiter containing a regular expression metacharacter had to be escaped by hand. Pass
|
|
17
|
+
`"|"` where you previously passed `'\|'`.
|
|
18
|
+
- **`make_taggable` with no arguments now tags on `:tags`.** It previously added no contexts at
|
|
19
|
+
all, despite the README documenting otherwise.
|
|
20
|
+
- **Raised the minimum versions** to Ruby 3.2 and Active Record 7.2, and removed the Active Record
|
|
21
|
+
upper bound.
|
|
22
|
+
|
|
23
|
+
See [UPGRADING.md](UPGRADING.md).
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- Tags containing non-ASCII characters no longer raise
|
|
28
|
+
`Encoding::UndefinedConversionError`. `Tag.named_any` was forcing sanitised SQL to `BINARY`.
|
|
29
|
+
- A delimiter containing a regular expression metacharacter no longer corrupts parsing. A `"."`
|
|
30
|
+
delimiter previously discarded every tag.
|
|
31
|
+
- `MakeTaggable::Dirty` and `MakeTaggable::Compatibility` no longer raise `LoadError`. Both were
|
|
32
|
+
declared as autoloads pointing at files that do not exist.
|
|
33
|
+
- `MakeTaggable.delimiter=` no longer raises `NoMethodError` when Active Record has no logger,
|
|
34
|
+
which is the case in a plain Active Record process or an initializer that runs early.
|
|
35
|
+
- Class names are parameterised through `sanitize_sql` rather than interpolated into SQL.
|
|
36
|
+
- `Tag.find_or_create_with_like_by_name` matches the whole name rather than a substring of it.
|
|
37
|
+
Asking for `"ruby"` while a tag named `"ruby on rails"` existed returned that tag instead of
|
|
38
|
+
creating the one requested. It is also no longer at the mercy of the column's collation, which
|
|
39
|
+
the MySQL migration sets to `utf8mb4_bin` -- on MySQL the method created a duplicate row for a
|
|
40
|
+
name differing only in case, despite `strict_case_match` being off.
|
|
41
|
+
- `Tag.find_or_create_all_with_like_by_name` no longer creates two rows for a list holding two
|
|
42
|
+
spellings of one name, such as `["Ruby", "ruby"]`. Tags created during the call were invisible to
|
|
43
|
+
the names that followed. Tagging through a tag list was never affected, since the list dedupes
|
|
44
|
+
before the lookup.
|
|
45
|
+
|
|
46
|
+
### Changed
|
|
47
|
+
|
|
48
|
+
- Replaced `String#mb_chars` and `ActiveSupport::Multibyte::Chars`, both removed in Rails 8.2, with
|
|
49
|
+
plain String methods.
|
|
50
|
+
- Removed the Active Record 5 compatibility branches and the Rails 5 `count` workaround's dead
|
|
51
|
+
argument.
|
|
52
|
+
- Added `frozen_string_literal` to every file in `lib`.
|
|
53
|
+
- The deprecation warning on `MakeTaggable.delimiter=` no longer refers to a "v4.0" that does not
|
|
54
|
+
exist in this gem's history.
|
|
55
|
+
|
|
56
|
+
### Documentation
|
|
57
|
+
|
|
58
|
+
- Public API documentation coverage raised from 38.65% to 100%, with no YARD warnings.
|
|
59
|
+
- Rewrote the README against the actual API, and added a `docs/` directory covering contexts,
|
|
60
|
+
querying, ownership, parsers, caching, tag clouds, configuration, the database schema, and
|
|
61
|
+
migrating from acts-as-taggable-on.
|
|
62
|
+
|
|
63
|
+
### Internal
|
|
64
|
+
|
|
65
|
+
- Replaced the test harness. The suite runs against bare Active Record instead of a generated dummy
|
|
66
|
+
application, dropping the `rails-dummy` dependency and the `create_test_app` step, and builds its
|
|
67
|
+
schema from the gem's own migrations.
|
|
68
|
+
- Replaced `spec/make_taggable/tag_spec.rb`. The file of that name contained no tests: it was a
|
|
69
|
+
stale copy of `lib/make_taggable/tag.rb` that RSpec loaded, silently redefining
|
|
70
|
+
`MakeTaggable::Tag` and reverting it part way through the suite. `MakeTaggable::Tag` now has 45
|
|
71
|
+
unit specs, covering validations, every lookup and creation method, comparison, the scopes, and
|
|
72
|
+
the taggings association.
|
|
73
|
+
- CI covers Rails 7.2, 8.0, 8.1 and main on Ruby 3.2 through 4.0.
|
|
74
|
+
|
|
75
|
+
## [0.7.5] - 2021-03-17
|
|
76
|
+
|
|
77
|
+
Earlier releases predate this changelog. See the
|
|
78
|
+
[commit history](https://github.com/MatthewKennedy/make_taggable/commits/master) for 0.7.x and
|
|
79
|
+
below.
|
data/CONTRIBUTING.md
CHANGED
|
@@ -1,31 +1,74 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Contributing
|
|
2
2
|
|
|
3
|
-
## Bug reports
|
|
3
|
+
## Bug reports
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
Check for an [existing issue](https://github.com/MatthewKennedy/make_taggable/issues) first, then
|
|
6
|
+
[open a new one](https://github.com/MatthewKennedy/make_taggable/issues/new).
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Please include the version of the gem, your Ruby and Rails versions, your database adapter, and the
|
|
9
|
+
smallest model and code that reproduce the problem.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
-
2. Install the gem dependencies: `bundle install`
|
|
12
|
-
3. Make the changes you want and back them up with tests.
|
|
13
|
-
4. Run the tests](https://github.com/MatthewKennedy/make_taggable#testing)
|
|
14
|
-
5. Update the CHANGELOG.md file with your changes and give yourself credit
|
|
15
|
-
6. Commit and create a pull request with details as to what has been changed and why
|
|
16
|
-
* Use well-described, small (atomic) commits.
|
|
17
|
-
* Include links to any relevant github issues.
|
|
18
|
-
* *Don't* change the VERSION file.
|
|
11
|
+
## Making a change
|
|
19
12
|
|
|
20
|
-
|
|
13
|
+
1. [Fork and clone the repo](https://help.github.com/articles/fork-a-repo).
|
|
14
|
+
2. `bundle install`.
|
|
15
|
+
3. Write a failing test first, then make it pass.
|
|
16
|
+
4. Run the suite: `bundle exec rake`.
|
|
17
|
+
5. Format: `bundle exec standardrb --fix`.
|
|
18
|
+
6. Document any public API you added: `bundle exec yard stats --list-undoc` should report 100%.
|
|
19
|
+
7. Add an entry to [CHANGELOG.md](CHANGELOG.md) under "unreleased".
|
|
20
|
+
8. Open a pull request explaining what changed and why.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
22
|
+
Keep commits small and well described, and link any relevant issues. Don't bump the version — that
|
|
23
|
+
happens at release.
|
|
24
|
+
|
|
25
|
+
## Running the tests
|
|
26
|
+
|
|
27
|
+
The suite runs against bare Active Record, using in-memory SQLite by default. There is no dummy
|
|
28
|
+
application to generate.
|
|
29
|
+
|
|
30
|
+
```shell
|
|
31
|
+
bundle exec rake
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Against another adapter:
|
|
35
|
+
|
|
36
|
+
```shell
|
|
37
|
+
DATABASE_ADAPTER=postgresql DATABASE_URL=postgres://localhost/make_taggable_test bundle exec rake
|
|
38
|
+
DATABASE_ADAPTER=mysql2 DATABASE_URL=mysql2://root@127.0.0.1/make_taggable_test bundle exec rake
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Across every supported Rails version:
|
|
42
|
+
|
|
43
|
+
```shell
|
|
44
|
+
bundle exec appraisal install
|
|
45
|
+
bundle exec appraisal rake
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### A note on test ordering
|
|
49
|
+
|
|
50
|
+
The suite runs in defined order. Several examples mutate shared model classes — adding a context to
|
|
51
|
+
`TaggableModel`, flipping `preserve_tag_order` — and rely on siblings having run first. Randomising
|
|
52
|
+
the order exposes this. Making those examples self-contained is welcome work; until then, please
|
|
53
|
+
don't add new examples that depend on a sibling's side effects.
|
|
28
54
|
|
|
29
55
|
## Documentation
|
|
30
56
|
|
|
31
|
-
|
|
57
|
+
Prose documentation lives in [docs/](docs). API documentation is YARD comments in `lib`, following
|
|
58
|
+
the style already there: a `##` opening line, a description, a blank line, then tags with real Ruby
|
|
59
|
+
types.
|
|
60
|
+
|
|
61
|
+
Build it locally with `bundle exec yard doc`.
|
|
62
|
+
|
|
63
|
+
## Releasing
|
|
64
|
+
|
|
65
|
+
Maintainers only. Bump `lib/make_taggable/version.rb`, move the "unreleased" changelog heading to
|
|
66
|
+
the new version, then tag:
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
git tag v1.0.0
|
|
70
|
+
git push origin v1.0.0
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
The release workflow runs the suite, checks formatting and documentation coverage, and publishes to
|
|
74
|
+
RubyGems via trusted publishing.
|
data/LICENSE.md
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
The MIT License (MIT)
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
a copy of this software and associated documentation files (the
|
|
5
|
-
"Software"), to deal in the Software without restriction, including
|
|
6
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
7
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
8
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
9
|
-
the following conditions:
|
|
3
|
+
Copyright (c) 2021 Matthew Kennedy
|
|
10
4
|
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
13
11
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|