uri-redis 1.3.0 → 1.4.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: a7c320d796599dbe819c6f6f42ab5655fd476c6c4c14fbb5e2e06b96d406ed0b
4
- data.tar.gz: 82a9de5b109832c565cbded9aa9311020bf4937b27959086941582caa5c3403c
3
+ metadata.gz: af7ccb17e1509fdc10ccfadb90521152d846b738c5da53604cda75bc921ac6a9
4
+ data.tar.gz: 41e14b1fda3fe4f0a24ebb6d24c3311df608d7dd04d12a9078230101d96d472a
5
5
  SHA512:
6
- metadata.gz: b7a975c5b9aadd178da1f52d25910dc4b9bfd33b065cfbd876dfd4b622de860a2a31e0a99e2e30b541ed72571a1713a00981f0774f7ce932c41ac221077589b4
7
- data.tar.gz: ae0da4815dddaa945093437f9ec2df218ec0e29be9b4f73cef0460d9046038d0933e4eb4e28f01b60b84d1550ae7c1e28ecb344026c4fae1dd27c01aebb89dbe
6
+ metadata.gz: 5811a0a6de76e14ff2eb09c64f9561cc1d4f162ffe563ce521d248911bf4a790a70cab565ab7da12803b6f2fc524a765ad5f328017b2ef3be152adf33ffb7d6c
7
+ data.tar.gz: fca4b7308b95bed61297b9f527692ea821f4ae2d568aa8a48563726b67ac45a5f594f98067ba24e09566327584d7e1ce145956940e039bcd667a8973f2cb376b
data/CHANGES.txt CHANGED
@@ -1,4 +1,12 @@
1
- URI-Redis, CHANGES
1
+ URI-Valkey, CHANGES
2
+
3
+ #### 1.4.0 (2024-06-15) ###############################
4
+
5
+ * CHANGE: Monorepo structure for uri-redis and uri-valkey gems
6
+ * ADDED: uri-valkey gem with URI::Valkey class for valkey:// and valkeys:// schemes
7
+ * FIXED: Path handling when key is nil or empty
8
+ * FIXED: Frozen string errors in key handling
9
+
2
10
 
3
11
  #### 1.3.0 (2024-06-15) ###############################
4
12
 
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2023 delano
3
+ Copyright (c) delano
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,49 +1,129 @@
1
- # URI-Redis v1.3 (2024-06-15)
1
+ # URI-Valkey
2
2
 
3
- Creates a URI object for Redis URLs.
3
+ Creates URI objects for Valkey URLs, with support for parsing connection strings and extracting configuration parameters.
4
4
 
5
- e.g.
5
+ ## Supported URI Formats
6
6
 
7
- redis://host:port/dbindex
7
+ valkey://host:port/dbindex
8
+ valkeys://host:port/dbindex # SSL
9
+ redis://host:port/dbindex # Cross-scheme compatibility
10
+ rediss://host:port/dbindex # Cross-scheme compatibility (SSL)
11
+
12
+ ## Installation
13
+
14
+ * `gem install uri-valkey`
15
+ * `git clone git@github.com:delano/uri-valkey.git`
8
16
 
9
17
  ## Usage
10
18
 
11
19
  ```ruby
12
- require 'uri/redis'
20
+ require 'uri-valkey' # or require 'uri_valkey'
13
21
 
14
- conf = URI.parse 'redis://localhost:4380/2'
15
- conf.scheme # => "redis"
16
- conf.host # => localhost
17
- conf.port # => 4380
18
- conf.db # => 2
19
- conf.to_s # => redis://localhost:4380/2
22
+ conf = URI.parse 'valkey://localhost:6379/0'
23
+ conf.scheme # => "valkey"
24
+ conf.host # => "localhost"
25
+ conf.port # => 6379
26
+ conf.db # => 0
27
+ conf.to_s # => "valkey://localhost:6379/0"
28
+
29
+ # Access configuration hash
30
+ conf.conf # => {:host=>"localhost", :port=>6379, :db=>0, :ssl=>false}
20
31
  ```
21
32
 
22
33
  ### SSL Support
23
34
 
