redis_counters 1.5.1 → 1.5.2

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
- SHA1:
3
- metadata.gz: 98ed479650224ea88e6e4bd246261c38f9aad322
4
- data.tar.gz: 935fca9f98e46caed3bb0fec2326297659bfae0e
2
+ SHA256:
3
+ metadata.gz: ee8632f37abf5f884a41073d7da1d6af0d03a42124aa5667bcd4c867872f4a23
4
+ data.tar.gz: 5999cedae855634e290a58b1bc17fbbb5ab596d57ff48a6847c8e85bda013809
5
5
  SHA512:
6
- metadata.gz: fad9d9cf5db41a260a2f40c4893ced84ada4a40c350ad383455edd9867cd3581b881af2bb3cd73262b95363fc8a8f02e0ed74ec65b1203d8379edf888f25c1bf
7
- data.tar.gz: 889bf55c4d9d95fc056130aa5cf72db60784e3f3a29af928799db2c0e1cebfcf77d9b3eb572c7e1eb62801d43e92ae2f340a91a9a42c9491055cc77515f9fc6d
6
+ metadata.gz: 800be8089bfe3444442ac06c0c49c656aa73bcfc06282de92949a89dfc40035198ba472ae8b7d75ff9cfde680a04af96e1e97f7497b601dde17e6205fb4d4243
7
+ data.tar.gz: ec6cd875271549cff1ebce5b0febe55d4901c8f956aa5e436a3d427ec3ac83096058d87912b33e7162e8da475db713d8b1468bbe5c7675bb2d0f156810f7259b
data/.drone.yml CHANGED
@@ -41,24 +41,6 @@ spec_step_common: &spec_step_common
41
41
  - dip rspec
42
42
 
43
43
  steps:
44
- - name: Tests Ruby 2.2
45
- environment:
46
- COMPOSE_FILE_EXT: drone
47
- DOCKER_RUBY_VERSION: 2.2
48
- RUBY_IMAGE_TAG: 2.2-latest
49
- REDIS_IMAGE_TAG: 4-alpine
50
- RAILS_ENV: test
51
- <<: *spec_step_common
52
-
53
- - name: Tests Ruby 2.3
54
- environment:
55
- COMPOSE_FILE_EXT: drone
56
- DOCKER_RUBY_VERSION: 2.3
57
- RUBY_IMAGE_TAG: 2.3-latest
58
- REDIS_IMAGE_TAG: 4-alpine
59
- RAILS_ENV: test
60
- <<: *spec_step_common
61
-
62
44
  - name: Tests Ruby 2.4
63
45
  environment:
64
46
  COMPOSE_FILE_EXT: drone
data/Appraisals CHANGED
@@ -1,9 +1,4 @@
1
- if RUBY_VERSION < '2.4'
2
- appraise 'rails4.0' do
3
- gem 'activesupport', '~> 4.0.0'
4
- end
5
- end
6
-
1
+ # frozen_string_literal: true
7
2
  appraise 'rails4.2' do
8
3
  gem 'activesupport', '~> 4.2.0'
9
4
  end
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
+ # v1.5.2
2
+
3
+ * 2022-05-05 [9c3a157](../../commit/9c3a157) - __(Igor Prudnikov)__ Release 1.5.2
4
+ * 2022-05-05 [fb05645](../../commit/fb05645) - __(Igor Prudnikov)__ fix: fix hash counter with delimeters containing non-utf8 data
5
+ https://jira.railsc.ru/browse/BPC-20533
6
+
7
+ * 2022-05-05 [e10e51d](../../commit/e10e51d) - __(Igor Prudnikov)__ chore: remove older ruby versions support
8
+
1
9
  # v1.5.1
2
10
 
3
- * 2021-08-06 [3302af4](../../commit/3302af4) - __(TamarinEA)__ Release 1.5.1
4
11
  * 2021-08-06 [09ed078](../../commit/09ed078) - __(TamarinEA)__ chore: support ruby 2.4 and use redis in test
5
12
 
6
13
  # v1.5.0
data/Gemfile CHANGED
@@ -1,3 +1,8 @@
1
+ # frozen_string_literal: true
1
2
  source 'https://rubygems.org'
