metka 2.0.3 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2d1cbead401418f74fa159b65813cac6175207e17350dd04ee4edff621337e7
4
- data.tar.gz: 8298b9a619bdcaade8f6973251e3864f19a8bceec1f9fabb3d6502f89ca24902
3
+ metadata.gz: 1ea5e1ca3ea95cdb4f0beb2704afc1d92986b0a7c38aa49a70e794b2653c5764
4
+ data.tar.gz: e9994da8c7db21d1d079c5464d2ffae2bf06ee742f2a664df505f144b1d995be
5
5
  SHA512:
6
- metadata.gz: 2660e8b1312aeab36fc5fd6f68b30384a595602384f5fb8e1303833944443c484715f40bf0cecb50ac9d660a375fcf97604a0537f2e7f10fc331e306d803bb7f
7
- data.tar.gz: 1035d89affbe0c66d7eb31d27a863b234253f2dc5800c5d7a5f0ebcd8ef0f270589d9fc748bbdea6c4a070d71a7b38bd6c993eb845c5200d9fd06000315b5f8d
6
+ metadata.gz: 5c8da36cf3bec90c63888d24ac7d09dbec00219ca547df88289b3f858c25eb7f6a0ca729ee46021bfe47f7086a0cb7209a309ae95d8a88bb1b696acd0e772901
7
+ data.tar.gz: 4f7791a9be469c60ed1505d9f037653eccb0e81c1dcb18954c90daca440264eb9c0ca57067770c4d7222a86b2fca1c6a0ae1ad977becaad7d92ecda5ebf4513a
@@ -19,7 +19,7 @@ Style/TrailingCommaInArrayLiteral:
19
19
  Style/TrailingCommaInHashLiteral:
20
20
  EnforcedStyleForMultiline: no_comma
21
21
 
22
- Layout/AlignParameters:
22
+ Layout/ParameterAlignment:
23
23
  EnforcedStyle: with_first_parameter
24
24
 
25
25
  # See https://github.com/rubocop-hq/rubocop/issues/4222
@@ -0,0 +1 @@
1
+ 2.7.2
@@ -33,3 +33,5 @@ matrix:
33
33
  gemfile: gemfiles/rails52.gemfile
34
34
  - rvm: 2.6.2
35
35
  gemfile: gemfiles/rails6.gemfile
36
+ - rvm: 2.7.2
37
+ gemfile: gemfiles/rails61.gemfile
data/Gemfile CHANGED
@@ -8,5 +8,5 @@ local_gemfile = "#{File.dirname(__FILE__)}/Gemfile.local"
8
8
  if File.exist?(local_gemfile)
9
9
  eval(File.read(local_gemfile)) # rubocop:disable Lint/Eval
10
10
  else
11
- gem 'activerecord', '~> 5.1.1'
11
+ gem 'activerecord', '>= 5.2.4', '< 6.2'
12
12
  end
@@ -8,184 +8,197 @@ PATH
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- actioncable (5.1.7)
12
- actionpack (>= 5.2.4.3)
11
+ actioncable (5.2.4.4)
12
+ actionpack (= 5.2.4.4)
13
13
  nio4r (~> 2.0)
14
- websocket-driver (~> 0.6.1)
15
- actionmailer (5.1.7)
16
- actionpack (>= 5.2.4.3)
17
- actionview (>= 5.2.4.3)
18
- activejob (= 5.1.7)
14
+ websocket-driver (>= 0.6.1)
15
+ actionmailer (5.2.4.4)
16
+ actionpack (= 5.2.4.4)
17
+ actionview (= 5.2.4.4)
18
+ activejob (= 5.2.4.4)
19
19
  mail (~> 2.5, >= 2.5.4)
20
20
  rails-dom-testing (~> 2.0)
21
- actionpack (6.0.3.2)
22
- actionview (= 6.0.3.2)
23
- activesupport (= 6.0.3.2)
21
+ actionpack (5.2.4.4)
22
+ actionview (= 5.2.4.4)
23
+ activesupport (= 5.2.4.4)
24
24
  rack (~> 2.0, >= 2.0.8)
25
25
  rack-test (>= 0.6.3)
26
26
  rails-dom-testing (~> 2.0)
27
- rails-html-sanitizer (~> 1.0, >= 1.2.0)
28
- actionview (6.0.3.2)
29
- activesupport (= 6.0.3.2)
27
+ rails-html-sanitizer (~> 1.0, >= 1.0.2)
28
+ actionview (5.2.4.4)
29
+ activesupport (= 5.2.4.4)
30
30
  builder (~> 3.1)
31
31
  erubi (~> 1.4)
