redised 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 50c138c1a2d87e138b4eff56cc9b4d076c421949
4
+ data.tar.gz: 675544c4ab1d336ce67eb52701f898b6a89af79c
5
+ SHA512:
6
+ metadata.gz: 28af67b03c0e1bf7e5c9a69d5a05d2c977584072dbaba2a8c937b3041f2f962c8205843910f211976e3f9559ac59f81a745067a7aea91227e8d27e4021fdad8d
7
+ data.tar.gz: 9257d5f476d0f862ab1ac1aa38e1319703c444720edcf87082c593843137d83b1d36e21f53ef4cd61756caaf07d20c9923ce9270b966f1f8a66cf546a4866008
data/Gemfile CHANGED
@@ -9,7 +9,7 @@ gem 'redis-namespace'
9
9
  # Include everything needed to run rake, tests, features, etc.
10
10
  group :development do
11
11
  gem "shoulda", ">= 0"
12
- gem "mocha"
12
+ gem "minitest"
13
13
  gem "bundler", "~> 1.0"
14
- gem "jeweler", "~> 1.8.3"
14
+ gem "jeweler"
15
15
  end
data/Gemfile.lock CHANGED
@@ -1,18 +1,50 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- git (1.2.5)
5
- jeweler (1.8.3)
6
- bundler (~> 1.0)
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ descendants_tracker (0.0.3)
7
+ faraday (0.9.0)
8
+ multipart-post (>= 1.2, < 3)
9
+ git (1.2.6)
10
+ github_api (0.11.2)
11
+ addressable (~> 2.3)
12
+ descendants_tracker (~> 0.0.1)
13
+ faraday (~> 0.8, < 0.10)
14
+ hashie (>= 1.2)
15
+ multi_json (>= 1.7.5, < 2.0)
16
+ nokogiri (~> 1.6.0)
17
+ oauth2
18
+ hashie (2.0.5)
19
+ highline (1.6.20)
20
+ jeweler (2.0.1)
21
+ builder
22
+ bundler (>= 1.0)
7
23
  git (>= 1.2.5)
24
+ github_api
25
+ highline (>= 1.6.15)
26
+ nokogiri (>= 1.5.10)
8
27
  rake
9
28
  rdoc
10
- json (1.6.5)
11
- metaclass (0.0.1)
12
- mocha (0.10.3)
13
- metaclass (~> 0.0.1)
14
- rake (0.9.2.2)
15
- rdoc (3.12)
29
+ json (1.8.1)
30
+ jwt (0.1.11)
31
+ multi_json (>= 1.5)
32
+ mini_portile (0.5.2)
33
+ minitest (4.7.5)
34
+ multi_json (1.8.4)
35
+ multi_xml (0.5.5)
36
+ multipart-post (2.0.0)
37
+ nokogiri (1.6.1)
38
+ mini_portile (~> 0.5.0)
39
+ oauth2 (0.9.3)
40
+ faraday (>= 0.8, < 0.10)
41
+ jwt (~> 0.1.8)
42
+ multi_json (~> 1.3)
43
+ multi_xml (~> 0.5)
44
+ rack (~> 1.2)
45
+ rack (1.5.2)
46
+ rake (10.1.1)
47
+ rdoc (4.1.1)
16
48
  json (~> 1.4)
17
49
  redis (3.0.6)
18
50
  redis-namespace (1.3.2)
@@ -24,8 +56,8 @@ PLATFORMS
24
56
 
25
57
  DEPENDENCIES
26
58
  bundler (~> 1.0)
27
- jeweler (~> 1.8.3)
28
- mocha
59
+ jeweler
60
+ minitest
29
61
  redis (~> 3)
30
62
  redis-namespace
31
63
  shoulda
data/lib/redised.rb CHANGED
@@ -1,8 +1,10 @@
1
1
  require 'redis/namespace'
2
+ require 'yaml'
3
+
2
4
  # Redised allows for the common patter of module access to redis, when included
3
5
  # a .redis and .redis= method are provided
4
6
  module Redised
