has_attached_tags 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +30 -0
- data/Gemfile.lock +48 -47
- data/README.md +2 -2
- data/has_attached_tags.gemspec +2 -2
- data/lib/generators/has_attached_tags/templates/migration.rb.erb +1 -1
- data/lib/has_attached_tags.rb +1 -5
- data/lib/has_attached_tags/tagging.rb +8 -0
- data/lib/has_attached_tags/version.rb +1 -1
- metadata +8 -8
- data/.travis.yml +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a957d57a1070465d74ade6e76f32788353d858cd482015bb572f0f91cfc144f0
|
4
|
+
data.tar.gz: 6a9e52b1310750e292c5c1f558954f954ee817caf38b3b0abc9b4d6abc604030
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c8a3bddc108134da5a22845982a6fb3ec23031eac1210b5aa90b8d3274cb312545f2759a38ee874029bc9606d4f86f598af8d326b32c0e9f82406838d2c203a
|
7
|
+
data.tar.gz: ea471d955d28c72ff015f21113d2bd2a29923b08a1b7775161bbece2fa4505ff4e88a7964f26945f64cb6f45ff360d1949f878941b8baf6843dd0f03aa0eba21
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: RSpec
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
jobs:
|
17
|
+
test:
|
18
|
+
|
19
|
+
runs-on: ubuntu-latest
|
20
|
+
|
21
|
+
steps:
|
22
|
+
- uses: actions/checkout@v2
|
23
|
+
- name: Set up Ruby
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
ruby-version: 2.6
|
27
|
+
- name: Install dependencies
|
28
|
+
run: bundle install
|
29
|
+
- name: Run tests
|
30
|
+
run: bundle exec rspec
|
data/Gemfile.lock
CHANGED
@@ -1,75 +1,76 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
has_attached_tags (0.1.
|
4
|
+
has_attached_tags (0.1.1)
|
5
5
|
activerecord (>= 5.1, < 7)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
activemodel (6.
|
11
|
-
activesupport (= 6.
|
12
|
-
activerecord (6.
|
13
|
-
activemodel (= 6.
|
14
|
-
activesupport (= 6.
|
15
|
-
activesupport (6.
|
10
|
+
activemodel (6.1.3)
|
11
|
+
activesupport (= 6.1.3)
|
12
|
+
activerecord (6.1.3)
|
13
|
+
activemodel (= 6.1.3)
|
14
|
+
activesupport (= 6.1.3)
|
15
|
+
activesupport (6.1.3)
|
16
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
17
|
-
i18n (>=
|
18
|
-
minitest (
|
19
|
-
tzinfo (~>
|
20
|
-
zeitwerk (~> 2.
|
21
|
-
ast (2.4.
|
22
|
-
concurrent-ruby (1.1.
|
17
|
+
i18n (>= 1.6, < 2)
|
18
|
+
minitest (>= 5.1)
|
19
|
+
tzinfo (~> 2.0)
|
20
|
+
zeitwerk (~> 2.3)
|
21
|
+
ast (2.4.2)
|
22
|
+
concurrent-ruby (1.1.8)
|
23
23
|
diff-lcs (1.4.4)
|
24
24
|
factory_bot (6.1.0)
|
25
25
|
activesupport (>= 5.0.0)
|
26
|
-
faker (2.
|
26
|
+
faker (2.16.0)
|
27
27
|
i18n (>= 1.6, < 2)
|
28
|
-
i18n (1.8.
|
28
|
+
i18n (1.8.9)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
minitest (5.14.
|
31
|
-
parallel (1.
|
32
|
-
parser (
|
30
|
+
minitest (5.14.3)
|
31
|
+
parallel (1.20.1)
|
32
|
+
parser (3.0.0.0)
|
33
33
|
ast (~> 2.4.1)
|
34
34
|
rainbow (3.0.0)
|
35
|
-
rake (13.0.
|
36
|
-
regexp_parser (
|
35
|
+
rake (13.0.3)
|
36
|
+
regexp_parser (2.0.3)
|
37
37
|
rexml (3.2.4)
|
38
|
-
rspec (3.
|
39
|
-
rspec-core (~> 3.
|
40
|
-
rspec-expectations (~> 3.
|
41
|
-
rspec-mocks (~> 3.
|
42
|
-
rspec-core (3.
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-expectations (3.
|
38
|
+
rspec (3.10.0)
|
39
|
+
rspec-core (~> 3.10.0)
|
40
|
+
rspec-expectations (~> 3.10.0)
|
41
|
+
rspec-mocks (~> 3.10.0)
|
42
|
+
rspec-core (3.10.1)
|
43
|
+
rspec-support (~> 3.10.0)
|
44
|
+
rspec-expectations (3.10.1)
|
45
45
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-mocks (3.
|
46
|
+
rspec-support (~> 3.10.0)
|
47
|
+
rspec-mocks (3.10.2)
|
48
48
|
diff-lcs (>= 1.2.0, < 2.0)
|
49
|
-
rspec-support (~> 3.
|
50
|
-
rspec-support (3.
|
51
|
-
rubocop (0.
|
49
|
+
rspec-support (~> 3.10.0)
|
50
|
+
rspec-support (3.10.2)
|
51
|
+
rubocop (0.93.1)
|
52
52
|
parallel (~> 1.10)
|
53
|
-
parser (>= 2.7.1.
|
53
|
+
parser (>= 2.7.1.5)
|
54
54
|
rainbow (>= 2.2.2, < 4.0)
|
55
|
-
regexp_parser (>= 1.
|
55
|
+
regexp_parser (>= 1.8)
|
56
56
|
rexml
|
57
|
-
rubocop-ast (>= 0.
|
57
|
+
rubocop-ast (>= 0.6.0)
|
58
58
|
ruby-progressbar (~> 1.7)
|
59
59
|
unicode-display_width (>= 1.4.0, < 2.0)
|
60
|
-
rubocop-ast (
|
61
|
-
parser (>= 2.7.
|
62
|
-
rubocop-performance (1.
|
63
|
-
rubocop (>= 0.
|
64
|
-
|
65
|
-
|
66
|
-
|
60
|
+
rubocop-ast (1.4.1)
|
61
|
+
parser (>= 2.7.1.5)
|
62
|
+
rubocop-performance (1.9.2)
|
63
|
+
rubocop (>= 0.90.0, < 2.0)
|
64
|
+
rubocop-ast (>= 0.4.0)
|
65
|
+
rubocop-rspec (1.44.1)
|
66
|
+
rubocop (~> 0.87)
|
67
|
+
rubocop-ast (>= 0.7.1)
|
68
|
+
ruby-progressbar (1.11.0)
|
67
69
|
sqlite3 (1.4.2)
|
68
|
-
|
69
|
-
|
70
|
-
thread_safe (~> 0.1)
|
70
|
+
tzinfo (2.0.4)
|
71
|
+
concurrent-ruby (~> 1.0)
|
71
72
|
unicode-display_width (1.7.0)
|
72
|
-
zeitwerk (2.4.
|
73
|
+
zeitwerk (2.4.2)
|
73
74
|
|
74
75
|
PLATFORMS
|
75
76
|
ruby
|
@@ -87,4 +88,4 @@ DEPENDENCIES
|
|
87
88
|
sqlite3 (~> 1.4)
|
88
89
|
|
89
90
|
BUNDLED WITH
|
90
|
-
2.
|
91
|
+
2.2.3
|
data/README.md
CHANGED
@@ -175,7 +175,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
175
175
|
|
176
176
|
## Contributing
|
177
177
|
|
178
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
178
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mintyfresh/has_attached_tags. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
179
179
|
|
180
180
|
## License
|
181
181
|
|
@@ -183,4 +183,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
183
183
|
|
184
184
|
## Code of Conduct
|
185
185
|
|
186
|
-
Everyone interacting in the HasAttachedTags project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
186
|
+
Everyone interacting in the HasAttachedTags project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/mintyfresh/has_attached_tags/blob/master/CODE_OF_CONDUCT.md).
|
data/has_attached_tags.gemspec
CHANGED
@@ -8,11 +8,11 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = 'has_attached_tags'
|
9
9
|
spec.version = HasAttachedTags::VERSION
|
10
10
|
spec.authors = ['Mihail K']
|
11
|
-
spec.email = ['
|
11
|
+
spec.email = ['7896757+mintyfresh@users.noreply.github.com']
|
12
12
|
|
13
13
|
spec.summary = 'Pluggable Tagging for ActiveRecord'
|
14
14
|
spec.description = 'A general purpose, typed tagging system for ActiveRecord'
|
15
|
-
spec.homepage = 'https://github.com/
|
15
|
+
spec.homepage = 'https://github.com/mintyfresh/has_attached_tags'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
18
18
|
spec.metadata['homepage_uri'] = spec.homepage
|
@@ -6,7 +6,7 @@ class CreateTagsAndTaggings < ActiveRecord::Migration<%= migration_version %>
|
|
6
6
|
t.string :name, null: false
|
7
7
|
t.string :type, null: false
|
8
8
|
t.index %i[name type], unique: true
|
9
|
-
t.integer :taggings_count, null: false
|
9
|
+
t.integer :taggings_count, null: false, default: 0
|
10
10
|
t.timestamps
|
11
11
|
end
|
12
12
|
|
data/lib/has_attached_tags.rb
CHANGED
@@ -58,11 +58,7 @@ private
|
|
58
58
|
# @param type [String]
|
59
59
|
# @return [Class<Tagging>]
|
60
60
|
def define_attachment_tagging_class(attachment, type)
|
61
|
-
const_set("#{attachment}_tagging".camelize,
|
62
|
-
validate do
|
63
|
-
errors.add(:tag, :unsupported, type: type) if tag && tag.type != type.to_s
|
64
|
-
end
|
65
|
-
end)
|
61
|
+
const_set("#{attachment}_tagging".camelize, Tagging[type: type.to_s])
|
66
62
|
end
|
67
63
|
|
68
64
|
# @param attachment [Symbol]
|
@@ -9,5 +9,13 @@ module HasAttachedTags
|
|
9
9
|
|
10
10
|
validates :attachment, presence: true
|
11
11
|
validates :tag, uniqueness: { scope: %i[attachment taggable], on: :create }
|
12
|
+
|
13
|
+
# @param type [String]
|
14
|
+
# @return [void]
|
15
|
+
def self.[](type:)
|
16
|
+
Class.new(self) do
|
17
|
+
validate { errors.add(:tag, :unsupported, type: type) if tag && tag.type != type }
|
18
|
+
end
|
19
|
+
end
|
12
20
|
end
|
13
21
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: has_attached_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mihail K
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-02-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -164,15 +164,15 @@ dependencies:
|
|
164
164
|
version: '1.4'
|
165
165
|
description: A general purpose, typed tagging system for ActiveRecord
|
166
166
|
email:
|
167
|
-
-
|
167
|
+
- 7896757+mintyfresh@users.noreply.github.com
|
168
168
|
executables: []
|
169
169
|
extensions: []
|
170
170
|
extra_rdoc_files: []
|
171
171
|
files:
|
172
|
+
- ".github/workflows/rspec.yml"
|
172
173
|
- ".gitignore"
|
173
174
|
- ".rspec"
|
174
175
|
- ".rubocop.yml"
|
175
|
-
- ".travis.yml"
|
176
176
|
- CODE_OF_CONDUCT.md
|
177
177
|
- Gemfile
|
178
178
|
- Gemfile.lock
|
@@ -193,12 +193,12 @@ files:
|
|
193
193
|
- lib/has_attached_tags/tag.rb
|
194
194
|
- lib/has_attached_tags/tagging.rb
|
195
195
|
- lib/has_attached_tags/version.rb
|
196
|
-
homepage: https://github.com/
|
196
|
+
homepage: https://github.com/mintyfresh/has_attached_tags
|
197
197
|
licenses:
|
198
198
|
- MIT
|
199
199
|
metadata:
|
200
|
-
homepage_uri: https://github.com/
|
201
|
-
source_code_uri: https://github.com/
|
200
|
+
homepage_uri: https://github.com/mintyfresh/has_attached_tags
|
201
|
+
source_code_uri: https://github.com/mintyfresh/has_attached_tags
|
202
202
|
post_install_message:
|
203
203
|
rdoc_options: []
|
204
204
|
require_paths:
|
@@ -214,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
214
214
|
- !ruby/object:Gem::Version
|
215
215
|
version: '0'
|
216
216
|
requirements: []
|
217
|
-
rubygems_version: 3.
|
217
|
+
rubygems_version: 3.2.3
|
218
218
|
signing_key:
|
219
219
|
specification_version: 4
|
220
220
|
summary: Pluggable Tagging for ActiveRecord
|