32
32
  rails-dom-testing (~> 2.0)
33
- rails-html-sanitizer (~> 1.1, >= 1.2.0)
34
- activejob (5.1.7)
35
- activesupport (>= 5.2.4.3)
33
+ rails-html-sanitizer (~> 1.0, >= 1.0.3)
34
+ activejob (5.2.4.4)
35
+ activesupport (= 5.2.4.4)
36
36
  globalid (>= 0.3.6)
37
- activemodel (5.1.7)
38
- activesupport (>= 5.2.4.3)
39
- activerecord (5.1.7)
40
- activemodel (= 5.1.7)
41
- activesupport (>= 5.2.4.3)
42
- arel (~> 8.0)
43
- activesupport (6.0.3.2)
37
+ activemodel (5.2.4.4)
38
+ activesupport (= 5.2.4.4)
39
+ activerecord (5.2.4.4)
40
+ activemodel (= 5.2.4.4)
41
+ activesupport (= 5.2.4.4)
42
+ arel (>= 9.0)
43
+ activestorage (5.2.4.4)
44
+ actionpack (= 5.2.4.4)
45
+ activerecord (= 5.2.4.4)
46
+ marcel (~> 0.3.1)
47
+ activesupport (5.2.4.4)
44
48
  concurrent-ruby (~> 1.0, >= 1.0.2)
45
49
  i18n (>= 0.7, < 2)
46
50
  minitest (~> 5.1)
47
51
  tzinfo (~> 1.1)
48
- zeitwerk (~> 2.2, >= 2.2.2)
49
52
  ammeter (1.1.4)
50
53
  activesupport (>= 3.0)
51
54
  railties (>= 3.0)
52
55
  rspec-rails (>= 2.2)
53
- arel (8.0.0)
54
- ast (2.4.0)
56
+ arel (9.0.0)
57
+ ast (2.4.1)
55
58
  builder (3.2.4)
56
- coderay (1.1.2)
59
+ coderay (1.1.3)
57
60
  concurrent-ruby (1.1.7)
58
61
  crass (1.0.6)
59
- database_cleaner (1.7.0)
60
- diff-lcs (1.3)
61
- dry-configurable (0.11.3)
62
+ database_cleaner (1.8.5)
63
+ diff-lcs (1.4.4)
64
+ dry-configurable (0.11.6)
62
65
  concurrent-ruby (~> 1.0)
63
66
  dry-core (~> 0.4, >= 0.4.7)
64
67
  dry-equalizer (~> 0.2)
65
- dry-core (0.4.9)
68
+ dry-core (0.5.0)
66
69
  concurrent-ruby (~> 1.0)
67
70
  dry-equalizer (0.3.0)
68
- erubi (1.9.0)
69
- faker (2.8.0)
70
- i18n (>= 1.6, < 1.8)
71
+ erubi (1.10.0)
72
+ faker (2.15.1)
73
+ i18n (>= 1.6, < 2)
71
74
  globalid (0.4.2)
72
75
  activesupport (>= 4.2.0)
73
- i18n (1.7.1)
76
+ i18n (1.8.5)
74
77
  concurrent-ruby (~> 1.0)
75
- jaro_winkler (1.5.4)
76
- jetrockets-standard (1.0.4)
77
- rubocop-rails (~> 2.3.2)
78
- rubocop-rspec (~> 1.35.0)
79
- standard (~> 0.1.4)
80
- loofah (2.7.0)
78
+ jetrockets-standard (1.0.7)
79
+ rubocop-rails (~> 2.8.1)
80
+ rubocop-rspec (~> 1.43.2)
81
+ standard (~> 0.6.1)
82
+ loofah (2.8.0)
81
83
  crass (~> 1.0.2)
82
84
  nokogiri (>= 1.5.9)
83
85
  mail (2.7.1)
84
86
  mini_mime (>= 0.1.1)
85
- method_source (0.9.2)
87
+ marcel (0.3.3)
88
+ mimemagic (~> 0.3.2)
89
+ method_source (1.0.0)
90
+ mimemagic (0.3.5)
86
91
  mini_mime (1.0.2)
87
92
  mini_portile2 (2.4.0)
88
93
  minitest (5.14.2)
89
- nio4r (2.5.2)
94
+ nio4r (2.5.4)
90
95
  nokogiri (1.10.10)
91
96
  mini_portile2 (~> 2.4.0)
