easy_tags 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -3
- data/Appraisals +5 -0
- data/easy_tags.gemspec +3 -3
- data/gemfiles/activerecord_5.1.gemfile +4 -4
- data/gemfiles/activerecord_5.2.gemfile +4 -4
- data/gemfiles/activerecord_6.0.gemfile +8 -0
- data/lib/easy_tags.rb +1 -0
- data/lib/easy_tags/dirty_methods.rb +26 -0
- data/lib/easy_tags/taggable_methods.rb +1 -5
- data/lib/easy_tags/version.rb +1 -1
- metadata +25 -12
- data/gemfiles/activerecord_5.0.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7dc33730db127f2b295d1965a40d3f1a26398a15298eed3f737c75c78d5b2d89
|
4
|
+
data.tar.gz: 6242af5c9b8e2fbeece7924c8a3296f9a0493237b2474bc53dbdc0b8167e2177
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 596d6f43a3afc179d5ad929f96a225de792ac3994091de2c148cd669343b0bdf361a6dcff2333a15d3740d087f85687620b933a2558a2b95629d857374f6589b
|
7
|
+
data.tar.gz: 0e86be8f5ff60cf8cb6d40aa364225ac90aab6147f448e73a27e4fbff74a846199409d2b8a770151abe0ed00f8e8f960fe4dc15e2cd49056e122d23f002e895b
|
data/.travis.yml
CHANGED
@@ -14,16 +14,14 @@ script:
|
|
14
14
|
after_script:
|
15
15
|
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
16
16
|
rvm:
|
17
|
-
- 2.3.8
|
18
|
-
- 2.4.5
|
19
17
|
- 2.5.3
|
20
18
|
- 2.6.0
|
21
19
|
- ruby-head
|
22
20
|
gemfile:
|
23
21
|
- Gemfile
|
24
|
-
- gemfiles/activerecord_5.0.gemfile
|
25
22
|
- gemfiles/activerecord_5.1.gemfile
|
26
23
|
- gemfiles/activerecord_5.2.gemfile
|
24
|
+
- gemfiles/activerecord_6.0.gemfile
|
27
25
|
matrix:
|
28
26
|
allow_failures:
|
29
27
|
- rvm: ruby-head
|
data/Appraisals
CHANGED
data/easy_tags.gemspec
CHANGED
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_runtime_dependency 'activerecord', '
|
31
|
-
spec.add_runtime_dependency 'activesupport', '
|
30
|
+
spec.add_runtime_dependency 'activerecord', '>= 5.0', '< 6.1'
|
31
|
+
spec.add_runtime_dependency 'activesupport', '>= 5.0', '< 6.1'
|
32
32
|
|
33
33
|
spec.add_development_dependency 'appraisal'
|
34
34
|
spec.add_development_dependency 'database_cleaner'
|
@@ -36,6 +36,6 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.add_development_dependency 'rspec-rails'
|
37
37
|
spec.add_development_dependency 'simplecov'
|
38
38
|
spec.add_development_dependency 'simplecov-console'
|
39
|
-
spec.add_development_dependency 'sqlite3'
|
39
|
+
spec.add_development_dependency 'sqlite3'
|
40
40
|
end
|
41
41
|
# rubocop:enable Metrics/BlockLength
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem
|
6
|
-
gem
|
5
|
+
gem "activerecord", "~> 5.1.0"
|
6
|
+
gem "activesupport", "~> 5.1.0"
|
7
7
|
|
8
|
-
gemspec path:
|
8
|
+
gemspec path: "../"
|
@@ -1,8 +1,8 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source
|
3
|
+
source "https://rubygems.org"
|
4
4
|
|
5
|
-
gem
|
6
|
-
gem
|
5
|
+
gem "activerecord", "~> 5.2.0"
|
6
|
+
gem "activesupport", "~> 5.2.0"
|
7
7
|
|
8
|
-
gemspec path:
|
8
|
+
gemspec path: "../"
|
data/lib/easy_tags.rb
CHANGED
@@ -5,6 +5,7 @@ require 'active_record'
|
|
5
5
|
module EasyTags
|
6
6
|
extend ActiveSupport::Autoload
|
7
7
|
|
8
|
+
autoload :DirtyMethods, 'easy_tags/dirty_methods'
|
8
9
|
autoload :Tag, 'easy_tags/tag'
|
9
10
|
autoload :TaggableMethods, 'easy_tags/taggable_methods'
|
10
11
|
autoload :TaggableContextMethods, 'easy_tags/taggable_context_methods'
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module EasyTags
|
2
|
+
# Handles dirty behaviour
|
3
|
+
module DirtyMethods
|
4
|
+
RAILS_6 = ::ActiveRecord.gem_version >= ::Gem::Version.new('6.0.0')
|
5
|
+
|
6
|
+
def _mark_dirty(context:, taggable_context:)
|
7
|
+
_set_dirty_previous_value(attribute_name: "#{context}_list", value: taggable_context.persisted_tags.to_s)
|
8
|
+
write_attribute("#{context}_list", taggable_context.tags.to_s)
|
9
|
+
attribute_will_change!("#{context}_list")
|
10
|
+
end
|
11
|
+
|
12
|
+
if RAILS_6
|
13
|
+
def _set_dirty_previous_value(attribute_name:, value:)
|
14
|
+
@attributes[attribute_name] = ActiveModel::Attribute.from_user(
|
15
|
+
attribute_name,
|
16
|
+
value,
|
17
|
+
ActiveModel::Type::Value.new
|
18
|
+
)
|
19
|
+
end
|
20
|
+
else
|
21
|
+
def _set_dirty_previous_value(attribute_name:, value:)
|
22
|
+
set_attribute_was(attribute_name, value)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -65,11 +65,7 @@ module EasyTags
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
|
69
|
-
write_attribute("#{context}_list", taggable_context.tags.to_s)
|
70
|
-
set_attribute_was("#{context}_list", taggable_context.persisted_tags.to_s)
|
71
|
-
attribute_will_change!("#{context}_list")
|
72
|
-
end
|
68
|
+
include DirtyMethods
|
73
69
|
|
74
70
|
def _taggable_context(context)
|
75
71
|
_taggable_contexts[context] ||= TaggableContext.new(
|
data/lib/easy_tags/version.rb
CHANGED
metadata
CHANGED
@@ -1,43 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: easy_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iwo Dziechciarow
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '5.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '6.1'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- - "
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '5.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '6.1'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: activesupport
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - "
|
37
|
+
- - ">="
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '5.0'
|
40
|
+
- - "<"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '6.1'
|
34
43
|
type: :runtime
|
35
44
|
prerelease: false
|
36
45
|
version_requirements: !ruby/object:Gem::Requirement
|
37
46
|
requirements:
|
38
|
-
- - "
|
47
|
+
- - ">="
|
39
48
|
- !ruby/object:Gem::Version
|
40
49
|
version: '5.0'
|
50
|
+
- - "<"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '6.1'
|
41
53
|
- !ruby/object:Gem::Dependency
|
42
54
|
name: appraisal
|
43
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,16 +138,16 @@ dependencies:
|
|
126
138
|
name: sqlite3
|
127
139
|
requirement: !ruby/object:Gem::Requirement
|
128
140
|
requirements:
|
129
|
-
- - "
|
141
|
+
- - ">="
|
130
142
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
143
|
+
version: '0'
|
132
144
|
type: :development
|
133
145
|
prerelease: false
|
134
146
|
version_requirements: !ruby/object:Gem::Requirement
|
135
147
|
requirements:
|
136
|
-
- - "
|
148
|
+
- - ">="
|
137
149
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
150
|
+
version: '0'
|
139
151
|
description: Easy tagging for Rails
|
140
152
|
email:
|
141
153
|
- iiwo@o2.pl
|
@@ -159,10 +171,11 @@ files:
|
|
159
171
|
- bin/console
|
160
172
|
- bin/setup
|
161
173
|
- easy_tags.gemspec
|
162
|
-
- gemfiles/activerecord_5.0.gemfile
|
163
174
|
- gemfiles/activerecord_5.1.gemfile
|
164
175
|
- gemfiles/activerecord_5.2.gemfile
|
176
|
+
- gemfiles/activerecord_6.0.gemfile
|
165
177
|
- lib/easy_tags.rb
|
178
|
+
- lib/easy_tags/dirty_methods.rb
|
166
179
|
- lib/easy_tags/generators/default.rb
|
167
180
|
- lib/easy_tags/options/callback.rb
|
168
181
|
- lib/easy_tags/options/collection.rb
|
@@ -201,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
201
214
|
- !ruby/object:Gem::Version
|
202
215
|
version: '0'
|
203
216
|
requirements: []
|
204
|
-
rubygems_version: 3.
|
217
|
+
rubygems_version: 3.1.2
|
205
218
|
signing_key:
|
206
219
|
specification_version: 4
|
207
220
|
summary: EasyTags allows you to tag a single model on several contexts
|