redis_scanner 0.1.4 → 0.1.5

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
  SHA1:
3
- metadata.gz: 1f3caec0caf363f654534e72a721a6aa800db43e
4
- data.tar.gz: fddaf355144726462164b00552c20be7fd4a5b79
3
+ metadata.gz: 5cff13d7534968118b1c45c3b19cfb2dd9c0f95d
4
+ data.tar.gz: 6f43165047395b2cc641110553accbb283f81051
5
5
  SHA512:
6
- metadata.gz: c996fbbec218b7c45d69f838da6750f46c96c750419ee1a8b64d474b10a94709b246b9c179b49acbfc6164bd991d7cbc737bf75252f94b30534b6cf75be541ab
7
- data.tar.gz: be62722d95943fbdd710ba533a3f9d940df39b3260b0b48591f30da7dc0fd6189ef8fccf4646e615997980efed397e760720a14e49748b0e65bb0b5bdf876c55
6
+ metadata.gz: 646c29ca228ec13e168d00ce4b20499f803772d199b3858e6ed13cbcd2188e8648b47ead4584cb04dd06bacf12d137a6b8f7f2d9b4ebb93df06d3af3073028ff
7
+ data.tar.gz: 9295e780f4749c1b4f776cf9c52aa87223ba888e1890f895eafc4fd6a10295580714b8b1a74c262f8b2345adc677b526da89a042d153f42e043b7c7772aab283
data/.travis.yml CHANGED
@@ -1,4 +1,8 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 1.9.3
4
+ - 2.0.0
3
5
  - 2.3.0
4
6
  before_install: gem install bundler -v 1.11.2
7
+ services:
8
+ - redis-server
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## v0.1.5
2
+ * Resolve invalid byte sequence key.
3
+ * Add travis CI support.
4
+ * Add MIT LICENSE.
5
+
6
+ ## v0.1.4
7
+ * Display key and type in one line.
8
+
1
9
  ## v0.1.3
2
10
 
3
11
  * Provide key's detail information which includes type and size.
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2016 Vincent Xie
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # RedisScanner
1
+ # RedisScanner [![Build Status][travis-image]][travis-link]
2
+
3
+ [travis-image]: https://travis-ci.org/xiewenwei/redis_scanner.svg?branch=master
4
+ [travis-link]: http://travis-ci.org/xiewenwei/redis_scanner
5
+ [travis-home]: http://travis-ci.org/
2
6
 
3
7
  RedisScanner is a tiny tool for scanning all redis keys and creating statistic result. The features are the followings.
4
8
 
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  require "ruby-progressbar"
2
4
 
3
5
  module RedisScanner
@@ -55,6 +57,5 @@ module RedisScanner
55
57
 
56
58
  stat
57
59
  end
58
-
59
60
  end
60
61
  end
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  require "terminal-table"
2
4
 
3
5
  module RedisScanner
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  module RedisScanner
2
4
  class PatternItem
3
5
  attr_reader :type, :count, :size
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  module RedisScanner
2
4
  class Redis
3
5
  attr_reader :client
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  module RedisScanner
2
4
  class Rule
3
5
  PRESET_RULES = [
@@ -14,6 +16,7 @@ module RedisScanner
14
16
  end
15
17
 
16
18
  def extract_pattern(key)
19
+ key = force_valid_key(key)
17
20
  @rules.each do |rule, replacer|
18
21
  if m = rule.match(key)
19
22
  key = key.sub(m[1], replacer)
@@ -22,5 +25,20 @@ module RedisScanner
22
25
  end
23
26
  key
24
27
  end
28
+
29
+ private
30
+
31
+ def force_valid_key(key)
32
+ if key.valid_encoding?
33
+ key
34
+ else
35
+ key.size.times do |index|
36
+ unless key[index].valid_encoding?
37
+ key[index] = "?"
38
+ end
39
+ end
40
+ key
41
+ end
42
+ end
25
43
  end
26
44
  end
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  module RedisScanner
2
- VERSION = "0.1.4"
4
+ VERSION = "0.1.5"
3
5
  end
data/lib/redis_scanner.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # -*- encoding : utf-8 -*-
2
+
1
3
  require "redis_scanner/version"
2
4
  require "redis_scanner/rule"
3
5
  require "redis_scanner/pattern"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis_scanner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vincent Xie
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-29 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -109,6 +109,7 @@ files:
109
109
  - CHANGELOG.md
110
110
  - CODE_OF_CONDUCT.md
111
111
  - Gemfile
112
+ - LICENSE
112
113
  - README.md
113
114
  - Rakefile
114
115
  - bin/redis_scanner