24
- SSL is supported by using the `rediss` scheme. Note: SSL support is only available in Redis (Server) 6.0 and later and via redis-rb 4.7 and later.
35
+ SSL is supported by using the `valkeys` scheme:
36
+
37
+ ```ruby
38
+ conf = URI.parse 'valkeys://localhost:6379/0'
39
+ conf.scheme # => "valkeys"
40
+ conf.conf[:ssl] # => true
41
+ ```
42
+
43
+ ### Working with Keys
44
+
45
+ The URI class supports parsing and manipulating Valkey keys:
25
46
 
26
47
  ```ruby
27
- require 'uri/redis'
48
+ uri = URI.parse 'valkey://localhost:6379/2/mykey:namespace'
49
+ uri.db # => 2
50
+ uri.key # => "mykey:namespace"
28
51
 
29
- conf = URI.parse 'rediss://localhost:4380/2'
30
- conf.scheme # => "rediss"
31
- conf.to_s # => rediss://localhost:4380/2
52
+ # Modify the key
53
+ uri.key = 'newkey:value'
54
+ uri.to_s # => "valkey://localhost:6379/2/newkey:value"
55
+
56
+ # Modify the database
57
+ uri.db = 5
58
+ uri.to_s # => "valkey://localhost:6379/5/newkey:value"
32
59
  ```
33
60
 
61
+ ### Building URIs
34
62
 
35
- ## Installation
63
+ ```ruby
64
+ uri = URI::Valkey.build(host: "localhost", port: 6379, db: 2, key: "v1:arbitrary:key")
65
+ uri.to_s # => "valkey://localhost:6379/2/v1:arbitrary:key"
66
+ ```
36
67
 
37
- Get it in one of the following ways:
68
+ ### Query Parameters
38
69
 
39
- * `gem install uri-redis`
40
- * `git clone git@github.com:delano/uri-redis.git`
70
+ Query parameters are supported for additional configuration:
41
71
 
72
+ ```ruby
73
+ uri = URI.parse "valkey://127.0.0.1/6/?timeout=5&retries=3"
74
+ uri.conf # => {:db=>6, :timeout=>5, :retries=>"3", :host=>"127.0.0.1", :port=>6379, :ssl=>false}
75
+ ```
42
76
 
43
- ## About
77
+ ## Cross-Scheme Compatibility
78
+
79
+ Both gems support each other's URL schemes for maximum flexibility:
80
+
81
+ ```ruby
82
+ # Valkey gem can parse Redis URLs
83
+ redis_uri = URI.parse 'redis://localhost:6379/0'
84
+ redis_uri.scheme # => "redis"
85
+ redis_uri.conf # => {:host=>"localhost", :port=>6379, :db=>0, :ssl=>false}
86
+
87
+ # SSL schemes work cross-platform
88
+ ssl_uri = URI.parse 'rediss://localhost:6379/0'
89
+ ssl_uri.conf[:ssl] # => true
90
+ ```
91
+
92
+ ## URI-Redis
93
+
94
+ A `uri-redis` gem is also available with identical functionality for Redis URLs, including support for `valkey://` and `valkeys://` schemes:
95
+
96
+ ```ruby
97
+ require 'uri-redis'
98
+
99
+ conf = URI.parse 'redis://localhost:6379/0'
100
+ conf.scheme # => "redis"
101
+ conf.conf # => {:host=>"localhost", :port=>6379, :db=>0, :ssl=>false}
102
+ ```
103
+
104
+ ### Redis Client Integration
44
105
 