2
3
 
3
4
  gemspec
5
+
6
+ gem 'nokogiri', '< 1.11.0', require: false
7
+ gem 'parallel', '< 1.21.0'
8
+ gem 'racc', ' < 1.6.0', require: false
data/dip.yml CHANGED
@@ -1,8 +1,8 @@
1
1
  version: '1'
2
2
 
3
3
  environment:
4
- DOCKER_RUBY_VERSION: 2.2
5
- RUBY_IMAGE_TAG: 2.2-latest
4
+ DOCKER_RUBY_VERSION: 2.4
5
+ RUBY_IMAGE_TAG: 2.4-latest
6
6
  REDIS_IMAGE_TAG: 4-alpine
7
7
  COMPOSE_FILE_EXT: development
8
8
  RAILS_ENV: test
@@ -1,5 +1,6 @@
1
1
  require 'redis_counters/base_counter'
2
2
  require 'redis_counters/clusterize_and_partitionize'
3
+ require 'string_tools'
3
4
 
4
5
  module RedisCounters
5
6
  # Счетчик на основе redis-hash, с возможностью партиционирования и кластеризации значений.
@@ -53,6 +54,7 @@ module RedisCounters
53
54
  end
54
55
 
55
56
  redis.hgetall(key(partition, cluster)).inject(Array.new) do |result, (key, value)|
57
+ key = key.dup.to_utf8
56
58
  values = if delimiter_is_ary
57
59
  if key.include?(new_delim)
58
60
  key.split(new_delim, -1)
@@ -1,3 +1,3 @@
1
1
  module RedisCounters
2
- VERSION = '1.5.1'.freeze
2
+ VERSION = '1.5.2'.freeze
3
3
  end
@@ -16,6 +16,7 @@ Gem::Specification.new do |spec|
16
16
  spec.require_paths = ['lib']
17
17
 
18
18
  spec.add_runtime_dependency 'activesupport', '>= 4.0', '< 5'
19
+ spec.add_runtime_dependency 'string_tools'
19
20
 
20
21
  spec.add_development_dependency 'bundler'
21
22
  spec.add_development_dependency 'rake'
@@ -504,6 +504,27 @@ describe RedisCounters::HashCounter do
504
504
  end
505
505
  end
506
506
 
507
+ context 'when non-utf8 data contains delimeters' do
508
+ let(:options) do
509
+ {
510
+ counter_name: :test_counter,
511
+ group_keys: [:title, :url],
512
+ partition_keys: [:date],
513
+ key_delimiter: '&',
514
+ value_delimiter: '|'
515
+ }
516
+ end
517
+ let(:partition) { {title: "Erg\xE4nzendes", url: 'http://example.com', date: '2022-05-04'} }
518
+
519
+ before do
520
+ redis.hincrbyfloat('test_counter&2022-05-04', "Erg\xE4nzendes|http://example.com", 1.0)
521
+ end
522
+
523
+ it 'successfully splits data' do
524
+ expect(counter.data).to eq([{'value' => 1, 'title' => 'Ergänzendes', 'url' => 'http://example.com'}])
525
+ end
526
+ end
527
+
507
528
  context 'when check custom increment' do
508
529
  let(:options) { {
509
530
  :counter_name => :test_counter,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_counters
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Napolskih
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-06 00:00:00.000000000 Z
11
+ date: 2022-05-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -30,6 +30,20 @@ dependencies:
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '5'
33
+ - !ruby/object:Gem::Dependency
34
+ name: string_tools
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ type: :runtime
41
+ prerelease: false
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
33
47
  - !ruby/object:Gem::Dependency
34
48
  name: bundler
35
49
  requirement: !ruby/object:Gem::Requirement
@@ -251,8 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
265
  - !ruby/object:Gem::Version
252
266
  version: '0'
253
267
  requirements: []
254
- rubyforge_project:
255
- rubygems_version: 2.6.1
268
+ rubygems_version: 3.0.3
256
269
  signing_key:
257
270
  specification_version: 4
258
271
  summary: Redis Counters