92
- parallel (1.19.1)
93
- parser (2.6.5.0)
94
- ast (~> 2.4.0)
95
- pg (1.1.4)
96
- pry (0.12.2)
97
- coderay (~> 1.1.0)
98
- method_source (~> 0.9.0)
97
+ parallel (1.20.1)
98
+ parser (2.7.2.0)
99
+ ast (~> 2.4.1)
100
+ pg (1.2.3)
101
+ pry (0.13.1)
102
+ coderay (~> 1.1)
103
+ method_source (~> 1.0)
99
104
  rack (2.2.3)
100
105
  rack-test (1.1.0)
101
106
  rack (>= 1.0, < 3)
102
- rails (5.1.7)
103
- actioncable (= 5.1.7)
104
- actionmailer (= 5.1.7)
105
- actionpack (>= 5.2.4.3)
106
- actionview (>= 5.2.4.3)
107
- activejob (= 5.1.7)
108
- activemodel (= 5.1.7)
109
- activerecord (= 5.1.7)
110
- activesupport (>= 5.2.4.3)
107
+ rails (5.2.4.4)
108
+ actioncable (= 5.2.4.4)
109
+ actionmailer (= 5.2.4.4)
110
+ actionpack (= 5.2.4.4)
111
+ actionview (= 5.2.4.4)
112
+ activejob (= 5.2.4.4)
113
+ activemodel (= 5.2.4.4)
114
+ activerecord (= 5.2.4.4)
115
+ activestorage (= 5.2.4.4)
116
+ activesupport (= 5.2.4.4)
111
117
  bundler (>= 1.3.0)
112
- railties (= 5.1.7)
118
+ railties (= 5.2.4.4)
113
119
  sprockets-rails (>= 2.0.0)
114
120
  rails-dom-testing (2.0.3)
115
121
  activesupport (>= 4.2.0)
116
122
  nokogiri (>= 1.6)
117
123
  rails-html-sanitizer (1.3.0)
118
124
  loofah (~> 2.3)
119
- railties (5.1.7)
120
- actionpack (>= 5.2.4.3)
121
- activesupport (>= 5.2.4.3)
125
+ railties (5.2.4.4)
126
+ actionpack (= 5.2.4.4)
127
+ activesupport (= 5.2.4.4)
122
128
  method_source
123
129
  rake (>= 0.8.7)
124
- thor (>= 0.18.1, < 2.0)
130
+ thor (>= 0.19.0, < 2.0)
125
131
  rainbow (3.0.0)
126
- rake (13.0.1)
127
- rspec (3.9.0)
128
- rspec-core (~> 3.9.0)
129
- rspec-expectations (~> 3.9.0)
130
- rspec-mocks (~> 3.9.0)
131
- rspec-core (3.9.0)
132
- rspec-support (~> 3.9.0)
133
- rspec-expectations (3.9.0)
132
+ rake (13.0.3)
133
+ regexp_parser (2.0.1)
134
+ rexml (3.2.4)
135
+ rspec (3.10.0)
136
+ rspec-core (~> 3.10.0)
137
+ rspec-expectations (~> 3.10.0)
138
+ rspec-mocks (~> 3.10.0)
139
+ rspec-core (3.10.0)
140
+ rspec-support (~> 3.10.0)
141
+ rspec-expectations (3.10.0)
134
142
  diff-lcs (>= 1.2.0, < 2.0)
135
- rspec-support (~> 3.9.0)
136
- rspec-mocks (3.9.0)
143
+ rspec-support (~> 3.10.0)
144
+ rspec-mocks (3.10.0)
137
145
  diff-lcs (>= 1.2.0, < 2.0)
138
- rspec-support (~> 3.9.0)
139
- rspec-rails (3.9.0)
140
- actionpack (>= 3.0)
141
- activesupport (>= 3.0)
142
- railties (>= 3.0)
143
- rspec-core (~> 3.9.0)
144
- rspec-expectations (~> 3.9.0)
145
- rspec-mocks (~> 3.9.0)
146
- rspec-support (~> 3.9.0)
147
- rspec-support (3.9.0)
148
- rubocop (0.75.1)
149
- jaro_winkler (~> 1.5.1)
146
+ rspec-support (~> 3.10.0)
147
+ rspec-rails (4.0.1)
148
+ actionpack (>= 4.2)
149
+ activesupport (>= 4.2)
150
+ railties (>= 4.2)
151
+ rspec-core (~> 3.9)
152
+ rspec-expectations (~> 3.9)
153
+ rspec-mocks (~> 3.9)
154
+ rspec-support (~> 3.9)
155
+ rspec-support (3.10.0)
156
+ rubocop (0.91.1)
150
157
  parallel (~> 1.10)
151
- parser (>= 2.6)
158
+ parser (>= 2.7.1.1)
152
159
  rainbow (>= 2.2.2, < 4.0)
