uri-redis 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +6 -0
- data/Rakefile +33 -45
- data/VERSION.yml +5 -0
- data/lib/uri/redis.rb +16 -2
- data/try/10_uri_redis_try.rb +31 -0
- metadata +23 -16
- data/tryouts/essential_tryouts.rb +0 -11
- data/uri-redis.gemspec +0 -29
data/CHANGES.txt
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
URI-Redis, CHANGES
|
2
2
|
|
3
|
+
#### 0.4.0 (2010-11-15) ###############################
|
4
|
+
|
5
|
+
* ADDED: Support for keys in the path
|
6
|
+
* CHANGE: Updated tryouts to 2.0
|
7
|
+
|
8
|
+
|
3
9
|
#### 0.3.0 (2010-06-03) ###############################
|
4
10
|
|
5
11
|
* CHANGE: Redis::Client.uri is now Redis.uri
|
data/Rakefile
CHANGED
@@ -1,41 +1,45 @@
|
|
1
|
-
require
|
2
|
-
require
|
3
|
-
require
|
4
|
-
|
1
|
+
require "rubygems"
|
2
|
+
require "rake"
|
3
|
+
require "rake/clean"
|
4
|
+
require 'yaml'
|
5
5
|
|
6
6
|
begin
|
7
7
|
require 'hanna/rdoctask'
|
8
8
|
rescue LoadError
|
9
9
|
require 'rake/rdoctask'
|
10
10
|
end
|
11
|
-
|
12
|
-
|
13
|
-
task :default =>
|
14
|
-
|
15
|
-
|
16
|
-
# PACKAGE =============================================================
|
17
|
-
|
11
|
+
|
12
|
+
config = YAML.load_file("VERSION.yml")
|
13
|
+
task :default => ["build"]
|
14
|
+
CLEAN.include [ 'pkg', 'doc' ]
|
18
15
|
name = "uri-redis"
|
19
|
-
load "#{name}.gemspec"
|
20
|
-
|
21
|
-
version = @spec.version
|
22
|
-
|
23
|
-
Rake::GemPackageTask.new(@spec) do |p|
|
24
|
-
p.need_tar = true if RUBY_PLATFORM !~ /mswin/
|
25
|
-
end
|
26
16
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
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"
|
31
32
|
end
|
32
33
|
|
33
|
-
task :install => [ :rdoc, :package ] do
|
34
|
-
sh %{sudo gem install pkg/#{name}-#{version}.gem}
|
35
|
-
end
|
36
34
|
|
37
|
-
|
38
|
-
|
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")
|
39
43
|
end
|
40
44
|
|
41
45
|
|
@@ -49,26 +53,10 @@ end
|
|
49
53
|
#about 'Public release to rubyforge'
|
50
54
|
task 'publish:gem' => [:package] do |t|
|
51
55
|
sh <<-end
|
52
|
-
rubyforge add_release -o Any -a CHANGES.txt -f -n README.
|
53
|
-
rubyforge add_file -o Any -a CHANGES.txt -f -n README.
|
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
|
54
58
|
end
|
55
59
|
end
|
56
60
|
|
57
61
|
|
58
|
-
Rake::RDocTask.new do |t|
|
59
|
-
t.rdoc_dir = 'doc'
|
60
|
-
t.title = @spec.summary
|
61
|
-
t.options << '--line-numbers' << '-A cattr_accessor=object'
|
62
|
-
t.options << '--charset' << 'utf-8'
|
63
|
-
t.rdoc_files.include('LICENSE.txt')
|
64
|
-
t.rdoc_files.include('README.rdoc')
|
65
|
-
t.rdoc_files.include('CHANGES.txt')
|
66
|
-
#t.rdoc_files.include('Rudyfile') # why is the formatting f'd?
|
67
|
-
t.rdoc_files.include('bin/*')
|
68
|
-
t.rdoc_files.include('lib/**/*.rb')
|
69
|
-
end
|
70
|
-
|
71
|
-
CLEAN.include [ 'pkg', '*.gem', '.config', 'doc', 'coverage*' ]
|
72
|
-
|
73
|
-
|
74
62
|
|
data/VERSION.yml
ADDED
data/lib/uri/redis.rb
CHANGED
@@ -3,6 +3,7 @@ require 'redis'
|
|
3
3
|
|
4
4
|
module URI
|
5
5
|
class Redis < URI::Generic
|
6
|
+
VERSION = '0.4' unless defined?(URI::Redis::VERSION)
|
6
7
|
DEFAULT_PORT = 6379
|
7
8
|
DEFAULT_DB = 0
|
8
9
|
|
@@ -19,13 +20,26 @@ module URI
|
|
19
20
|
r = path_query
|
20
21
|
end
|
21
22
|
|
23
|
+
def key
|
24
|
+
return if self.path.nil?
|
25
|
+
self.path ||= "/#{DEFAULT_DB}"
|
26
|
+
self.path.split('/')[2..-1].join('/')
|
27
|
+
end
|
28
|
+
|
29
|
+
def key=(val)
|
30
|
+
self.path = '/' << [db, val].join('/')
|
31
|
+
end
|
32
|
+
|
22
33
|
def db
|
23
|
-
|
24
|
-
|
34
|
+
self.path ||= "/#{DEFAULT_DB}"
|
35
|
+
(self.path.split('/')[1] || DEFAULT_DB).to_i
|
25
36
|
end
|
26
37
|
|
27
38
|
def db=(val)
|
39
|
+
current_key = key
|
28
40
|
self.path = "/#{val}"
|
41
|
+
self.path << "/#{current_key}"
|
42
|
+
self.path
|
29
43
|
end
|
30
44
|
|
31
45
|
def conf
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'uri/redis'
|
2
|
+
|
3
|
+
|
4
|
+
## Default database is 0
|
5
|
+
uri = URI.parse 'redis://localhost'
|
6
|
+
[uri.db, uri.host, uri.port]
|
7
|
+
#=> [0, 'localhost', 6379]
|
8
|
+
|
9
|
+
|
10
|
+
## Can parse a redis URI with a database
|
11
|
+
uri = URI.parse 'redis://localhost/2'
|
12
|
+
[uri.db, uri.host, uri.port]
|
13
|
+
#=> [2, 'localhost', 6379]
|
14
|
+
|
15
|
+
|
16
|
+
## Can parse a key name
|
17
|
+
uri = URI.parse 'redis://localhost/2/v1:arbitrary:key'
|
18
|
+
[uri.key, uri.db, uri.host, uri.port]
|
19
|
+
#=> ['v1:arbitrary:key', 2, 'localhost', 6379]
|
20
|
+
|
21
|
+
## Can set db
|
22
|
+
uri = URI.parse 'redis://localhost/2/v1:arbitrary:key'
|
23
|
+
uri.db = 6
|
24
|
+
uri.to_s
|
25
|
+
#=> 'redis://localhost/6/v1:arbitrary:key'
|
26
|
+
|
27
|
+
## Can set key
|
28
|
+
uri = URI.parse 'redis://localhost/2/v1:arbitrary:key'
|
29
|
+
uri.key = 'v2:arbitrary:key'
|
30
|
+
uri.to_s
|
31
|
+
#=> 'redis://localhost/2/v2:arbitrary:key'
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 15
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 4
|
9
|
+
- 0
|
10
|
+
version: 0.4.0
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Delano Mandelbaum
|
@@ -9,59 +15,60 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date: 2010-
|
18
|
+
date: 2010-11-15 00:00:00 -05:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
16
|
-
description: "URI-Redis: support for parsing redis://host:port/dbindex"
|
22
|
+
description: "URI-Redis: support for parsing redis://host:port/dbindex/keyname"
|
17
23
|
email: delano@solutious.com
|
18
24
|
executables: []
|
19
25
|
|
20
26
|
extensions: []
|
21
27
|
|
22
28
|
extra_rdoc_files:
|
23
|
-
- README.rdoc
|
24
29
|
- LICENSE.txt
|
25
|
-
-
|
30
|
+
- README.rdoc
|
26
31
|
files:
|
27
32
|
- CHANGES.txt
|
28
33
|
- LICENSE.txt
|
29
34
|
- README.rdoc
|
30
35
|
- Rakefile
|
36
|
+
- VERSION.yml
|
31
37
|
- lib/uri/redis.rb
|
32
|
-
-
|
33
|
-
- uri-redis.gemspec
|
38
|
+
- try/10_uri_redis_try.rb
|
34
39
|
has_rdoc: true
|
35
40
|
homepage: http://github.com/delano/uri-redis
|
36
41
|
licenses: []
|
37
42
|
|
38
43
|
post_install_message:
|
39
44
|
rdoc_options:
|
40
|
-
- --
|
41
|
-
- --title
|
42
|
-
- "URI-Redis: support for parsing redis://host:port/dbindex"
|
43
|
-
- --main
|
44
|
-
- README.rdoc
|
45
|
+
- --charset=UTF-8
|
45
46
|
require_paths:
|
46
47
|
- lib
|
47
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
48
50
|
requirements:
|
49
51
|
- - ">="
|
50
52
|
- !ruby/object:Gem::Version
|
53
|
+
hash: 3
|
54
|
+
segments:
|
55
|
+
- 0
|
51
56
|
version: "0"
|
52
|
-
version:
|
53
57
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
58
|
+
none: false
|
54
59
|
requirements:
|
55
60
|
- - ">="
|
56
61
|
- !ruby/object:Gem::Version
|
62
|
+
hash: 3
|
63
|
+
segments:
|
64
|
+
- 0
|
57
65
|
version: "0"
|
58
|
-
version:
|
59
66
|
requirements: []
|
60
67
|
|
61
68
|
rubyforge_project: uri-redis
|
62
|
-
rubygems_version: 1.3.
|
69
|
+
rubygems_version: 1.3.7
|
63
70
|
signing_key:
|
64
71
|
specification_version: 3
|
65
|
-
summary: "URI-Redis: support for parsing redis://host:port/dbindex"
|
72
|
+
summary: "URI-Redis: support for parsing redis://host:port/dbindex/keyname"
|
66
73
|
test_files: []
|
67
74
|
|
data/uri-redis.gemspec
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
@spec = Gem::Specification.new do |s|
|
2
|
-
s.name = "uri-redis"
|
3
|
-
s.rubyforge_project = 'uri-redis'
|
4
|
-
s.version = "0.3.0"
|
5
|
-
s.summary = "URI-Redis: support for parsing redis://host:port/dbindex"
|
6
|
-
s.description = s.summary
|
7
|
-
s.author = "Delano Mandelbaum"
|
8
|
-
s.email = "delano@solutious.com"
|
9
|
-
s.homepage = "http://github.com/delano/uri-redis"
|
10
|
-
|
11
|
-
s.extra_rdoc_files = %w[README.rdoc LICENSE.txt CHANGES.txt]
|
12
|
-
s.has_rdoc = true
|
13
|
-
s.rdoc_options = ["--line-numbers", "--title", s.summary, "--main", "README.rdoc"]
|
14
|
-
s.require_paths = %w[lib]
|
15
|
-
|
16
|
-
# = MANIFEST =
|
17
|
-
# git ls-files
|
18
|
-
s.files = %w(
|
19
|
-
CHANGES.txt
|
20
|
-
LICENSE.txt
|
21
|
-
README.rdoc
|
22
|
-
Rakefile
|
23
|
-
lib/uri/redis.rb
|
24
|
-
tryouts/essential_tryouts.rb
|
25
|
-
uri-redis.gemspec
|
26
|
-
)
|
27
|
-
|
28
|
-
|
29
|
-
end
|