45
- * [Github](https://github.com/delano/uri-redis)
106
+ If you have the `redis` gem installed, URI-Redis provides a refinement to add URI support directly to Redis client instances:
107
+
108
+ ```ruby
109
+ require 'uri-redis'
110
+
111
+ # Enable the refinement in your scope
112
+ using RedisURIRefinement
113
+
114
+ redis = Redis.new(url: 'redis://localhost:6379/2')
115
+ redis.uri # Returns URI object for the Redis client's connection
116
+
117
+ # Class method for generating URIs from configuration
118
+ Redis.uri(host: 'localhost', port: 6379, db: 2, ssl: true)
119
+ # => URI object for "rediss://localhost:6379/2"
120
+ ```
121
+
122
+ **Note:** The refinement is only available when the `redis` gem is loaded and only works within scopes where `using RedisURIRefinement` has been called.
123
+
124
+ ## About
46
125
 
126
+ * [Github](https://github.com/delano/uri-valkey)
47
127
 
48
128
  ## License
49
129
 
@@ -0,0 +1,102 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+ require 'uri/generic'
5
+
6
+ module URI
7
+ # Shared module for Valkey-compatible database URI classes (Redis, Valkey, etc.)
8
+ # Provides common functionality for handling database URIs with database indices and key paths
9
+ module PerfectStrangers
10
+ DEFAULT_PORT = 6379
11
+ DEFAULT_DB = 0
12
+
13
+ def self.included(base)
14
+ base.extend(ClassMethods)
15
+ end
16
+
17
+ # Class methods for database URI classes
18
+ module ClassMethods
19
+ def build(args)
20
+ tmp = Util.make_components_hash(self, args)
21
+ super(tmp)
22
+ end
23
+ end
24
+
25
+ def request_uri
26
+ path_query
27
+ end
28
+
29
+ def key
30
+ return if path.nil?
31
+
32
+ self.path ||= "/#{DEFAULT_DB}"
33
+ (self.path.split('/')[2..] || []).join('/')
34
+ end
35
+
36
+ def key=(val)
37
+ self.path = if val && !val.to_s.empty?
38
+ "/#{db}/#{val}"
39
+ else
40
+ "/#{db}"
41
+ end
42
+ end
43
+
44
+ def db
45
+ self.path ||= "/#{DEFAULT_DB}"
46
+ (self.path.split('/')[1] || DEFAULT_DB).to_i
47
+ end
48
+
49
+ def db=(val)
50
+ current_key = key
51
+ self.path = if current_key && !current_key.empty?
52
+ "/#{val}/#{current_key}"
53
+ else
54
+ "/#{val}"
55
+ end
56
+ end
57
+
58
+ def conf
59
+ hsh = {
60
+ host: host,
61
+ port: port,
62
+ db: db,
63
+ ssl: ssl_schemes.include?(scheme)
64
+ }.merge(parse_query(query))
65
+ hsh[:password] = password if password
66
+ hsh[:timeout] = hsh[:timeout].to_i if hsh.key?(:timeout)
67
+ hsh
68
+ end
69
+
70
+ def serverid
71
+ format('%s://%s:%s/%s', scheme, host, port, db)
72
+ end
73
+
74
+ private
75
+
76
+ # Override in including classes to define which schemes use SSL
77
+ def ssl_schemes
78
+ raise NotImplementedError, 'ssl_schemes must be implemented in including classes'
79
+ end
80
+
81
+ # Based on: https://github.com/chneukirchen/rack/blob/master/lib/rack/utils.rb
82
+ # which was originally based on Mongrel
83
+ def parse_query(query, delim = nil)
84
+ delim ||= '&;'
85
+ params = {}
86
+ (query || '').split(/[#{delim}] */n).each do |p|
87
+ k, v = p.split('=', 2).map { |str| str } # NOTE: uri_unescape
88
+ k = k.to_sym
89
+ if (cur = params[k])
90
+ if cur.instance_of?(Array)
91
+ params[k] << v
92
+ else
93
+ params[k] = [cur, v]
94
+ end
95
+ else
96
+ params[k] = v
97
+ end
98
+ end
99
+ params
100
+ end
101
+ end
102
+ end
@@ -1,10 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "uri/generic"
3
+ require 'uri'
4
+ require 'uri/generic'
4
5
 
5
6
  module URI
6
7
  class Redis < URI::Generic
7
- VERSION = "1.3.0"
8
- SUMMARY = "A Ruby library for parsing, building and normalizing redis URLs"
8
+ VERSION = '1.4.0'
9
+ SUMMARY = 'A Ruby library for parsing, building and normalizing redis URLs'
9
10
  end
10
11
  end
data/lib/uri/redis.rb CHANGED
@@ -1,6 +1,9 @@
1
- require "uri"
2
- require "uri/generic"
3
- require "redis"
1
+ # frozen_string_literal: true
2
+
3
+ require 'uri'
4
+ require 'uri/generic'
5
+
6
+ require_relative 'perfect_strangers'
4
7
 
5
8
  # URI::Redis - adds support for Redis URIs to core.
6
9
  module URI
@@ -17,107 +20,44 @@ module URI
17
20
  # uri = URI::Redis.build(host: "localhost", port: 6379, db: 2)
18
21
  # uri.to_s #=> "redis://localhost:6379/2"
19
22
  class Redis < URI::Generic
20
- DEFAULT_PORT = 6379
21
- DEFAULT_DB = 0
22
-
23
- def self.build(args)
24
- tmp = Util.make_components_hash(self, args)
25
- super(tmp)
26
- end
27
-
28
- def request_uri
29
- path_query
30
- end
31
-
32
- def key
33
- return if path.nil?
34
-
35
- self.path ||= "/#{DEFAULT_DB}"
36
- (self.path.split("/")[2..] || []).join("/")
37
- end
38
-
39
- def key=(val)
40
- self.path = "/" << [db, val].join("/")
41
- end
42
-
43
- def db
44
- self.path ||= "/#{DEFAULT_DB}"
45
- (self.path.split("/")[1] || DEFAULT_DB).to_i
46
- end
47
-
48
- def db=(val)
49
- current_key = key
50
- self.path = "/#{val}"
51
- self.path << "/#{current_key}"
52
- self.path
53
- end
54
-
55
- # Returns a hash suitable for sending to Redis.new.
56
- # The hash is generated from the host, port, db and
57
- # password from the URI as well as any query vars.
58
- #
59
- # e.g.
60
- #
61
- # uri = URI.parse "redis://127.0.0.1/6/?timeout=5"
62
- # uri.conf
63
- # # => {:db=>6, :timeout=>"5", :host=>"127.0.0.1", :port=>6379}
64
- #
65
- def conf
66
- hsh = {
67
- host: host,
68
- port: port,
69
- db: db,
70
- ssl: scheme == 'rediss'
71
- }.merge(parse_query(query))
72
- hsh[:password] = password if password
73
- hsh[:timeout] = hsh[:timeout].to_i if hsh.key?(:timeout)
74
- hsh
75
- end
76
-
77
- def serverid
78
- format('%s://%s:%s/%s', scheme, host, port, db)
79
- end
23
+ include PerfectStrangers
80
24
 
81
25
  private
82
26
 
83
- # Based on: https://github.com/chneukirchen/rack/blob/master/lib/rack/utils.rb
84
- # which was originally based on Mongrel
85
- def parse_query(query, delim = nil)
86
- delim ||= "&;"
87
- params = {}
88
- (query || "").split(/[#{delim}] */n).each do |p|
89
- k, v = p.split("=", 2).map { |str| str } # NOTE: uri_unescape
90
- k = k.to_sym
91
- if (cur = params[k])
92
- if cur.instance_of?(Array)
93
- params[k] << v
94
- else
95
- params[k] = [cur, v]
96
- end
97
- else
98
- params[k] = v
99
- end
100
- end
101
- params
27
+ def ssl_schemes
28
+ %w[rediss valkeys]
102
29
  end
103
30
  end
104
31
 
105
32
  if URI.respond_to?(:register_scheme)
106
- URI.register_scheme "REDIS", Redis
107
- URI.register_scheme "REDISS", Redis
33
+ URI.register_scheme 'REDIS', Redis unless URI.scheme_list.key?('REDIS')
34
+ URI.register_scheme 'REDISS', Redis unless URI.scheme_list.key?('REDISS')
35
+ # Cross-scheme support for Valkey URLs
36
+ URI.register_scheme 'VALKEY', Redis unless URI.scheme_list.key?('VALKEY')
37
+ URI.register_scheme 'VALKEYS', Redis unless URI.scheme_list.key?('VALKEYS')
108
38
  else
109
- @@schemes['REDIS'] = Redis
110
- @@schemes['REDISS'] = Redis
39
+ @@schemes['REDIS'] = Redis unless @@schemes.key?('REDIS')
40
+ @@schemes['REDISS'] = Redis unless @@schemes.key?('REDISS')
41
+ # Cross-scheme support for Valkey URLs
42
+ @@schemes['VALKEY'] = Redis unless @@schemes.key?('VALKEY')
43
+ @@schemes['VALKEYS'] = Redis unless @@schemes.key?('VALKEYS')
111
44
  end
112
45
  end
113
46
 
114
- # Adds a URI method to Redis
115
- class Redis
116
- def self.uri(conf = {})
117
- URI.parse format("%s://%s:%s/%s", conf[:ssl] ? 'rediss' : 'redis', conf[:host], conf[:port], conf[:db])
118
- end
47
+ if defined?(Redis)
48
+ # Usage:
49
+ # using RedisURIRefinement
50
+ # redis = Redis.new
51
+ # redis.uri
52
+ module RedisURIRefinement
53
+ refine Redis do
54
+ def uri
55
+ URI.parse @client.id
56
+ end
119
57
 
120
- def uri
121
- URI.parse @client.id
58
+ def self.uri(conf = {})
59
+ URI.parse format('%s://%s:%s/%s', conf[:ssl] ? 'rediss' : 'redis', conf[:host], conf[:port], conf[:db])
60
+ end
61
+ end
122
62
  end
123
63
  end
data/lib/uri-redis.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Compatibility shim for uri-redis.rb
4
+ # This file maintains backward compatibility for code that requires 'uri-redis'
5
+ require_relative 'uri/redis'
data/lib/uri_redis.rb ADDED
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Compatibility shim for uri_redis.rb
4
+ # This file maintains backward compatibility for code that requires 'uri_redis'
5
+ require_relative 'uri/redis'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uri-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - delano
8
- autorequire:
9
- bindir: exe
8
+ bindir: bin
10
9
  cert_chain: []
11
- date: 2024-06-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: 'URI-Redis: support for parsing Redis URIs like redis://host:port/dbindex/key'
14
13
  email:
@@ -17,18 +16,14 @@ executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
20
- - ".pre-commit-config.yaml"
21
- - ".rubocop.yml"
22
19
  - CHANGES.txt
23
- - Gemfile
24
- - Gemfile.lock
25
20
  - LICENSE.txt
26
21
  - README.md
27
- - Rakefile
22
+ - lib/uri-redis.rb
23
+ - lib/uri/perfect_strangers.rb
28
24
  - lib/uri/redis.rb
29
25
  - lib/uri/redis/version.rb
30
- - sig/uri/redis.rbs
31
- - try/10_uri_redis_try.rb
26
+ - lib/uri_redis.rb
32
27
  homepage: https://github.com/delano/uri-redis
33
28
  licenses:
34
29
  - MIT
@@ -36,9 +31,8 @@ metadata:
36
31
  allowed_push_host: https://rubygems.org
37
32
  homepage_uri: https://github.com/delano/uri-redis
38
33
  source_code_uri: https://github.com/delano/uri-redis/
39
- changelog_uri: https://github.com/delano/uri-redis/blob/feature/001-modernize/CHANGES.txt#L1
34
+ changelog_uri: https://github.com/delano/uri-redis/blob/main/CHANGES.txt
40
35
  rubygems_mfa_required: 'true'
41
- post_install_message:
42
36
  rdoc_options: []
43
37
  require_paths:
44
38
  - lib
@@ -53,8 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
53
47
  - !ruby/object:Gem::Version
54
48
  version: '0'
55
49
  requirements: []
56
- rubygems_version: 3.5.9
57
- signing_key:
50
+ rubygems_version: 3.6.9
58
51
  specification_version: 4
59
52
  summary: 'URI-Redis: support for parsing Redis URIs'
60
53
  test_files: []
@@ -1,69 +0,0 @@
1
- ##
2
- # Pre-Commit Configuration
3
- #
4
- # Initial setup:
5
- #
6
- # 0. Install the pre-commit framework (if it isn't already on your system):
7
-
8
- # $ pip install pre-commit
9
- #
10
- # 1. Install the git hook:
11
- #
12
- # $ pre-commit install
13
- #
14
- #
15
- # Other commands:
16
- #
17
- # Run it on all the files in this repo:
18
- # $ pre-commit run --all-files
19
- #
20
- # Updating plugin repositories:
21
- # $ pre-commit autoupdate
22
- #
23
- # Automatically enable pre-commit on repositories
24
- # $ git config --global init.templateDir ~/.git-template
25
- # $ pre-commit init-templatedir ~/.git-template
26
- #
27
- # See also:
28
- # - https://pre-commit.com for more information
29
- # - https://pre-commit.com/hooks.html for more hooks
30
- #
31
-
32
- default_install_hook_types:
33
- - pre-commit
34
- - prepare-commit-msg
35
-
36
- fail_fast: true
37
-
38
- repos:
39
- - repo: meta
40
- hooks:
41
- - id: check-hooks-apply
42
- - id: check-useless-excludes
43
- - id: identity
44
-
45
- - repo: https://github.com/pre-commit/pre-commit-hooks
46
- rev: v4.6.0
47
- hooks:
48
- - id: trailing-whitespace
49
- - id: end-of-file-fixer
50
- - id: check-yaml
51
- - id: detect-private-key
52
- - id: mixed-line-ending
53
- - id: check-added-large-files
54
- args: ["--maxkb=1000"]
55
- - id: no-commit-to-branch
56
- args: ["--branch", "develop", "--branch", "rel/.*"]
57
- - id: check-merge-conflict
58
- - id: forbid-submodules
59
-
60
- - repo: https://github.com/avilaton/add-msg-issue-prefix-hook
61
- rev: v0.0.11
62
- hooks:
63
- - id: add-msg-issue-prefix
64
- stages: [prepare-commit-msg]
65
- name: Link commit to Github issue
66
- args:
67
- - "--default=[NOJIRA]"
68
- - "--pattern=[a-zA-Z0-9]{0,10}-?[0-9]{1,5}"
69
- - "--template=[#{}]"
data/.rubocop.yml DELETED
@@ -1,178 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 2.7
3
-
4
- Gemspec/DeprecatedAttributeAssignment: # new in 1.30
5
- Enabled: true
6
- Gemspec/RequireMFA: # new in 1.23
7
- Enabled: true
8
- Layout/LineContinuationLeadingSpace: # new in 1.31
9
- Enabled: true
10
- Layout/LineContinuationSpacing: # new in 1.31
11
- Enabled: true
12
- Layout/LineEndStringConcatenationIndentation: # new in 1.18
13
- Enabled: true
14
- Layout/SpaceBeforeBrackets: # new in 1.7
15
- Enabled: true
16
- Lint/AmbiguousAssignment: # new in 1.7
17
- Enabled: true
18
- Lint/AmbiguousOperatorPrecedence: # new in 1.21
19
- Enabled: true
20
- Lint/AmbiguousRange: # new in 1.19
21
- Enabled: true
22
- Lint/ConstantOverwrittenInRescue: # new in 1.31
23
- Enabled: true
24
- Lint/DeprecatedConstants: # new in 1.8
25
- Enabled: true
26
- Lint/DuplicateBranch: # new in 1.3
27
- Enabled: true
28
- Lint/DuplicateMagicComment: # new in 1.37
29
- Enabled: true
30
- Lint/DuplicateRegexpCharacterClassElement: # new in 1.1
31
- Enabled: true
32
- Lint/EmptyBlock: # new in 1.1
33
- Enabled: true
34
- Lint/EmptyClass: # new in 1.3
35
- Enabled: true
36
- Lint/EmptyInPattern: # new in 1.16
37
- Enabled: true
38
- Lint/IncompatibleIoSelectWithFiberScheduler: # new in 1.21
39
- Enabled: true
40
- Lint/LambdaWithoutLiteralBlock: # new in 1.8
41
- Enabled: true
42
- Lint/NoReturnInBeginEndBlocks: # new in 1.2
43
- Enabled: true
44
- Lint/NonAtomicFileOperation: # new in 1.31
45
- Enabled: true
46
- Lint/NumberedParameterAssignment: # new in 1.9
47
- Enabled: true
48
- Lint/OrAssignmentToConstant: # new in 1.9
49
- Enabled: true
50
- Lint/RedundantDirGlobSort: # new in 1.8
51
- Enabled: true
52
- Lint/RefinementImportMethods: # new in 1.27
53
- Enabled: true
54
- Lint/RequireRangeParentheses: # new in 1.32
55
- Enabled: true
56
- Lint/RequireRelativeSelfPath: # new in 1.22
57
- Enabled: true
58
- Lint/SymbolConversion: # new in 1.9
59
- Enabled: true
60
- Lint/ToEnumArguments: # new in 1.1
61
- Enabled: true
62
- Lint/TripleQuotes: # new in 1.9
63
- Enabled: true
64
- Lint/Void: # new in 1.1
65
- Enabled: false
66
- Lint/UnexpectedBlockArity: # new in 1.5
67
- Enabled: true
68
- Lint/UnmodifiedReduceAccumulator: # new in 1.1
69
- Enabled: true
70
- Lint/UselessRescue: # new in 1.43
71
- Enabled: true
72
- Lint/UselessRuby2Keywords: # new in 1.23
73
- Enabled: true
74
- Metrics/AbcSize: # new in 1.0
75
- Enabled: false
76
- Metrics/MethodLength: # new in 1.0
77
- Enabled: false
78
- Metrics/PerceivedComplexity: # new in 1.0
79
- Enabled: false
80
- Naming/BlockForwarding: # new in 1.24
81
- Enabled: true
82
- Security/CompoundHash: # new in 1.28
83
- Enabled: true
84
- Security/IoMethods: # new in 1.22
85
- Enabled: true
86
- Style/ArgumentsForwarding: # new in 1.1
87
- Enabled: true
88
- Style/ArrayIntersect: # new in 1.40
89
- Enabled: true
90
- Style/CollectionCompact: # new in 1.2
91
- Enabled: true
92
- Style/ConcatArrayLiterals: # new in 1.41
93
- Enabled: true
94
- Style/DocumentDynamicEvalDefinition: # new in 1.1
95
- Enabled: true
96
- Style/EmptyHeredoc: # new in 1.32
97
- Enabled: true
98
- Style/EndlessMethod: # new in 1.8
99
- Enabled: true
100
- Style/EnvHome: # new in 1.29
101
- Enabled: true
102
- Style/FetchEnvVar: # new in 1.28
103
- Enabled: true
104
- Style/FileRead: # new in 1.24
105
- Enabled: true
106
- Style/FileWrite: # new in 1.24
107
- Enabled: true
108
- Style/FormatStringToken: # new in 1.1
109
- Enabled: false
110
- Style/HashConversion: # new in 1.10
111
- Enabled: true
112
- Style/HashExcept: # new in 1.7
113
- Enabled: true
114
- Style/IfWithBooleanLiteralBranches: # new in 1.9
115
- Enabled: true
116
- Style/InPatternThen: # new in 1.16
117
- Enabled: true
118
- Style/MagicCommentFormat: # new in 1.35
119
- Enabled: true
120
- Style/MapCompactWithConditionalBlock: # new in 1.30
121
- Enabled: true
122
- Style/MapToHash: # new in 1.24
123
- Enabled: true
124
- Style/MapToSet: # new in 1.42
125
- Enabled: true
126
- Style/MinMaxComparison: # new in 1.42
127
- Enabled: true
128
- Style/MultilineInPatternThen: # new in 1.16
129
- Enabled: true
130
- Style/NegatedIfElseCondition: # new in 1.2
131
- Enabled: true
132
- Style/NestedFileDirname: # new in 1.26
133
- Enabled: true
134
- Style/NilLambda: # new in 1.3
135
- Enabled: true
136
- Style/NumberedParameters: # new in 1.22
137
- Enabled: true
138
- Style/NumberedParametersLimit: # new in 1.22
139
- Enabled: true
140
- Style/ObjectThen: # new in 1.28
141
- Enabled: true
142
- Style/OpenStructUse: # new in 1.23
143
- Enabled: true
144
- Style/OperatorMethodCall: # new in 1.37
145
- Enabled: true
146
- Style/QuotedSymbols: # new in 1.16
147
- Enabled: true
148
- Style/RedundantArgument: # new in 1.4
149
- Enabled: true
150
- Style/RedundantConstantBase: # new in 1.40
151
- Enabled: true
152
- Style/RedundantDoubleSplatHashBraces: # new in 1.41
153
- Enabled: true
154
- Style/RedundantEach: # new in 1.38
155
- Enabled: true
156
- Style/RedundantInitialize: # new in 1.27
157
- Enabled: true
158
- Style/RedundantSelfAssignmentBranch: # new in 1.19
159
- Enabled: true
160
- Style/RedundantStringEscape: # new in 1.37
161
- Enabled: true
162
- Style/SelectByRegexp: # new in 1.22
163
- Enabled: true
164
- Style/StringChars: # new in 1.12
165
- Enabled: true
166
- Style/SwapValues: # new in 1.1
167
- Enabled: true
168
- Style/StringLiterals:
169
- Enabled: false
170
- EnforcedStyle: double_quotes
171
- Style/StringLiteralsInInterpolation:
172
- Enabled: false
173
- EnforcedStyle: double_quotes
174
- Style/FrozenStringLiteralComment:
175
- Enabled: false
176
-
177
- Layout/LineLength:
178
- Max: 120
data/Gemfile DELETED
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source "https://rubygems.org"
4
-
5
- gem "redis", ">= 4.8", "< 7"
6
-
7
- group :development do
8
- gem "rake", "~> 13.0"
9
- gem "rubocop", "~> 1.21"
10
- gem "tryouts", "~>2.2.0"
11
- end
data/Gemfile.lock DELETED
@@ -1,55 +0,0 @@
1
- GEM
2
- remote: https://rubygems.org/
3
- specs:
4
- ast (2.4.2)
5
- connection_pool (2.4.1)
6
- drydock (0.6.9)
7
- json (2.7.2)
8
- language_server-protocol (3.17.0.3)
9
- parallel (1.24.0)
10
- parser (3.3.1.0)
11
- ast (~> 2.4.1)
12
- racc
13
- racc (1.7.3)
14
- rainbow (3.1.1)
15
- rake (13.2.1)
16
- redis (5.2.0)
17
- redis-client (>= 0.22.0)
18
- redis-client (0.22.1)
19
- connection_pool
20
- regexp_parser (2.9.0)
21
- rexml (3.2.6)
22
- rubocop (1.63.4)
23
- json (~> 2.3)
24
- language_server-protocol (>= 3.17.0)
25
- parallel (~> 1.10)
26
- parser (>= 3.3.0.2)
27
- rainbow (>= 2.2.2, < 4.0)
28
- regexp_parser (>= 1.8, < 3.0)
29
- rexml (>= 3.2.5, < 4.0)
30
- rubocop-ast (>= 1.31.1, < 2.0)
31
- ruby-progressbar (~> 1.7)
32
- unicode-display_width (>= 2.4.0, < 3.0)
33
- rubocop-ast (1.31.3)
34
- parser (>= 3.3.1.0)
35
- ruby-progressbar (1.13.0)
36
- storable (0.10.0)
37
- sysinfo (0.10.0)
38
- drydock (< 1.0)
39
- storable (~> 0.10)
40
- tryouts (2.2.0)
41
- sysinfo (~> 0.10)
42
- unicode-display_width (2.5.0)
43
-
44
- PLATFORMS
45
- arm64-darwin-22
46
- ruby
47
-
48
- DEPENDENCIES
49
- rake (~> 13.0)
50
- redis (>= 4.8, < 7)
51
- rubocop (~> 1.21)
52
- tryouts (~> 2.2.0)
53
-
54
- BUNDLED WITH
55
- 2.5.9
data/Rakefile DELETED
@@ -1,8 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "bundler/gem_tasks"
4
- require "rubocop/rake_task"
5
-
6
- RuboCop::RakeTask.new
7
-
8
- task default: :rubocop
data/sig/uri/redis.rbs DELETED
@@ -1,6 +0,0 @@
1
- module Uri
2
- module Redis
3
- VERSION: String
4
- # See the writing guide of rbs: https://github.com/ruby/rbs#guides
5
- end
6
- end
@@ -1,38 +0,0 @@
1
- require "uri/redis"
2
-
3
- ## Default database is 0
4
- uri = URI.parse "redis://localhost"
5
- [uri.db, uri.host, uri.port]
6
- #=> [0, 'localhost', 6379]
7
-
8
- ## Can parse a redis URI with a database
9
- uri = URI.parse "redis://localhost/2"
10
- [uri.db, uri.host, uri.port]
11
- #=> [2, 'localhost', 6379]
12
-
13
- ## Parsed URI can be accessed via conf hash
14
- uri = URI.parse "redis://localhost:16739/2"
15
- [uri.scheme, uri.conf]
16
- #=> ['redis', {:host=>"localhost", :port=>16739, :db=>2, :ssl=>false}]
17
-
18
- ## Can parse a key name
19
- uri = URI.parse "redis://localhost/2/v1:arbitrary:key"
20
- [uri.key, uri.db, uri.host, uri.port]
21
- #=> ['v1:arbitrary:key', 2, 'localhost', 6379]
22
-
23
- ## Can set db
24
- uri = URI.parse "redis://localhost/2/v1:arbitrary:key"
25
- uri.db = 6
26
- uri.to_s
27
- #=> 'redis://localhost/6/v1:arbitrary:key'
28
-
29
- ## Can set key
30
- uri = URI.parse "redis://localhost/2/v1:arbitrary:key"
31
- uri.key = "v2:arbitrary:key"
32
- uri.to_s
33
- #=> 'redis://localhost/2/v2:arbitrary:key'
34
-
35
- ## Support rediss
36
- uri = URI.parse "rediss://localhost"
37
- [uri.scheme, uri.conf]
38
- #=> ["rediss", {:host=>"localhost", :port=>6379, :db=>0, :ssl=>true}]