160
+ regexp_parser (>= 1.7)
161
+ rexml
162
+ rubocop-ast (>= 0.4.0, < 1.0)
153
163
  ruby-progressbar (~> 1.7)
154
- unicode-display_width (>= 1.4.0, < 1.7)
155
- rubocop-performance (1.5.1)
156
- rubocop (>= 0.71.0)
157
- rubocop-rails (2.3.2)
164
+ unicode-display_width (>= 1.4.0, < 2.0)
165
+ rubocop-ast (0.8.0)
166
+ parser (>= 2.7.1.5)
167
+ rubocop-performance (1.8.1)
168
+ rubocop (>= 0.87.0)
169
+ rubocop-ast (>= 0.4.0)
170
+ rubocop-rails (2.8.1)
171
+ activesupport (>= 4.2.0)
158
172
  rack (>= 1.1)
159
- rubocop (>= 0.72.0)
160
- rubocop-rspec (1.35.0)
161
- rubocop (>= 0.60.0)
173
+ rubocop (>= 0.87.0)
174
+ rubocop-rspec (1.43.2)
175
+ rubocop (~> 0.87)
162
176
  ruby-progressbar (1.10.1)
163
177
  sprockets (4.0.2)
164
178
  concurrent-ruby (~> 1.0)
165
179
  rack (> 1, < 3)
166
- sprockets-rails (3.2.1)
180
+ sprockets-rails (3.2.2)
167
181
  actionpack (>= 4.0)
168
182
  activesupport (>= 4.0)
169
183
  sprockets (>= 3.0.0)
170
- standard (0.1.6)
171
- rubocop (~> 0.75.0)
172
- rubocop-performance (~> 1.5.0)
173
- thor (0.20.3)
184
+ standard (0.6.2)
185
+ rubocop (= 0.91.1)
186
+ rubocop-performance (= 1.8.1)
187
+ thor (1.0.1)
174
188
  thread_safe (0.3.6)
175
- timecop (0.9.1)
176
- tzinfo (1.2.7)
189
+ timecop (0.9.2)
190
+ tzinfo (1.2.9)
177
191
  thread_safe (~> 0.1)
178
- unicode-display_width (1.6.0)
179
- websocket-driver (0.6.5)
192
+ unicode-display_width (1.7.0)
193
+ websocket-driver (0.7.3)
180
194
  websocket-extensions (>= 0.1.0)
181
195
  websocket-extensions (0.1.5)
182
- zeitwerk (2.4.0)
183
196
 
184
197
  PLATFORMS
185
198
  ruby
186
199
 
187
200
  DEPENDENCIES
188
- activerecord (~> 5.1.1)
201
+ activerecord (>= 5.2.4, < 6.2)
189
202
  ammeter (>= 1.1)
190
203
  bundler (>= 1.3)
191
204
  database_cleaner (>= 1.7)
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rails', '~>5.2'
3
+ gem 'rails', '~> 5.2'
4
4
  gem 'activerecord', '~> 5.2.4.3'
5
5
 
6
6
  gemspec path: '..'
@@ -1,6 +1,6 @@
1
1
  source "https://rubygems.org"
2
2
 
3
- gem 'rails', '~>6.0'
4
- gem 'activerecord', '~> 6.0'
3
+ gem 'rails', '~> 6.0', ' < 6.1'
4
+ gem 'activerecord', '~> 6.0', '< 6.1'
5
5
 
6
6
  gemspec path: '..'
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ gem 'rails', '~> 6.1'
4
+ gem 'activerecord', '~> 6.1'
5
+
6
+ gemspec path: '..'
@@ -25,7 +25,7 @@ module Metka
25
25
  gsub_quote_pattern!(tag_list, value, double_quote_pattern)
26
26
  gsub_quote_pattern!(tag_list, value, single_quote_pattern)
27
27
 
28
- tag_list.merge value.split(Regexp.new delimiter).map(&:strip).reject(&:empty?)
28
+ tag_list.merge value.split(Regexp.new(delimiter)).map(&:strip).reject(&:empty?)
29
29
  when Enumerable
30
30
  tag_list.merge value.reject(&:empty?)
31
31
  end
@@ -46,7 +46,7 @@ module Metka
46
46
  end
47
47
 
48
48
  def single_quote_pattern