5
- VERSION = '0.3.0'
7
+ VERSION = '0.3.1'
6
8
 
7
9
  # Get a reusable connection based on a set of params. The
8
10
  # params are the same as the options you pass to `Redis.new`
@@ -65,8 +67,19 @@ module Redised
65
67
  @_redised_config = nil
66
68
  end
67
69
 
68
- def self.included(klass)
70
+ # Set global redis options
71
+ #
72
+ # Redised.redis_options = {:timeout => 1.0}
73
+ #
74
+ def self.redis_options=(options)
75
+ @_redised_redis_options = options || {}
76
+ end
77
+
78
+ def self.redis_options
79
+ @_redised_redis_options || {}
80
+ end
69
81
 
82
+ def self.included(klass)
70
83
  klass.module_eval do
71
84
 
72
85
  # Accepts:
@@ -85,13 +98,13 @@ module Redised
85
98
  else
86
99
  server, namespace = server.split('/', 2)
87
100
  host, port, db, password = server.split(':')
88
- conn = ::Redised.redis_connection({
101
+ conn = ::Redised.redis_connection(Redised.redis_options.merge({
89
102
  :host => host,
90
103
  :port => port,
91
104
  :thread_safe => true,
92
105
  :db => db,
93
106
  :password => password
94
- })
107
+ }))
95
108
  end
96
109
 
97
110
  @_redis = namespace ? Redis::Namespace.new(namespace, :redis => conn) : conn
data/redised.gemspec CHANGED
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
+ # stub: redised 0.3.1 ruby lib
5
6
 
6
7
  Gem::Specification.new do |s|
7
8
  s.name = "redised"
8
- s.version = "0.3.0"
9
+ s.version = "0.3.1"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib"]
11
13
  s.authors = ["Aaron Quint"]
12
- s.date = "2013-11-07"
14
+ s.date = "2014-02-09"
13
15
  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
16
  s.email = "aaron@quirkey.com"
15
17
  s.extra_rdoc_files = [
@@ -31,35 +33,34 @@ Gem::Specification.new do |s|
31
33
  ]
32
34
  s.homepage = "http://github.com/paperlesspost/redised"
33
35
  s.licenses = ["MIT"]
34
- s.require_paths = ["lib"]
35
- s.rubygems_version = "1.8.23"
36
+ s.rubygems_version = "2.2.1"
36
37
  s.summary = "a simple module that allows you to setup your class or module with a redis connection"
37
38
 
38
39
  if s.respond_to? :specification_version then
39
- s.specification_version = 3
40
+ s.specification_version = 4
40
41
 
41
42
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
42
43
  s.add_runtime_dependency(%q<redis>, ["~> 3"])
43
44
  s.add_runtime_dependency(%q<redis-namespace>, [">= 0"])
44
45
  s.add_development_dependency(%q<shoulda>, [">= 0"])
45
- s.add_development_dependency(%q<mocha>, [">= 0"])
46
+ s.add_development_dependency(%q<minitest>, [">= 0"])
46
47
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
47
- s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
48
+ s.add_development_dependency(%q<jeweler>, [">= 0"])
48
49
  else
49
50
  s.add_dependency(%q<redis>, ["~> 3"])
50
51
  s.add_dependency(%q<redis-namespace>, [">= 0"])
51
52
  s.add_dependency(%q<shoulda>, [">= 0"])
52
- s.add_dependency(%q<mocha>, [">= 0"])
53
+ s.add_dependency(%q<minitest>, [">= 0"])
53
54
  s.add_dependency(%q<bundler>, ["~> 1.0"])
54
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
55
+ s.add_dependency(%q<jeweler>, [">= 0"])
55
56
  end
56
57
  else
57
58
  s.add_dependency(%q<redis>, ["~> 3"])
58
59
  s.add_dependency(%q<redis-namespace>, [">= 0"])
59
60
  s.add_dependency(%q<shoulda>, [">= 0"])
