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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bb06e1ee49d89ee14b96399332522ffe2a1992d0617ffc21d0205f03d3420d4a
4
- data.tar.gz: 6d80b72229751717a9c6b2103285ba9666cad97147d1bbe6789ef3c0b75d85c2
3
+ metadata.gz: 7dc33730db127f2b295d1965a40d3f1a26398a15298eed3f737c75c78d5b2d89
4
+ data.tar.gz: 6242af5c9b8e2fbeece7924c8a3296f9a0493237b2474bc53dbdc0b8167e2177
5
5
  SHA512:
6
- metadata.gz: 79e003d812d2f74ffdff9355ad09619cbfc8a5ea21cecccff36fcf0fee825a041897146c791bddf58c9b1b94ccf5d7704c86256c80e4666c4ae525ecf5148c4f
7
- data.tar.gz: 3804f90c2bc81ce007f59a8d710c2f2749df7cd3cc9a2316b818bb4178731700bd8830528f9c0622e1c1d948e919f7518c43380076047e8c9cdf010adffb389e
6
+ metadata.gz: 596d6f43a3afc179d5ad929f96a225de792ac3994091de2c148cd669343b0bdf361a6dcff2333a15d3740d087f85687620b933a2558a2b95629d857374f6589b
7
+ data.tar.gz: 0e86be8f5ff60cf8cb6d40aa364225ac90aab6147f448e73a27e4fbff74a846199409d2b8a770151abe0ed00f8e8f960fe4dc15e2cd49056e122d23f002e895b
@@ -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
@@ -12,3 +12,8 @@ appraise 'activerecord-5.2' do
12
12
  gem 'activerecord', '~> 5.2.0'
13
13
  gem 'activesupport', '~> 5.2.0'
14
14
  end
15
+
16
+ appraise 'activerecord-6.0' do
17
+ gem 'activerecord', '~> 6.0.0'
18
+ gem 'activesupport', '~> 6.0.0'
19
+ end
@@ -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', '~> 5.0'
31
- spec.add_runtime_dependency 'activesupport', '~> 5.0'
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', '~> 1.3.6'
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 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'activerecord', '~> 5.1.0'
6
- gem 'activesupport', '~> 5.1.0'
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 'https://rubygems.org'
3
+ source "https://rubygems.org"
4
4
 
5
- gem 'activerecord', '~> 5.2.0'
6
- gem 'activesupport', '~> 5.2.0'
5
+ gem "activerecord", "~> 5.2.0"
6
+ gem "activesupport", "~> 5.2.0"
7
7
 
8
- gemspec path: '../'
8
+ gemspec path: "../"
@@ -0,0 +1,8 @@
1
+ # This file was generated by Appraisal
2
+
3
+ source "https://rubygems.org"
4
+
5
+ gem "activerecord", "~> 6.0.0"
6
+ gem "activesupport", "~> 6.0.0"
7
+
8
+ gemspec path: "../"
@@ -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
- def _mark_dirty(context:, taggable_context:)
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(
@@ -1,3 +1,3 @@
1
1
  module EasyTags
2
- VERSION = '0.2.2'.freeze
2
+ VERSION = '0.2.3'.freeze
3
3
  end
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.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: 2019-10-24 00:00:00.000000000 Z
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: 1.3.6
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: 1.3.6
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.0.4
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
@@ -1,8 +0,0 @@
1
- # This file was generated by Appraisal
2
-
3
- source 'https://rubygems.org'
4
-
5
- gem 'activerecord', '~> 5.0.0'
6
- gem 'activesupport', '~> 5.0.0'
7
-
8
- gemspec path: '../'