49
- @single_quote_pattern[delimiter] ||= /(\A|#{delimiter})\s*'(.*?)'\s*(?=#{delimiter}\s*|\z)/
49
+ @single_quote_pattern[delimiter] ||= /(\A|#{delimiter})\s*'(.*?)'\s*(?=#{delimiter}\s*|\z)/
50
50
  end
51
51
 
52
52
  def double_quote_pattern
@@ -43,10 +43,10 @@ module Metka
43
43
 
44
44
  base.class_eval do
45
45
  columns.each do |column|
46
- scope "with_all_#{column}", ->(tags) { tagged_with(tags, on: [ column ]) }
47
- scope "with_any_#{column}", ->(tags) { tagged_with(tags, on: [ column ], any: true) }
48
- scope "without_all_#{column}", ->(tags) { tagged_with(tags, on: [ column ], exclude: true) }
49
- scope "without_any_#{column}", ->(tags) { tagged_with(tags, on: [ column ], any: true, exclude: true) }
46
+ scope "with_all_#{column}", ->(tags) { tagged_with(tags, on: [column]) }
47
+ scope "with_any_#{column}", ->(tags) { tagged_with(tags, on: [column], any: true) }
48
+ scope "without_all_#{column}", ->(tags) { tagged_with(tags, on: [column], exclude: true) }
49
+ scope "without_any_#{column}", ->(tags) { tagged_with(tags, on: [column], any: true, exclude: true) }
50
50
  end
51
51
 
52
52
  unless respond_to?(:tagged_with)
@@ -66,7 +66,7 @@ module Metka
66
66
  prepared_unnest = columns.map { |column| "#{table_name}.#{column}" }.join(' || ')
67
67
  subquery = all.select("UNNEST(#{prepared_unnest}) AS tag_name")
68
68
 
69
- unscoped.from(subquery).group(:tag_name).pluck(:tag_name, 'COUNT(*) AS taggings_count')
69
+ unscoped.from(subquery).group(:tag_name).pluck(:tag_name, Arel.sql('COUNT(*) AS taggings_count'))
70
70
  end
71
71
 
72
72
  columns.each do |column|
@@ -10,11 +10,11 @@ module Metka
10
10
  def call(model, columns, tags, options)
11
11
  strategy = options_to_strategy(options)
12
12
 
13
- query = join(options[:join_operator]) do
13
+ query = join(options[:join_operator]) {
14
14
  columns.map do |column|
15
15
  build_query(strategy, model, column, tags)
16
16
  end
17
- end
17
+ }
18
18
 
19
19
  if options[:exclude].present?
20
20
  Arel::Nodes::Not.new(query)
@@ -43,11 +43,13 @@ module Metka
43
43
  end
44
44
  end
45
45
 
46
- # @param nodes [Array<Arel::Node>, Arel::Node]
47
- # @return [Arel::Node]
46
+ # @param nodes [Array<Arel::Nodes::Node>, Arel::Nodes::Node]
47
+ # @return [Arel::Nodes::Node]
48
48
  def join_or(nodes)
49
+ node_base_klass = defined?(::Arel::Nodes::Node) ? ::Arel::Nodes::Node : ::Arel::Node
50
+
49
51
  case nodes
50
- when ::Arel::Node
52
+ when node_base_klass
51
53
  nodes
52
54
  when Array
53
55
  l, *r = nodes
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'singleton'
3
4
 
4
5
  module Metka
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Metka
4
- VERSION = '2.0.3'
4
+ VERSION = '2.1.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: metka
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Alexandrov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2020-09-04 00:00:00.000000000 Z
12
+ date: 2020-12-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: dry-configurable
@@ -205,6 +205,7 @@ files:
205
205
  - ".gitignore"
206
206
  - ".rspec"
207
207
  - ".rubocop.yml"
208
+ - ".ruby-version"
208
209
  - ".travis.yml"
209
210
  - CODE_OF_CONDUCT.md
210
211
  - Gemfile
@@ -214,9 +215,9 @@ files:
214
215
  - Rakefile
215
216
  - bin/console
216
217
  - bin/setup
217
- - gemfiles/rails5.gemfile
218
218
  - gemfiles/rails52.gemfile
219
219
  - gemfiles/rails6.gemfile
220
+ - gemfiles/rails61.gemfile
220
221
  - lib/generators/metka/strategies/materialized_view/materialized_view_generator.rb
221
222
  - lib/generators/metka/strategies/materialized_view/templates/migration.rb.erb
222
223
  - lib/generators/metka/strategies/view/templates/migration.rb.erb
@@ -250,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
250
251
  - !ruby/object:Gem::Version
251
252
  version: '0'
252
253
  requirements: []
253
- rubygems_version: 3.0.6
254
+ rubygems_version: 3.1.4
254
255
  signing_key:
255
256
  specification_version: 4
256
257
  summary: Rails tagging system based on PostgreSQL arrays
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- gem 'rails', '~>5.1'
4
- gem 'activerecord', '~> 5.2.4.3'
5
-
6
- gemspec path: '..'