uri-redis 0.4.1 → 1.0.0.pre.RC1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rubocop.yml +13 -0
- data/CHANGES.txt +15 -0
- data/Gemfile +10 -0
- data/LICENSE.txt +4 -2
- data/README.md +40 -0
- data/Rakefile +5 -59
- data/lib/uri/redis/version.rb +7 -0
- data/lib/uri/redis.rb +49 -17
- data/sig/uri/redis.rbs +6 -0
- metadata +83 -60
- data/README.rdoc +0 -35
- data/VERSION.yml +0 -5
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: ecbcabe135eef8efd0f07943fc756463833a54df37554bd2ba831042ca1a8601
|
4
|
+
data.tar.gz: f57ae01ba87e295a237b887f1a83338e32cc757a26844a6f44da575294d0990a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a1469dfbbfe14bb7d44e3206282363193ffd562c3c521105c4f941a863a9e036ebac5996fab45f581bfc5e6b94074123405abcf5ebd982d152dcb80409077d20
|
7
|
+
data.tar.gz: 1b1aff8dccc907f77d5dbb32c32cfe2cc35966e9e979ee0a914fe8da4f234fc5d834e28a5a83ab45cb41767cc52a7a6a686cab4b787515423b287bd82b177956
|
data/.rubocop.yml
ADDED
data/CHANGES.txt
CHANGED
@@ -1,5 +1,20 @@
|
|
1
1
|
URI-Redis, CHANGES
|
2
2
|
|
3
|
+
|
4
|
+
#### 1.0.0-RC1 (2023-01-16) ###########################
|
5
|
+
|
6
|
+
* CHANGE: Moderized gem
|
7
|
+
* ADDED: Only redis-4.1.0+ supported
|
8
|
+
* FIXED: Support URI v0.11
|
9
|
+
* See: https://github.com/delano/redis-dump/issues/33
|
10
|
+
|
11
|
+
|
12
|
+
#### 0.4.2 (2010-12-23) ###############################
|
13
|
+
|
14
|
+
# CHANGE: URI#conf enforces symbols as keys
|
15
|
+
* ADDED: URI#conf parses query string
|
16
|
+
|
17
|
+
|
3
18
|
#### 0.4.1 (2010-11-16) ###############################
|
4
19
|
|
5
20
|
* FIXED: Nil error in URI::Redis#key
|
data/Gemfile
ADDED
data/LICENSE.txt
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2023 delano
|
2
4
|
|
3
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -16,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
18
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
19
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
20
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
-
THE SOFTWARE.
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# URI-Redis v1.0-RC1
|
2
|
+
|
3
|
+
Creates a URI object for Redis URLs.
|
4
|
+
|
5
|
+
e.g.
|
6
|
+
|
7
|
+
redis://host:port/dbindex
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
**
|
11
|
+
require 'uri/redis'
|
12
|
+
|
13
|
+
conf = URI.parse 'redis://localhost:4380/2'
|
14
|
+
conf.host # => localhost
|
15
|
+
conf.port # => 4380
|
16
|
+
conf.db # => 2
|
17
|
+
conf.to_s # => redis://localhost:4380/2
|
18
|
+
conf
|
19
|
+
**
|
20
|
+
## Installation
|
21
|
+
|
22
|
+
Get it in one of the following ways:
|
23
|
+
|
24
|
+
* `gem install uri-redis`
|
25
|
+
* `git clone git+ssh://github.com/delano/uri-redis.git`
|
26
|
+
|
27
|
+
|
28
|
+
## About
|
29
|
+
|
30
|
+
* [Github](https://github.com/delano/uri-redis)
|
31
|
+
|
32
|
+
|
33
|
+
## Credits
|
34
|
+
|
35
|
+
* delano (https://delanotes.com/)
|
36
|
+
|
37
|
+
|
38
|
+
## License
|
39
|
+
|
40
|
+
See LICENSE.txt
|
data/Rakefile
CHANGED
@@ -1,62 +1,8 @@
|
|
1
|
-
|
2
|
-
require "rake"
|
3
|
-
require "rake/clean"
|
4
|
-
require 'yaml'
|
5
|
-
|
6
|
-
begin
|
7
|
-
require 'hanna/rdoctask'
|
8
|
-
rescue LoadError
|
9
|
-
require 'rake/rdoctask'
|
10
|
-
end
|
11
|
-
|
12
|
-
config = YAML.load_file("VERSION.yml")
|
13
|
-
task :default => ["build"]
|
14
|
-
CLEAN.include [ 'pkg', 'doc' ]
|
15
|
-
name = "uri-redis"
|
16
|
-
|
17
|
-
begin
|
18
|
-
require "jeweler"
|
19
|
-
Jeweler::Tasks.new do |gem|
|
20
|
-
gem.version = "#{config[:MAJOR]}.#{config[:MINOR]}.#{config[:PATCH]}"
|
21
|
-
gem.name = "uri-redis"
|
22
|
-
gem.rubyforge_project = gem.name
|
23
|
-
gem.summary = "URI-Redis: support for parsing redis://host:port/dbindex/keyname"
|
24
|
-
gem.description = gem.summary
|
25
|
-
gem.email = "delano@solutious.com"
|
26
|
-
gem.homepage = "http://github.com/delano/uri-redis"
|
27
|
-
gem.authors = ["Delano Mandelbaum"]
|
28
|
-
end
|
29
|
-
Jeweler::GemcutterTasks.new
|
30
|
-
rescue LoadError
|
31
|
-
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
Rake::RDocTask.new do |rdoc|
|
36
|
-
version = "#{config[:MAJOR]}.#{config[:MINOR]}.#{config[:PATCH]}"
|
37
|
-
rdoc.rdoc_dir = "doc"
|
38
|
-
rdoc.title = "redis-dump #{version}"
|
39
|
-
rdoc.rdoc_files.include("README*")
|
40
|
-
rdoc.rdoc_files.include("LICENSE.txt")
|
41
|
-
#rdoc.rdoc_files.include("bin/*.rb")
|
42
|
-
rdoc.rdoc_files.include("lib/**/*.rb")
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
# Rubyforge Release / Publish Tasks ==================================
|
47
|
-
|
48
|
-
#about 'Publish website to rubyforge'
|
49
|
-
task 'publish:rdoc' => 'doc/index.html' do
|
50
|
-
sh "scp -rp doc/* rubyforge.org:/var/www/gforge-projects/#{name}/"
|
51
|
-
end
|
52
|
-
|
53
|
-
#about 'Public release to rubyforge'
|
54
|
-
task 'publish:gem' => [:package] do |t|
|
55
|
-
sh <<-end
|
56
|
-
rubyforge add_release -o Any -a CHANGES.txt -f -n README.md #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.gem &&
|
57
|
-
rubyforge add_file -o Any -a CHANGES.txt -f -n README.md #{name} #{name} #{@spec.version} pkg/#{name}-#{@spec.version}.tgz
|
58
|
-
end
|
59
|
-
end
|
1
|
+
# frozen_string_literal: true
|
60
2
|
|
3
|
+
require "bundler/gem_tasks"
|
4
|
+
require "rubocop/rake_task"
|
61
5
|
|
6
|
+
RuboCop::RakeTask.new
|
62
7
|
|
8
|
+
task default: :rubocop
|
data/lib/uri/redis.rb
CHANGED
@@ -6,59 +6,91 @@ module URI
|
|
6
6
|
VERSION = '0.4' unless defined?(URI::Redis::VERSION)
|
7
7
|
DEFAULT_PORT = 6379
|
8
8
|
DEFAULT_DB = 0
|
9
|
-
|
9
|
+
|
10
10
|
def self.build(args)
|
11
11
|
tmp = Util::make_components_hash(self, args)
|
12
12
|
return super(tmp)
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
def initialize(*arg)
|
16
16
|
super(*arg)
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def request_uri
|
20
20
|
r = path_query
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def key
|
24
24
|
return if self.path.nil?
|
25
25
|
self.path ||= "/#{DEFAULT_DB}"
|
26
26
|
(self.path.split('/')[2..-1] || []).join('/')
|
27
27
|
end
|
28
|
-
|
28
|
+
|
29
29
|
def key=(val)
|
30
30
|
self.path = '/' << [db, val].join('/')
|
31
31
|
end
|
32
|
-
|
32
|
+
|
33
33
|
def db
|
34
34
|
self.path ||= "/#{DEFAULT_DB}"
|
35
35
|
(self.path.split('/')[1] || DEFAULT_DB).to_i
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
def db=(val)
|
39
39
|
current_key = key
|
40
40
|
self.path = "/#{val}"
|
41
41
|
self.path << "/#{current_key}"
|
42
42
|
self.path
|
43
43
|
end
|
44
|
-
|
44
|
+
|
45
|
+
# Returns a hash suitable for sending to Redis.new.
|
46
|
+
# The hash is generated from the host, port, db and
|
47
|
+
# password from the URI as well as any query vars.
|
48
|
+
#
|
49
|
+
# e.g.
|
50
|
+
#
|
51
|
+
# uri = URI.parse "redis://127.0.0.1/6/?timeout=5"
|
52
|
+
# uri.conf
|
53
|
+
# # => {:db=>6, :timeout=>"5", :host=>"127.0.0.1", :port=>6379}
|
54
|
+
#
|
45
55
|
def conf
|
46
|
-
|
56
|
+
hsh = {
|
47
57
|
:host => host,
|
48
58
|
:port => port,
|
49
59
|
:db => db
|
50
|
-
}
|
51
|
-
|
52
|
-
|
60
|
+
}.merge parse_query(query)
|
61
|
+
hsh[:password] = password if password
|
62
|
+
hsh
|
53
63
|
end
|
54
|
-
|
64
|
+
|
55
65
|
def serverid
|
56
66
|
'redis://%s:%s/%s' % [host, port, db]
|
57
67
|
end
|
58
|
-
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Based on / stolen from: https://github.com/chneukirchen/rack/blob/master/lib/rack/utils.rb
|
72
|
+
# which was based on / stolen from Mongrel
|
73
|
+
def parse_query(qs, d = '&;')
|
74
|
+
params = {}
|
75
|
+
(qs || '').split(/[#{d}] */n).each do |p|
|
76
|
+
k, v = p.split('=', 2).map { |str| str } # NOTE: uri_unescape
|
77
|
+
k = k.to_sym
|
78
|
+
if cur = params[k]
|
79
|
+
if cur.class == Array
|
80
|
+
params[k] << v
|
81
|
+
else
|
82
|
+
params[k] = [cur, v]
|
83
|
+
end
|
84
|
+
else
|
85
|
+
params[k] = v
|
86
|
+
end
|
87
|
+
end
|
88
|
+
params
|
89
|
+
end
|
90
|
+
|
59
91
|
end
|
60
|
-
|
61
|
-
|
92
|
+
|
93
|
+
register_scheme 'REDIS', Redis
|
62
94
|
end
|
63
95
|
|
64
96
|
|
@@ -77,4 +109,4 @@ class Redis
|
|
77
109
|
end
|
78
110
|
end
|
79
111
|
end
|
80
|
-
end
|
112
|
+
end
|
data/sig/uri/redis.rbs
ADDED
metadata
CHANGED
@@ -1,74 +1,97 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-redis
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease: false
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 4
|
9
|
-
- 1
|
10
|
-
version: 0.4.1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0.pre.RC1
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
14
|
-
autorequire:
|
15
|
-
bindir:
|
6
|
+
authors:
|
7
|
+
- delano
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
11
|
+
date: 2023-01-17 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redis
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '4.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 4.1.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '4.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 4.1.0
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: tryouts
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '2.1'
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 2.1.1
|
43
|
+
type: :development
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '2.1'
|
50
|
+
- - ">="
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 2.1.1
|
53
|
+
description: 'URI-Redis: support for parsing Redis URIs like redis://host:port/dbindex'
|
54
|
+
email:
|
55
|
+
- delano@solutious.com
|
24
56
|
executables: []
|
25
|
-
|
26
57
|
extensions: []
|
27
|
-
|
28
|
-
|
29
|
-
-
|
30
|
-
- README.rdoc
|
31
|
-
files:
|
58
|
+
extra_rdoc_files: []
|
59
|
+
files:
|
60
|
+
- ".rubocop.yml"
|
32
61
|
- CHANGES.txt
|
62
|
+
- Gemfile
|
33
63
|
- LICENSE.txt
|
34
|
-
- README.
|
64
|
+
- README.md
|
35
65
|
- Rakefile
|
36
|
-
- VERSION.yml
|
37
66
|
- lib/uri/redis.rb
|
67
|
+
- lib/uri/redis/version.rb
|
68
|
+
- sig/uri/redis.rbs
|
38
69
|
- try/10_uri_redis_try.rb
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
70
|
+
homepage: https://github.com/delano/uri-redis
|
71
|
+
licenses:
|
72
|
+
- MIT
|
73
|
+
metadata:
|
74
|
+
allowed_push_host: https://rubygems.org
|
75
|
+
homepage_uri: https://github.com/delano/uri-redis
|
76
|
+
source_code_uri: https://github.com/delano/uri-redis/
|
77
|
+
changelog_uri: https://github.com/delano/uri-redis/blob/feature/001-modernize/CHANGES.txt#L1
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
47
81
|
- lib
|
48
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
-
|
50
|
-
requirements:
|
51
|
-
- - ">="
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
hash: 3
|
54
|
-
segments:
|
55
|
-
- 0
|
56
|
-
version: "0"
|
57
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
-
none: false
|
59
|
-
requirements:
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
60
84
|
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.6.0
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">"
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 1.3.1
|
66
92
|
requirements: []
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
specification_version: 3
|
72
|
-
summary: "URI-Redis: support for parsing redis://host:port/dbindex/keyname"
|
93
|
+
rubygems_version: 3.3.7
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: 'URI-Redis: support for parsing Redis URIs'
|
73
97
|
test_files: []
|
74
|
-
|
data/README.rdoc
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
= URI-Redis v0.2
|
2
|
-
|
3
|
-
redis://host:port/dbindex
|
4
|
-
|
5
|
-
== Usage
|
6
|
-
|
7
|
-
require 'uri/redis'
|
8
|
-
|
9
|
-
conf = URI.parse 'redis://localhost:8999/2'
|
10
|
-
conf.host # => localhost
|
11
|
-
conf.port # => 8999
|
12
|
-
conf.db # => 2
|
13
|
-
|
14
|
-
|
15
|
-
== Installation
|
16
|
-
|
17
|
-
Get it in one of the following ways:
|
18
|
-
|
19
|
-
* <tt>gem install uri-redis</tt>
|
20
|
-
* <tt>git clone git://github.com/delano/uri-redis.git</tt>
|
21
|
-
|
22
|
-
|
23
|
-
== More Information
|
24
|
-
|
25
|
-
* Codes[http://github.com/delano/uri-redis]
|
26
|
-
* RDocs[http://delano.github.com/uri-redis]
|
27
|
-
|
28
|
-
|
29
|
-
== Credits
|
30
|
-
|
31
|
-
* Delano Mandelbaum (http://solutious.com)
|
32
|
-
|
33
|
-
== License
|
34
|
-
|
35
|
-
See LICENSE.txt
|