redis-objects-legacy 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +12 -0
- data/.travis.yml +16 -0
- data/ATOMICITY.rdoc +154 -0
- data/CHANGELOG.rdoc +362 -0
- data/Gemfile +4 -0
- data/LICENSE +202 -0
- data/README.md +600 -0
- data/Rakefile +14 -0
- data/lib/redis/base_object.rb +62 -0
- data/lib/redis/counter.rb +145 -0
- data/lib/redis/enumerable_object.rb +28 -0
- data/lib/redis/hash_key.rb +163 -0
- data/lib/redis/helpers/core_commands.rb +89 -0
- data/lib/redis/list.rb +160 -0
- data/lib/redis/lock.rb +89 -0
- data/lib/redis/objects/connection_pool_proxy.rb +31 -0
- data/lib/redis/objects/counters.rb +155 -0
- data/lib/redis/objects/hashes.rb +60 -0
- data/lib/redis/objects/lists.rb +58 -0
- data/lib/redis/objects/locks.rb +73 -0
- data/lib/redis/objects/sets.rb +58 -0
- data/lib/redis/objects/sorted_sets.rb +49 -0
- data/lib/redis/objects/values.rb +64 -0
- data/lib/redis/objects/version.rb +5 -0
- data/lib/redis/objects.rb +199 -0
- data/lib/redis/set.rb +182 -0
- data/lib/redis/sorted_set.rb +325 -0
- data/lib/redis/value.rb +65 -0
- data/lib/redis-objects-legacy.rb +1 -0
- data/spec/redis_autoload_objects_spec.rb +46 -0
- data/spec/redis_namespace_compat_spec.rb +24 -0
- data/spec/redis_objects_active_record_spec.rb +162 -0
- data/spec/redis_objects_conn_spec.rb +276 -0
- data/spec/redis_objects_custom_serializer.rb +198 -0
- data/spec/redis_objects_instance_spec.rb +1666 -0
- data/spec/redis_objects_model_spec.rb +1097 -0
- data/spec/spec_helper.rb +92 -0
- metadata +214 -0
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'rubygems' # poor people still on 1.8
|
2
|
+
gem 'redis', '>= 3.0.0'
|
3
|
+
require 'redis'
|
4
|
+
|
5
|
+
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__) + '/../lib')
|
6
|
+
require 'bacon'
|
7
|
+
Bacon.summary_at_exit
|
8
|
+
if $0 =~ /\brspec$/
|
9
|
+
raise "\n===\nThese tests are in bacon, not rspec. Try: bacon #{ARGV * ' '}\n===\n"
|
10
|
+
end
|
11
|
+
|
12
|
+
# For the incompatible change from redis.rb
|
13
|
+
Redis.exists_returns_integer = true
|
14
|
+
|
15
|
+
# Avoid phantom remote test failures
|
16
|
+
RUNNING_LOCALLY = !ENV['TRAVIS']
|
17
|
+
|
18
|
+
# Code coverage reports
|
19
|
+
require 'simplecov'
|
20
|
+
SimpleCov.start
|
21
|
+
|
22
|
+
require 'simplecov-cobertura'
|
23
|
+
SimpleCov.formatter = SimpleCov::Formatter::CoberturaFormatter
|
24
|
+
|
25
|
+
require "active_support/testing/time_helpers"
|
26
|
+
include ActiveSupport::Testing::TimeHelpers
|
27
|
+
|
28
|
+
REDIS_CLASS_NAMES = [:Counter, :HashKey, :List, :Lock, :Set, :SortedSet, :Value]
|
29
|
+
|
30
|
+
UNIONSTORE_KEY = 'test:unionstore'
|
31
|
+
INTERSTORE_KEY = 'test:interstore'
|
32
|
+
DIFFSTORE_KEY = 'test:diffstore'
|
33
|
+
|
34
|
+
# Start our own redis-server to avoid corrupting any others
|
35
|
+
REDIS_BIN = 'redis-server'
|
36
|
+
REDIS_PORT = ENV['REDIS_PORT'] || 9212
|
37
|
+
REDIS_HOST = ENV['REDIS_HOST'] || 'localhost'
|
38
|
+
REDIS_PID = 'redis.pid' # can't be absolute
|
39
|
+
REDIS_DUMP = 'redis.rdb' # can't be absolute
|
40
|
+
REDIS_RUNDIR = File.dirname(__FILE__)
|
41
|
+
|
42
|
+
def start_redis
|
43
|
+
puts "=> Starting redis-server on #{REDIS_HOST}:#{REDIS_PORT}"
|
44
|
+
fork_pid = fork do
|
45
|
+
system "cd #{REDIS_RUNDIR} && (echo port #{REDIS_PORT}; " +
|
46
|
+
"echo logfile /dev/null; echo daemonize yes; " +
|
47
|
+
"echo pidfile #{REDIS_PID}; echo dbfilename #{REDIS_DUMP}; " +
|
48
|
+
"echo databases 32) | #{REDIS_BIN} -"
|
49
|
+
end
|
50
|
+
fork_pid.should > 0
|
51
|
+
sleep 2
|
52
|
+
end
|
53
|
+
|
54
|
+
def kill_redis
|
55
|
+
pidfile = File.expand_path REDIS_PID, REDIS_RUNDIR
|
56
|
+
rdbfile = File.expand_path REDIS_DUMP, REDIS_RUNDIR
|
57
|
+
pid = File.read(pidfile).to_i
|
58
|
+
puts "=> Killing #{REDIS_BIN} with pid #{pid}"
|
59
|
+
Process.kill "TERM", pid
|
60
|
+
Process.kill "KILL", pid
|
61
|
+
File.unlink pidfile
|
62
|
+
File.unlink rdbfile if File.exists? rdbfile
|
63
|
+
end
|
64
|
+
|
65
|
+
# Start redis-server except under JRuby
|
66
|
+
unless defined?(RUBY_ENGINE) && RUBY_ENGINE == "jruby"
|
67
|
+
start_redis
|
68
|
+
|
69
|
+
at_exit do
|
70
|
+
kill_redis
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
def raises_exception(&block)
|
75
|
+
e = nil
|
76
|
+
begin
|
77
|
+
block.call
|
78
|
+
rescue => e
|
79
|
+
end
|
80
|
+
e.should.be.is_a?(StandardError)
|
81
|
+
end
|
82
|
+
|
83
|
+
# Grab a global handle
|
84
|
+
REDIS_HANDLE = Redis.new(:host => REDIS_HOST, :port => REDIS_PORT)
|
85
|
+
#$redis = REDIS_HANDLE
|
86
|
+
Redis.current = REDIS_HANDLE
|
87
|
+
|
88
|
+
SORT_ORDER = {:order => 'desc alpha'}
|
89
|
+
SORT_LIMIT = {:limit => [2, 2]}
|
90
|
+
SORT_BY = {:by => 'm_*'}
|
91
|
+
SORT_GET = {:get => 'spec/*/sorted'}.merge!(SORT_LIMIT)
|
92
|
+
SORT_STORE = {:store => "spec/aftersort"}.merge!(SORT_GET)
|
metadata
ADDED
@@ -0,0 +1,214 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redis-objects-legacy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.6.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andrei Merfu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-04-03 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.2'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '4.2'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: bacon
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: connection_pool
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: redis-namespace
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activerecord
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: sqlite3
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov-cobertura
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: Map Redis types directly to Ruby objects. Works with any class or ORM.
|
140
|
+
email:
|
141
|
+
- andreimerfu@outlook.com
|
142
|
+
executables: []
|
143
|
+
extensions: []
|
144
|
+
extra_rdoc_files: []
|
145
|
+
files:
|
146
|
+
- ".gitignore"
|
147
|
+
- ".travis.yml"
|
148
|
+
- ATOMICITY.rdoc
|
149
|
+
- CHANGELOG.rdoc
|
150
|
+
- Gemfile
|
151
|
+
- LICENSE
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- lib/redis-objects-legacy.rb
|
155
|
+
- lib/redis/base_object.rb
|
156
|
+
- lib/redis/counter.rb
|
157
|
+
- lib/redis/enumerable_object.rb
|
158
|
+
- lib/redis/hash_key.rb
|
159
|
+
- lib/redis/helpers/core_commands.rb
|
160
|
+
- lib/redis/list.rb
|
161
|
+
- lib/redis/lock.rb
|
162
|
+
- lib/redis/objects.rb
|
163
|
+
- lib/redis/objects/connection_pool_proxy.rb
|
164
|
+
- lib/redis/objects/counters.rb
|
165
|
+
- lib/redis/objects/hashes.rb
|
166
|
+
- lib/redis/objects/lists.rb
|
167
|
+
- lib/redis/objects/locks.rb
|
168
|
+
- lib/redis/objects/sets.rb
|
169
|
+
- lib/redis/objects/sorted_sets.rb
|
170
|
+
- lib/redis/objects/values.rb
|
171
|
+
- lib/redis/objects/version.rb
|
172
|
+
- lib/redis/set.rb
|
173
|
+
- lib/redis/sorted_set.rb
|
174
|
+
- lib/redis/value.rb
|
175
|
+
- spec/redis_autoload_objects_spec.rb
|
176
|
+
- spec/redis_namespace_compat_spec.rb
|
177
|
+
- spec/redis_objects_active_record_spec.rb
|
178
|
+
- spec/redis_objects_conn_spec.rb
|
179
|
+
- spec/redis_objects_custom_serializer.rb
|
180
|
+
- spec/redis_objects_instance_spec.rb
|
181
|
+
- spec/redis_objects_model_spec.rb
|
182
|
+
- spec/spec_helper.rb
|
183
|
+
homepage: http://github.com/andreimerfu/redis-objects-legacy
|
184
|
+
licenses:
|
185
|
+
- MIT
|
186
|
+
metadata: {}
|
187
|
+
post_install_message:
|
188
|
+
rdoc_options: []
|
189
|
+
require_paths:
|
190
|
+
- lib
|
191
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
192
|
+
requirements:
|
193
|
+
- - ">="
|
194
|
+
- !ruby/object:Gem::Version
|
195
|
+
version: '0'
|
196
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
197
|
+
requirements:
|
198
|
+
- - ">="
|
199
|
+
- !ruby/object:Gem::Version
|
200
|
+
version: '0'
|
201
|
+
requirements: []
|
202
|
+
rubygems_version: 3.3.3
|
203
|
+
signing_key:
|
204
|
+
specification_version: 4
|
205
|
+
summary: Map Redis types directly to Ruby objects
|
206
|
+
test_files:
|
207
|
+
- spec/redis_autoload_objects_spec.rb
|
208
|
+
- spec/redis_namespace_compat_spec.rb
|
209
|
+
- spec/redis_objects_active_record_spec.rb
|
210
|
+
- spec/redis_objects_conn_spec.rb
|
211
|
+
- spec/redis_objects_custom_serializer.rb
|
212
|
+
- spec/redis_objects_instance_spec.rb
|
213
|
+
- spec/redis_objects_model_spec.rb
|
214
|
+
- spec/spec_helper.rb
|