make_taggable 0.6.6 → 0.7.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/.github/workflows/mysql_tests.yml +56 -0
- data/.github/workflows/pg_tests.yml +56 -0
- data/.github/workflows/{ci.yml → sqlite_tests.yml} +10 -10
- data/.github/workflows/standardrb-check.yml +37 -0
- data/.gitignore +3 -0
- data/Appraisals +4 -0
- data/README.md +47 -27
- data/Rakefile +1 -0
- data/lib/make_taggable.rb +3 -3
- data/lib/make_taggable/version.rb +1 -2
- data/lib/tasks/setup_test_db.rake +6 -0
- data/make_taggable.gemspec +10 -8
- data/spec/dummy/README.md +0 -24
- data/spec/dummy/app/models/cached_model_with_array.rb +0 -6
- data/spec/dummy/app/models/taggable_model_with_json.rb +6 -0
- data/spec/dummy/config/application.rb +2 -8
- data/spec/dummy/config/database.yml +1 -19
- data/spec/dummy/config/mysql_database.yml.ci +8 -0
- data/spec/dummy/config/pg_database.yml.ci +8 -0
- data/spec/dummy/db/migrate/{20201119220853_create_taggable_models.rb → 020201119220853_create_taggable_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221037_create_columns_override_models.rb → 020201119221037_create_columns_override_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221121_create_non_standard_id_taggable_models.rb → 020201119221121_create_non_standard_id_taggable_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221228_create_untaggable_models.rb → 020201119221228_create_untaggable_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221247_create_cached_models.rb → 020201119221247_create_cached_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221314_create_other_cached_models.rb → 020201119221314_create_other_cached_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221343_create_companies.rb → 020201119221343_create_companies.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221416_create_users.rb → 020201119221416_create_users.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221434_create_other_taggable_models.rb → 020201119221434_create_other_taggable_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221507_create_ordered_taggable_models.rb → 020201119221507_create_ordered_taggable_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221530_create_cache_methods_injected_models.rb → 020201119221530_create_cache_methods_injected_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221629_create_other_cached_with_array_models.rb → 020201119221629_create_other_cached_with_array_models.rb} +0 -0
- data/spec/dummy/db/migrate/{20201119221746_create_taggable_model_with_jsons.rb → 020201119221746_create_taggable_model_with_jsons.rb} +0 -0
- data/spec/make_taggable/tag_spec.rb +88 -250
- data/spec/make_taggable/taggable_spec.rb +1 -1
- data/spec/spec_helper.rb +0 -2
- metadata +77 -59
- data/.travis.yml +0 -36
- data/gemfiles/rails_5.gemfile +0 -9
- data/gemfiles/rails_6.gemfile +0 -9
- data/gemfiles/rails_master.gemfile +0 -9
- data/spec/dummy/db/migrate/20201121222007_create_make_taggable_tags.make_taggable_engine.rb +0 -11
- data/spec/dummy/db/migrate/20201121222008_create_make_taggable_taggings.make_taggable_engine.rb +0 -13
- data/spec/dummy/db/migrate/20201121222009_change_tag_name_collation_mysql.make_taggable_engine.rb +0 -8
- data/spec/dummy/db/migrate/20201121222010_add_index_to_tags.make_taggable_engine.rb +0 -6
- data/spec/dummy/db/migrate/20201121222011_add_index_to_taggings.make_taggable_engine.rb +0 -13
- data/spec/dummy/db/schema.rb +0 -117
- data/spec/dummy/db/seeds.rb +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 511214c161094fadf92adb61f5735dc86af08370b92d492634170494fc5d4d8a
|
4
|
+
data.tar.gz: c20794c8e81c9eba4163763b86aaf1545022947d7a863f99bd3f14c8a2b6d0df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e10cad86c423641043013316807a1cf62eedb55be1521425bfd3d7cb235c76bf89bf832e07f520982263578c5a095ecf36f8817a5d1847df71b06f1185a98e7
|
7
|
+
data.tar.gz: 0d58d6f106d4031dcded133e0716577649f51c975d75675a8dc357833946d282fff3776932fe4626714fc2c92c29d213c0dd5eb361f524efef9f6a45c020b9b6
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
name: MySQL Tests
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
branches:
|
7
|
+
- '*'
|
8
|
+
push:
|
9
|
+
branches:
|
10
|
+
- master
|
11
|
+
jobs:
|
12
|
+
mysql:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby: ['2.5', '2.6', '2.7']
|
17
|
+
|
18
|
+
services:
|
19
|
+
mysql:
|
20
|
+
image: mysql:8
|
21
|
+
env:
|
22
|
+
MYSQL_ROOT_PASSWORD: password
|
23
|
+
MSQL_DATABASE: my_sql_test_db
|
24
|
+
ports: ['3306:3306']
|
25
|
+
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@master
|
29
|
+
|
30
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
31
|
+
uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby }}
|
34
|
+
|
35
|
+
- name: Cache gems
|
36
|
+
uses: actions/cache@v2
|
37
|
+
with:
|
38
|
+
path: vendor/bundle
|
39
|
+
key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
40
|
+
restore-keys: |
|
41
|
+
${{ runner.os }}-${{ matrix.ruby }}-gem-
|
42
|
+
|
43
|
+
- name: Install dependencies
|
44
|
+
run: |
|
45
|
+
gem install bundler
|
46
|
+
bundle install --jobs 4 --retry 3
|
47
|
+
bundle exec appraisal install
|
48
|
+
|
49
|
+
- name: Run tests
|
50
|
+
env:
|
51
|
+
DATABASE_URL: mysql2://root:password@127.0.0.1:3306/my_sql_test_db
|
52
|
+
RAILS_ENV: test
|
53
|
+
run: |
|
54
|
+
cp spec/dummy/config/mysql_database.yml.ci spec/dummy/config/database.yml
|
55
|
+
bundle exec rake test_app
|
56
|
+
bundle exec appraisal rake
|
@@ -0,0 +1,56 @@
|
|
1
|
+
---
|
2
|
+
name: Postgres Tests
|
3
|
+
|
4
|
+
on:
|
5
|
+
pull_request:
|
6
|
+
branches:
|
7
|
+
- '*'
|
8
|
+
push:
|
9
|
+
branches:
|
10
|
+
- master
|
11
|
+
jobs:
|
12
|
+
postgres:
|
13
|
+
runs-on: ubuntu-latest
|
14
|
+
strategy:
|
15
|
+
matrix:
|
16
|
+
ruby: ['2.5', '2.6', '2.7']
|
17
|
+
|
18
|
+
services:
|
19
|
+
postgres:
|
20
|
+
image: postgres:12
|
21
|
+
env:
|
22
|
+
POSTGRES_USER: postgres
|
23
|
+
POSTGRES_PASSWORD: password
|
24
|
+
POSTGRES_DB: pg_test
|
25
|
+
ports: ['5432:5432']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@master
|
29
|
+
|
30
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
31
|
+
uses: ruby/setup-ruby@v1
|
32
|
+
with:
|
33
|
+
ruby-version: ${{ matrix.ruby }}
|
34
|
+
|
35
|
+
- name: Cache gems
|
36
|
+
uses: actions/cache@v2
|
37
|
+
with:
|
38
|
+
path: vendor/bundle
|
39
|
+
key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
40
|
+
restore-keys: |
|
41
|
+
${{ runner.os }}-${{ matrix.ruby }}-gem-
|
42
|
+
|
43
|
+
- name: Install dependencies
|
44
|
+
run: |
|
45
|
+
gem install bundler
|
46
|
+
bundle install --jobs 4 --retry 3
|
47
|
+
bundle exec appraisal install
|
48
|
+
|
49
|
+
- name: Run tests
|
50
|
+
env:
|
51
|
+
DATABASE_URL: postgres://postgres:password@localhost:5432/pg_test
|
52
|
+
RAILS_ENV: test
|
53
|
+
run: |
|
54
|
+
cp spec/dummy/config/pg_database.yml.ci spec/dummy/config/database.yml
|
55
|
+
bundle exec rake test_app
|
56
|
+
bundle exec appraisal rake
|
@@ -1,4 +1,5 @@
|
|
1
|
-
|
1
|
+
---
|
2
|
+
name: SQLite Tests
|
2
3
|
|
3
4
|
on:
|
4
5
|
pull_request:
|
@@ -8,26 +9,27 @@ on:
|
|
8
9
|
branches:
|
9
10
|
- master
|
10
11
|
jobs:
|
11
|
-
|
12
|
+
sqlite:
|
12
13
|
runs-on: ubuntu-latest
|
13
14
|
strategy:
|
14
15
|
matrix:
|
15
|
-
ruby: [
|
16
|
+
ruby: ['2.5', '2.6', '2.7']
|
16
17
|
steps:
|
17
18
|
- uses: actions/checkout@master
|
18
19
|
|
19
|
-
- name: Set up Ruby
|
20
|
+
- name: Set up Ruby ${{ matrix.ruby }}
|
20
21
|
uses: ruby/setup-ruby@v1
|
21
22
|
with:
|
22
23
|
ruby-version: ${{ matrix.ruby }}
|
23
24
|
|
24
25
|
- name: Cache gems
|
25
|
-
uses: actions/cache@
|
26
|
+
uses: actions/cache@v2
|
26
27
|
with:
|
27
28
|
path: vendor/bundle
|
28
|
-
key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
29
|
+
key: ${{ runner.os }}-${{ matrix.ruby }}-gem-${{ hashFiles('**/Gemfile.lock') }}
|
29
30
|
restore-keys: |
|
30
|
-
${{ runner.os }}-gem-
|
31
|
+
${{ runner.os }}-${{ matrix.ruby }}-gem-
|
32
|
+
|
31
33
|
- name: Install dependencies
|
32
34
|
run: |
|
33
35
|
sudo apt-get update
|
@@ -37,11 +39,9 @@ jobs:
|
|
37
39
|
bundle install --jobs 4 --retry 3
|
38
40
|
bundle exec appraisal install
|
39
41
|
|
40
|
-
- name: StandardRb check
|
41
|
-
run: bundle exec standardrb
|
42
|
-
|
43
42
|
- name: Run tests
|
44
43
|
env:
|
45
44
|
RAILS_ENV: test
|
46
45
|
run: |
|
46
|
+
bundle exec rake test_app
|
47
47
|
bundle exec appraisal rake
|
@@ -0,0 +1,37 @@
|
|
1
|
+
name: Standard Rb
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
branches:
|
6
|
+
- '*'
|
7
|
+
push:
|
8
|
+
branches:
|
9
|
+
- master
|
10
|
+
|
11
|
+
jobs:
|
12
|
+
standard:
|
13
|
+
name: StandardRB Check Action
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@master
|
17
|
+
|
18
|
+
- name: Set up Ruby 2.7
|
19
|
+
uses: actions/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
ruby-version: 2.7.x
|
22
|
+
|
23
|
+
- uses: actions/cache@v1
|
24
|
+
with:
|
25
|
+
path: vendor/bundle
|
26
|
+
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
|
27
|
+
restore-keys: |
|
28
|
+
${{ runner.os }}-gems-
|
29
|
+
|
30
|
+
- name: Bundle install
|
31
|
+
run: |
|
32
|
+
gem install bundler
|
33
|
+
bundle config path vendor/bundle
|
34
|
+
bundle install --jobs 4 --retry 3
|
35
|
+
|
36
|
+
- name: Run StandardRB
|
37
|
+
run: bundle exec standardrb --format progress
|
data/.gitignore
CHANGED
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# MakeTaggable
|
2
2
|
[](https://badge.fury.io/rb/make_taggable)
|
3
|
-
|
4
|
-
|
3
|
+

|
4
|
+

|
5
|
+

|
6
|
+

|
5
7
|
|
6
|
-
MakeTaggable is a fork of
|
8
|
+
MakeTaggable is a fork of Acts-As-Taggable-On with code updates, fresh migrations that work on MySQL, and tested against a dummy Rails app.
|
7
9
|
|
8
|
-
|
9
|
-
|
10
|
-
For the PostgreSQL users, this is not an issue, but if you have an app or gem that used acts-as-taggable-on, you can no longer test against MySQL, so it seems a fresh start would be useful to clear out any legacy issues and move forward.
|
10
|
+
All credit goes to those who contributed to Acts-As-Taggable-On: Michael Bleigh & Joost Baaij.
|
11
11
|
|
12
12
|
## Installation
|
13
13
|
|
@@ -22,23 +22,22 @@ bundle add make_taggable
|
|
22
22
|
Install migrations
|
23
23
|
|
24
24
|
```shell
|
25
|
-
# For the latest versions :
|
26
25
|
rails make_taggable_engine:install:migrations
|
27
26
|
```
|
28
27
|
|
29
|
-
Review the generated migrations then migrate
|
28
|
+
Review the generated migrations then migrate:
|
30
29
|
```shell
|
31
30
|
rails db:migrate
|
32
31
|
```
|
33
32
|
|
34
33
|
#### For MySql users
|
35
|
-
|
34
|
+
To make MySQL play nice with spÉcial characters you can setting the following line in an initializer file:
|
36
35
|
|
37
36
|
```ruby
|
38
37
|
MakeTaggable.force_binary_collation = true
|
39
38
|
```
|
40
39
|
|
41
|
-
Or by
|
40
|
+
Or by run this rake task:
|
42
41
|
|
43
42
|
```shell
|
44
43
|
rails make_taggable_engine:tag_names:collate_bin
|
@@ -46,6 +45,7 @@ rails make_taggable_engine:tag_names:collate_bin
|
|
46
45
|
|
47
46
|
See the Configuration section for more details.
|
48
47
|
|
48
|
+
|
49
49
|
## Usage
|
50
50
|
|
51
51
|
Setup
|
@@ -176,7 +176,7 @@ MakeTaggable::Tag.least_used(10)
|
|
176
176
|
|
177
177
|
### Finding Tagged Objects
|
178
178
|
|
179
|
-
|
179
|
+
MakeTaggable uses scopes to create an association for tags.
|
180
180
|
This way you can mix and match to filter down your results.
|
181
181
|
|
182
182
|
```ruby
|
@@ -405,6 +405,7 @@ CSS:
|
|
405
405
|
.css4 { font-size: 1.6em; }
|
406
406
|
```
|
407
407
|
|
408
|
+
|
408
409
|
## Configuration
|
409
410
|
|
410
411
|
If you would like to remove unused tag objects after removing taggings, add:
|
@@ -453,35 +454,54 @@ MakeTaggable.delimiter = ','
|
|
453
454
|
*NOTE 1: SQLite by default can't upcase or downcase multibyte characters, resulting in unwanted behavior. Load the SQLite ICU extension for proper handle of such characters. [See docs](http://www.sqlite.org/src/artifact?ci=trunk&filename=ext/icu/README.txt)*
|
454
455
|
|
455
456
|
|
456
|
-
|
457
|
+
## Upgrading
|
457
458
|
|
458
|
-
|
459
|
+
Install new migrations by running:
|
459
460
|
|
460
|
-
|
461
|
-
|
462
|
-
|
461
|
+
```shell
|
462
|
+
rails make_taggable_engine:install:migrations
|
463
|
+
```
|
463
464
|
|
464
465
|
## Compatibility
|
465
466
|
|
466
|
-
|
467
|
-
|
467
|
+
Version 0.7.x is compatible with Ruby 2.5 > and Rails 5.2 >
|
468
468
|
|
469
|
-
## TODO
|
470
|
-
- Review migrations indexes they seem excessive looking at the schema.
|
471
|
-
- See if the newer version of ActiveRecord or arel can be used instead of the MySQL workarounds.
|
472
469
|
|
473
470
|
## Testing
|
474
471
|
|
475
|
-
|
476
|
-
|
472
|
+
MakeTaggable uses RSpec for its test coverage. Inside the gem directory, you can run the specs by following the steps below:
|
473
|
+
|
474
|
+
Install the rquired gems:
|
475
|
+
|
476
|
+
```shell
|
477
|
+
bundle install
|
478
|
+
```
|
479
|
+
|
480
|
+
Setup the dummy test app:
|
477
481
|
|
478
482
|
```shell
|
479
|
-
bundle
|
480
|
-
rake spec
|
483
|
+
bundle exec rake test_app
|
481
484
|
```
|
482
485
|
|
483
|
-
|
486
|
+
Run the spec tests against SQLite use the followiong command.
|
487
|
+
|
488
|
+
```shell
|
489
|
+
bundle exec rake
|
490
|
+
```
|
491
|
+
|
492
|
+
You can also run all the tests across all the Rails versions by running:
|
493
|
+
|
494
|
+
```shell
|
495
|
+
bundle exec appraisal install
|
496
|
+
|
497
|
+
bundle exec appraisal rake
|
498
|
+
```
|
499
|
+
|
500
|
+
|
501
|
+
## Contributors
|
502
|
+
|
503
|
+
List of valued contributors From Acts-As-Taggable-On: [Check them all](https://github.com/mbleigh/acts-as-taggable-on/contributors)
|
484
504
|
|
485
505
|
|
486
506
|
## License
|
487
|
-
MIT
|
507
|
+
This gem is available as open source under the terms of the [MIT License](https://github.com/MatthewKennedy/make_taggable/blob/master/LICENSE.txt).
|
data/Rakefile
CHANGED
data/lib/make_taggable.rb
CHANGED
@@ -111,10 +111,10 @@ module MakeTaggable
|
|
111
111
|
|
112
112
|
def self.apply_binary_collation(bincoll)
|
113
113
|
if Utils.using_mysql?
|
114
|
-
coll = "
|
115
|
-
coll = "
|
114
|
+
coll = "utf8mb4_general_ci"
|
115
|
+
coll = "utf8mb4_bin" if bincoll
|
116
116
|
begin
|
117
|
-
ActiveRecord::Migration.execute("ALTER TABLE #{Tag.table_name} MODIFY name varchar(255) CHARACTER SET
|
117
|
+
ActiveRecord::Migration.execute("ALTER TABLE #{Tag.table_name} MODIFY name varchar(255) CHARACTER SET utf8mb4 COLLATE #{coll};")
|
118
118
|
rescue => e
|
119
119
|
puts "Trapping #{e.class}: collation parameter ignored while migrating for the first time."
|
120
120
|
end
|
data/make_taggable.gemspec
CHANGED
@@ -6,25 +6,27 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.name = "make_taggable"
|
7
7
|
spec.version = MakeTaggable::VERSION
|
8
8
|
spec.authors = ["Matthew Kennedy", "Michael Bleigh", "Joost Baaij"]
|
9
|
-
spec.email = %w[m.kennedy@me.com
|
10
|
-
spec.description = "
|
9
|
+
spec.email = %w[m.kennedy@me.com]
|
10
|
+
spec.description = "MakeTaggable is a fork of Acts-As-Taggable-On with code updates & fresh migrations"
|
11
11
|
spec.summary = "Advanced Tagging For Rails"
|
12
12
|
spec.homepage = "https://github.com/MatthewKennedy/make_taggable"
|
13
13
|
spec.license = "MIT"
|
14
14
|
|
15
|
-
if File.exist?(
|
16
|
-
spec.post_install_message = File.read(
|
15
|
+
if File.exist?("UPGRADING.md")
|
16
|
+
spec.post_install_message = File.read("UPGRADING.md")
|
17
17
|
end
|
18
18
|
|
19
19
|
spec.files = `git ls-files`.split($/)
|
20
20
|
spec.test_files = spec.files.grep(%r{^spec/})
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_dependency "rails"
|
23
|
+
spec.add_dependency "rails"
|
24
24
|
|
25
|
-
spec.add_development_dependency "
|
25
|
+
spec.add_development_dependency "appraisal"
|
26
|
+
spec.add_development_dependency "mysql2"
|
27
|
+
spec.add_development_dependency "pg"
|
28
|
+
spec.add_development_dependency "rspec"
|
26
29
|
spec.add_development_dependency "rspec-rails"
|
27
|
-
spec.add_development_dependency "sqlite3"
|
28
30
|
spec.add_development_dependency "standard"
|
29
|
-
spec.add_development_dependency "
|
31
|
+
spec.add_development_dependency "sqlite3"
|
30
32
|
end
|