60
- s.add_dependency(%q<mocha>, [">= 0"])
61
+ s.add_dependency(%q<minitest>, [">= 0"])
61
62
  s.add_dependency(%q<bundler>, ["~> 1.0"])
62
- s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
63
+ s.add_dependency(%q<jeweler>, [">= 0"])
63
64
  end
64
65
  end
65
66
 
data/test/helper.rb CHANGED
@@ -9,7 +9,6 @@ rescue Bundler::BundlerError => e
9
9
  end
10
10
  require 'test/unit'
11
11
  require 'shoulda'
12
- require 'mocha'
13
12
 
14
13
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
14
  $LOAD_PATH.unshift(File.dirname(__FILE__))
data/test/test_redised.rb CHANGED
@@ -57,6 +57,19 @@ class TestRedised < Test::Unit::TestCase
57
57
  assert_equal 2, redis.client.db
58
58
  assert_equal 'mypass', redis.client.password
59
59
  assert_equal 'namespace', redis.namespace
60
+ assert_equal 5.0, redis.client.timeout
61
+ end
62
+
63
+ should "use redis_options" do
64
+ Redised.redis_options = {:timeout => 1.0}
65
+ RedisedClass.redis = 'localhost:5678:2:mypass/namespace'
66
+ redis = RedisedClass.redis
67
+ assert_equal 'localhost', redis.client.host
68
+ assert_equal 5678, redis.client.port
69
+ assert_equal 2, redis.client.db
70
+ assert_equal 'mypass', redis.client.password
71
+ assert_equal 'namespace', redis.namespace
72
+ assert_equal 1.0, redis.client.timeout
60
73
  end
61
74
 
62
75
  end
metadata CHANGED
@@ -1,112 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redised
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
5
- prerelease:
4
+ version: 0.3.1
6
5
  platform: ruby
7
6
  authors:
8
7
  - Aaron Quint
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-11-07 00:00:00.000000000 Z
11
+ date: 2014-02-09 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: redis
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '3'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '3'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: redis-namespace
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: shoulda
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
- name: mocha
56
+ name: minitest
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - ">="
76
67
  - !ruby/object:Gem::Version
77
68
  version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: bundler
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ~>
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
75
  version: '1.0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ~>
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
82
  version: '1.0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: jeweler
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ~>
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
- version: 1.8.3
89
+ version: '0'
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ~>
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
- version: 1.8.3
96
+ version: '0'
110
97
  description: redised provides a single module `Redised` that when included in your
111
98
  class provides a self.redis= and self.redis methods. It also has the ability to
112
99
  load the urls from a YAML config file
@@ -117,7 +104,7 @@ extra_rdoc_files:
117
104
  - LICENSE.txt
118
105
  - README.rdoc
119
106
  files:
120
- - .document
107
+ - ".document"
121
108
  - Gemfile
122
109
  - Gemfile.lock
123
110
  - LICENSE.txt
@@ -131,30 +118,26 @@ files:
131
118
  homepage: http://github.com/paperlesspost/redised
132
119
  licenses:
133
120
  - MIT
121
+ metadata: {}
134
122
  post_install_message:
135
123
  rdoc_options: []
136
124
  require_paths:
137
125
  - lib
138
126
  required_ruby_version: !ruby/object:Gem::Requirement
139
- none: false
140
127
  requirements:
141
- - - ! '>='
128
+ - - ">="
142
129
  - !ruby/object:Gem::Version
143
130
  version: '0'
144
- segments:
145
- - 0
146
- hash: -2742425785523815070
147
131
  required_rubygems_version: !ruby/object:Gem::Requirement
148
- none: false
149
132
  requirements:
150
- - - ! '>='
133
+ - - ">="
151
134
  - !ruby/object:Gem::Version
152
135
  version: '0'
153
136
  requirements: []
154
137
  rubyforge_project:
155
- rubygems_version: 1.8.23
138
+ rubygems_version: 2.2.1
156
139
  signing_key:
157
- specification_version: 3
140
+ specification_version: 4
158
141
  summary: a simple module that allows you to setup your class or module with a redis
159
142
  connection
160
143
  test_files: []