redised 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/lib/redised.rb CHANGED
@@ -2,7 +2,7 @@ require 'redis/namespace'
2
2
  # Redised allows for the common patter of module access to redis, when included
3
3
  # a .redis and .redis= method are provided
4
4
  module Redised
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
 
7
7
  # Get a reusable connection based on a set of params. The
8
8
  # params are the same as the options you pass to `Redis.new`
@@ -60,6 +60,7 @@ module Redised
60
60
  # 4. A redis URL string 'redis://host:port'
61
61
  # 5. An instance of `Redis`, `Redis::Client`, `Redis::DistRedis`,
62
62
  # or `Redis::Namespace`.
63
+ # 6. A 'hostname:port:db:password' string (to select the Redis db & a password)
63
64
  def self.redis=(server)
64
65
  if server.respond_to? :split
65
66
 
@@ -67,9 +68,14 @@ module Redised
67
68
  conn = ::Redised.redis_connection(:url => server)
68
69
  else
69
70
  server, namespace = server.split('/', 2)
70
- host, port, db = server.split(':')
71
- conn = ::Redised.redis_connection(:host => host, :port => port,
72
- :thread_safe => true, :db => db)
71
+ host, port, db, password = server.split(':')
72
+ conn = ::Redised.redis_connection({
73
+ :host => host,
74
+ :port => port,
75
+ :thread_safe => true,
76
+ :db => db,
77
+ :password => password
78
+ })
73
79
  end
74
80
 
75
81
  @_redis = namespace ? Redis::Namespace.new(namespace, :redis => conn) : conn
data/redised.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "redised"
8
- s.version = "0.1.0"
8
+ s.version = "0.2.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Aaron Quint"]
12
- s.date = "2012-02-06"
12
+ s.date = "2012-04-09"
13
13
  s.description = "redised provides a single module `Redised` that when included in your class provides a self.redis= and self.redis methods. It also has the ability to load the urls from a YAML config file"
14
14
  s.email = "aaron@quirkey.com"
15
15
  s.extra_rdoc_files = [
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.homepage = "http://github.com/paperlesspost/redised"
33
33
  s.licenses = ["MIT"]
34
34
  s.require_paths = ["lib"]
35
- s.rubygems_version = "1.8.10"
35
+ s.rubygems_version = "1.8.16"
36
36
  s.summary = "a simple module that allows you to setup your class or module with a redis connection"
37
37
 
38
38
  if s.respond_to? :specification_version then
data/test/test_redised.rb CHANGED
@@ -49,6 +49,16 @@ class TestRedised < Test::Unit::TestCase
49
49
  assert_equal 'namespace', redis.namespace
50
50
  end
51
51
 
52
+ should "parse redis connection with database and password" do
53
+ RedisedClass.redis = 'localhost:5678:2:mypass/namespace'
54
+ redis = RedisedClass.redis
55
+ assert_equal 'localhost', redis.client.host
56
+ assert_equal 5678, redis.client.port
57
+ assert_equal 2, redis.client.db
58
+ assert_equal 'mypass', redis.client.password
59
+ assert_equal 'namespace', redis.namespace
60
+ end
61
+
52
62
  end
53
63
 
54
64
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redised
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-06 00:00:00.000000000Z
12
+ date: 2012-04-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis
16
- requirement: &70189510863680 !ruby/object:Gem::Requirement
16
+ requirement: &70107872010160 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70189510863680
24
+ version_requirements: *70107872010160
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: redis-namespace
27
- requirement: &70189510862940 !ruby/object:Gem::Requirement
27
+ requirement: &70107872009360 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70189510862940
35
+ version_requirements: *70107872009360
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: shoulda
38
- requirement: &70189510862180 !ruby/object:Gem::Requirement
38
+ requirement: &70107872008860 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70189510862180
46
+ version_requirements: *70107872008860
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: mocha
49
- requirement: &70189510861600 !ruby/object:Gem::Requirement
49
+ requirement: &70107872008360 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70189510861600
57
+ version_requirements: *70107872008360
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &70189510860720 !ruby/object:Gem::Requirement
60
+ requirement: &70107872007660 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.0.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70189510860720
68
+ version_requirements: *70107872007660
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &70189510858840 !ruby/object:Gem::Requirement
71
+ requirement: &70107872007020 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 1.8.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70189510858840
79
+ version_requirements: *70107872007020
80
80
  description: redised provides a single module `Redised` that when included in your
81
81
  class provides a self.redis= and self.redis methods. It also has the ability to
82
82
  load the urls from a YAML config file
@@ -113,7 +113,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
113
  version: '0'
114
114
  segments:
115
115
  - 0
116
- hash: 421598399054906059
116
+ hash: 3322371093604468877
117
117
  required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  none: false
119
119
  requirements:
@@ -122,7 +122,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
122
122
  version: '0'
123
123
  requirements: []
124
124
  rubyforge_project:
125
- rubygems_version: 1.8.10
125
+ rubygems_version: 1.8.16
126
126
  signing_key:
127
127
  specification_version: 3
128
128
  summary: a simple module that allows you to setup your class or module with a redis