redis-script_manager 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +5 -4
- data/.rubocop.yml +6 -0
- data/.rubocop_todo.yml +266 -0
- data/.travis.yml +8 -1
- data/README.md +16 -2
- data/lib/redis/script_manager/version.rb +10 -7
- data/lib/redis/script_manager.rb +0 -4
- metadata +3 -2
- data/Gemfile.lock +0 -27
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b3bf62263d3927088efc2136df3cb22f5a29ce54
|
|
4
|
+
data.tar.gz: 4c0ee1b2b1d56ae9afe620cf9397cf159bd37120
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a1ff6adf5859dfabe42b8e93a87f1b74ceb7e571f5f7265b72fc4ca5787aa1e002ebe905dbf81273f3216ee7113372f8e7f9c5d2bbcb8e42c70ee9cce54bf38
|
|
7
|
+
data.tar.gz: be3ca085567587e9507b45917bea13d068a1616f7a18198d1d0856a197d3f72a8ddd8f1c5d5417e31a93bda31bf5c61d2f393cfeb696844189ca608c0816c81c
|
data/.gitignore
CHANGED
|
@@ -40,11 +40,12 @@ build-iPhoneSimulator/
|
|
|
40
40
|
/vendor/bundle
|
|
41
41
|
/lib/bundler/man/
|
|
42
42
|
|
|
43
|
-
#
|
|
43
|
+
# For a library or gem, you might want to ignore these files since the code is
|
|
44
44
|
# intended to run in multiple environments; otherwise, check them in:
|
|
45
|
-
#
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
#
|
|
46
|
+
Gemfile.lock
|
|
47
|
+
.ruby-version
|
|
48
|
+
.ruby-gemset
|
|
48
49
|
|
|
49
50
|
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
|
50
51
|
.rvmrc
|
data/.rubocop.yml
ADDED
data/.rubocop_todo.yml
ADDED
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# This configuration was generated by
|
|
2
|
+
# `rubocop --auto-gen-config`
|
|
3
|
+
# on 2017-08-29 15:12:56 -0700 using RuboCop version 0.49.1.
|
|
4
|
+
# The point is for the user to remove these configuration records
|
|
5
|
+
# one by one as the offenses are removed from the code base.
|
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
|
8
|
+
|
|
9
|
+
# Offense count: 10
|
|
10
|
+
# Cop supports --auto-correct.
|
|
11
|
+
# Configuration parameters: AllowAdjacentOneLineDefs, NumberOfEmptyLines.
|
|
12
|
+
Layout/EmptyLineBetweenDefs:
|
|
13
|
+
Exclude:
|
|
14
|
+
- 'lib/redis/script_manager.rb'
|
|
15
|
+
- 'test/redis/script_manager_test.rb'
|
|
16
|
+
|
|
17
|
+
# Offense count: 2
|
|
18
|
+
# Cop supports --auto-correct.
|
|
19
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
20
|
+
# SupportedStyles: empty_lines, no_empty_lines
|
|
21
|
+
Layout/EmptyLinesAroundBlockBody:
|
|
22
|
+
Exclude:
|
|
23
|
+
- 'redis-script_manager.gemspec'
|
|
24
|
+
|
|
25
|
+
# Offense count: 7
|
|
26
|
+
# Cop supports --auto-correct.
|
|
27
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
28
|
+
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
|
|
29
|
+
Layout/EmptyLinesAroundClassBody:
|
|
30
|
+
Exclude:
|
|
31
|
+
- 'lib/redis/script_manager.rb'
|
|
32
|
+
- 'test/redis/script_manager_test.rb'
|
|
33
|
+
|
|
34
|
+
# Offense count: 19
|
|
35
|
+
# Cop supports --auto-correct.
|
|
36
|
+
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
|
37
|
+
Layout/ExtraSpacing:
|
|
38
|
+
Exclude:
|
|
39
|
+
- 'lib/redis/script_manager.rb'
|
|
40
|
+
- 'test/redis/script_manager_test.rb'
|
|
41
|
+
|
|
42
|
+
# Offense count: 161
|
|
43
|
+
# Cop supports --auto-correct.
|
|
44
|
+
Layout/SpaceAfterComma:
|
|
45
|
+
Exclude:
|
|
46
|
+
- 'lib/redis/script_manager.rb'
|
|
47
|
+
- 'test/redis/script_manager_test.rb'
|
|
48
|
+
|
|
49
|
+
# Offense count: 2
|
|
50
|
+
# Cop supports --auto-correct.
|
|
51
|
+
# Configuration parameters: SupportedStyles.
|
|
52
|
+
# SupportedStyles: space, no_space
|
|
53
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
|
54
|
+
EnforcedStyle: no_space
|
|
55
|
+
|
|
56
|
+
# Offense count: 9
|
|
57
|
+
# Cop supports --auto-correct.
|
|
58
|
+
# Configuration parameters: AllowForAlignment.
|
|
59
|
+
Layout/SpaceAroundOperators:
|
|
60
|
+
Exclude:
|
|
61
|
+
- 'lib/redis/script_manager.rb'
|
|
62
|
+
- 'test/redis/script_manager_test.rb'
|
|
63
|
+
|
|
64
|
+
# Offense count: 3
|
|
65
|
+
# Cop supports --auto-correct.
|
|
66
|
+
# Configuration parameters: AllowForAlignment.
|
|
67
|
+
Layout/SpaceBeforeFirstArg:
|
|
68
|
+
Exclude:
|
|
69
|
+
- 'test/redis/script_manager_test.rb'
|
|
70
|
+
|
|
71
|
+
# Offense count: 15
|
|
72
|
+
# Cop supports --auto-correct.
|
|
73
|
+
Layout/SpaceBeforeSemicolon:
|
|
74
|
+
Exclude:
|
|
75
|
+
- 'test/redis/script_manager_test.rb'
|
|
76
|
+
|
|
77
|
+
# Offense count: 13
|
|
78
|
+
# Cop supports --auto-correct.
|
|
79
|
+
Layout/SpaceInsideBrackets:
|
|
80
|
+
Exclude:
|
|
81
|
+
- 'test/redis/script_manager_test.rb'
|
|
82
|
+
|
|
83
|
+
# Offense count: 2
|
|
84
|
+
# Cop supports --auto-correct.
|
|
85
|
+
Layout/SpaceInsideParens:
|
|
86
|
+
Exclude:
|
|
87
|
+
- 'test/redis/script_manager_test.rb'
|
|
88
|
+
|
|
89
|
+
# Offense count: 7
|
|
90
|
+
Metrics/AbcSize:
|
|
91
|
+
Max: 81
|
|
92
|
+
|
|
93
|
+
# Offense count: 4
|
|
94
|
+
# Configuration parameters: CountComments, ExcludedMethods.
|
|
95
|
+
Metrics/BlockLength:
|
|
96
|
+
Max: 99
|
|
97
|
+
|
|
98
|
+
# Offense count: 1
|
|
99
|
+
# Configuration parameters: CountBlocks.
|
|
100
|
+
Metrics/BlockNesting:
|
|
101
|
+
Max: 4
|
|
102
|
+
|
|
103
|
+
# Offense count: 2
|
|
104
|
+
# Configuration parameters: CountComments.
|
|
105
|
+
Metrics/ClassLength:
|
|
106
|
+
Max: 425
|
|
107
|
+
|
|
108
|
+
# Offense count: 1
|
|
109
|
+
Metrics/CyclomaticComplexity:
|
|
110
|
+
Max: 20
|
|
111
|
+
|
|
112
|
+
# Offense count: 7
|
|
113
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
|
114
|
+
# URISchemes: http, https
|
|
115
|
+
Metrics/LineLength:
|
|
116
|
+
Max: 81
|
|
117
|
+
|
|
118
|
+
# Offense count: 7
|
|
119
|
+
# Configuration parameters: CountComments.
|
|
120
|
+
Metrics/MethodLength:
|
|
121
|
+
Max: 78
|
|
122
|
+
|
|
123
|
+
# Offense count: 1
|
|
124
|
+
Metrics/PerceivedComplexity:
|
|
125
|
+
Max: 21
|
|
126
|
+
|
|
127
|
+
# Offense count: 1
|
|
128
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
129
|
+
# SupportedStyles: nested, compact
|
|
130
|
+
Style/ClassAndModuleChildren:
|
|
131
|
+
Exclude:
|
|
132
|
+
- 'test/redis/script_manager_test.rb'
|
|
133
|
+
|
|
134
|
+
# Offense count: 4
|
|
135
|
+
Style/ClassVars:
|
|
136
|
+
Exclude:
|
|
137
|
+
- 'lib/redis/script_manager.rb'
|
|
138
|
+
- 'test/redis/script_manager_test.rb'
|
|
139
|
+
|
|
140
|
+
# Offense count: 2
|
|
141
|
+
Style/Documentation:
|
|
142
|
+
Exclude:
|
|
143
|
+
- 'spec/**/*'
|
|
144
|
+
- 'test/**/*'
|
|
145
|
+
- 'lib/redis/script_manager.rb'
|
|
146
|
+
|
|
147
|
+
# Offense count: 2
|
|
148
|
+
# Configuration parameters: MinBodyLength.
|
|
149
|
+
Style/GuardClause:
|
|
150
|
+
Exclude:
|
|
151
|
+
- 'lib/redis/script_manager.rb'
|
|
152
|
+
|
|
153
|
+
# Offense count: 2
|
|
154
|
+
# Cop supports --auto-correct.
|
|
155
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, UseHashRocketsWithSymbolValues, PreferHashRocketsForNonAlnumEndingSymbols.
|
|
156
|
+
# SupportedStyles: ruby19, hash_rockets, no_mixed_keys, ruby19_no_mixed_keys
|
|
157
|
+
Style/HashSyntax:
|
|
158
|
+
Exclude:
|
|
159
|
+
- 'Rakefile'
|
|
160
|
+
- 'test/redis/script_manager_test.rb'
|
|
161
|
+
|
|
162
|
+
# Offense count: 4
|
|
163
|
+
# Cop supports --auto-correct.
|
|
164
|
+
# Configuration parameters: MaxLineLength.
|
|
165
|
+
Style/IfUnlessModifier:
|
|
166
|
+
Exclude:
|
|
167
|
+
- 'lib/redis/script_manager.rb'
|
|
168
|
+
|
|
169
|
+
# Offense count: 43
|
|
170
|
+
# Cop supports --auto-correct.
|
|
171
|
+
Style/LineEndConcatenation:
|
|
172
|
+
Exclude:
|
|
173
|
+
- 'test/redis/script_manager_test.rb'
|
|
174
|
+
|
|
175
|
+
# Offense count: 3
|
|
176
|
+
Style/MultilineTernaryOperator:
|
|
177
|
+
Exclude:
|
|
178
|
+
- 'test/redis/script_manager_test.rb'
|
|
179
|
+
|
|
180
|
+
# Offense count: 1
|
|
181
|
+
# Cop supports --auto-correct.
|
|
182
|
+
Style/MutableConstant:
|
|
183
|
+
Exclude:
|
|
184
|
+
- 'lib/redis/script_manager/version.rb'
|
|
185
|
+
|
|
186
|
+
# Offense count: 9
|
|
187
|
+
# Cop supports --auto-correct.
|
|
188
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
189
|
+
# SupportedStyles: both, prefix, postfix
|
|
190
|
+
Style/NegatedIf:
|
|
191
|
+
Exclude:
|
|
192
|
+
- 'lib/redis/script_manager.rb'
|
|
193
|
+
- 'test/redis/script_manager_test.rb'
|
|
194
|
+
|
|
195
|
+
# Offense count: 2
|
|
196
|
+
# Cop supports --auto-correct.
|
|
197
|
+
Style/RedundantException:
|
|
198
|
+
Exclude:
|
|
199
|
+
- 'lib/redis/script_manager.rb'
|
|
200
|
+
|
|
201
|
+
# Offense count: 1
|
|
202
|
+
# Cop supports --auto-correct.
|
|
203
|
+
Style/RedundantSelf:
|
|
204
|
+
Exclude:
|
|
205
|
+
- 'lib/redis/script_manager.rb'
|
|
206
|
+
|
|
207
|
+
# Offense count: 15
|
|
208
|
+
# Cop supports --auto-correct.
|
|
209
|
+
# Configuration parameters: AllowAsExpressionSeparator.
|
|
210
|
+
Style/Semicolon:
|
|
211
|
+
Exclude:
|
|
212
|
+
- 'test/redis/script_manager_test.rb'
|
|
213
|
+
|
|
214
|
+
# Offense count: 84
|
|
215
|
+
# Cop supports --auto-correct.
|
|
216
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
|
|
217
|
+
# SupportedStyles: single_quotes, double_quotes
|
|
218
|
+
Style/StringLiterals:
|
|
219
|
+
Exclude:
|
|
220
|
+
- 'Rakefile'
|
|
221
|
+
- 'bin/console'
|
|
222
|
+
- 'lib/redis/script_manager.rb'
|
|
223
|
+
- 'redis-script_manager.gemspec'
|
|
224
|
+
- 'test/redis/script_manager_test.rb'
|
|
225
|
+
|
|
226
|
+
# Offense count: 1
|
|
227
|
+
# Cop supports --auto-correct.
|
|
228
|
+
# Configuration parameters: MinSize, SupportedStyles.
|
|
229
|
+
# SupportedStyles: percent, brackets
|
|
230
|
+
Style/SymbolArray:
|
|
231
|
+
EnforcedStyle: brackets
|
|
232
|
+
|
|
233
|
+
# Offense count: 13
|
|
234
|
+
# Cop supports --auto-correct.
|
|
235
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStylesForMultiline.
|
|
236
|
+
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
|
|
237
|
+
Style/TrailingCommaInLiteral:
|
|
238
|
+
Exclude:
|
|
239
|
+
- 'test/redis/script_manager_test.rb'
|
|
240
|
+
|
|
241
|
+
# Offense count: 1
|
|
242
|
+
# Cop supports --auto-correct.
|
|
243
|
+
# Configuration parameters: ExactNameMatch, AllowPredicates, AllowDSLWriters, IgnoreClassMethods, Whitelist.
|
|
244
|
+
# Whitelist: to_ary, to_a, to_c, to_enum, to_h, to_hash, to_i, to_int, to_io, to_open, to_path, to_proc, to_r, to_regexp, to_str, to_s, to_sym
|
|
245
|
+
Style/TrivialAccessors:
|
|
246
|
+
Exclude:
|
|
247
|
+
- 'lib/redis/script_manager.rb'
|
|
248
|
+
|
|
249
|
+
# Offense count: 9
|
|
250
|
+
# Cop supports --auto-correct.
|
|
251
|
+
# Configuration parameters: SupportedStyles, MinSize, WordRegex.
|
|
252
|
+
# SupportedStyles: percent, brackets
|
|
253
|
+
Style/WordArray:
|
|
254
|
+
EnforcedStyle: brackets
|
|
255
|
+
|
|
256
|
+
# Offense count: 2
|
|
257
|
+
# Cop supports --auto-correct.
|
|
258
|
+
Style/YodaCondition:
|
|
259
|
+
Exclude:
|
|
260
|
+
- 'lib/redis/script_manager.rb'
|
|
261
|
+
|
|
262
|
+
# Offense count: 1
|
|
263
|
+
# Cop supports --auto-correct.
|
|
264
|
+
Style/ZeroLengthPredicate:
|
|
265
|
+
Exclude:
|
|
266
|
+
- 'lib/redis/script_manager.rb'
|
data/.travis.yml
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
sudo: false
|
|
2
2
|
language: ruby
|
|
3
|
+
before_install:
|
|
4
|
+
- gem install bundler -v 1.14.6
|
|
5
|
+
- gem install rubocop
|
|
6
|
+
services:
|
|
7
|
+
- redis-server
|
|
3
8
|
rvm:
|
|
4
9
|
- 2.1.6
|
|
5
|
-
|
|
10
|
+
script:
|
|
11
|
+
- rubocop
|
|
12
|
+
- bundle exec env REDIS_URL=redis://localhost:6379 rake test
|
data/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Redis::ScriptManager
|
|
1
|
+
# Redis::ScriptManager 
|
|
2
2
|
|
|
3
3
|
Redis::ScriptManager executes your Lua scripts in your Redis
|
|
4
4
|
infrastructure while managing trade-offs between bandwidth and
|
|
@@ -103,7 +103,21 @@ Or install it yourself as:
|
|
|
103
103
|
|
|
104
104
|
## Usage
|
|
105
105
|
|
|
106
|
-
|
|
106
|
+
# Configure Redis::ScriptManager from the ENV.
|
|
107
|
+
#
|
|
108
|
+
Redis::ScriptManager.configure do |config|
|
|
109
|
+
config.statsd = $statsd
|
|
110
|
+
config.stats_prefix = 'profile.redis_util.'
|
|
111
|
+
config.do_minify_lua = 'true' == ENV['MY_PREF_MINIFY_LUA']
|
|
112
|
+
config.max_tiny_lua = ENV['MY_PREF_MAGIC_SIZE_LIMIT'] || 512
|
|
113
|
+
config.do_preload = 'true' == ENV['MY_PREF_PRELOADED_SHAS']
|
|
114
|
+
config.preload_cache_size = ENV['MY_PREF_PRELOADED_SHAS_MAX_SIZE']
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# Invoke Redis::ScriptManager.eval_gently just like Redis.eval.
|
|
118
|
+
#
|
|
119
|
+
Redis.eval('return KEYS',keys: ['k1'],argv: ['a1'])
|
|
120
|
+
Redis::ScriptManager.eval_gently('return KEYS',keys: ['k1'],argv: ['a1'])
|
|
107
121
|
|
|
108
122
|
## Development
|
|
109
123
|
|
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
class Redis
|
|
2
2
|
class ScriptManager
|
|
3
3
|
#
|
|
4
|
-
# Version plan:
|
|
4
|
+
# Version plan/history:
|
|
5
5
|
#
|
|
6
|
-
# 0.0.1 -
|
|
6
|
+
# 0.0.1 - Still in Prosperworks/ALI/vendor/gems/redis-script_manager.
|
|
7
7
|
#
|
|
8
|
-
# 0.0.2 -
|
|
8
|
+
# 0.0.2 - Broke out into Prosperworks/redis-script_manager, make public.
|
|
9
9
|
#
|
|
10
|
-
# 0.
|
|
10
|
+
# 0.0.3 - Got .travis.yml working with a live redis-server, some
|
|
11
|
+
# cleanup, added Rubocop.
|
|
11
12
|
#
|
|
12
|
-
# 0.
|
|
13
|
-
#
|
|
13
|
+
# 0.1.0 - (future) Big README.md and Rdoc update, solicit feedback
|
|
14
|
+
# from select external beta users.
|
|
14
15
|
#
|
|
15
|
-
|
|
16
|
+
# 0.2.0 - (future) Incorporate feedback, announce.
|
|
17
|
+
#
|
|
18
|
+
VERSION = '0.0.3'
|
|
16
19
|
end
|
|
17
20
|
end
|
data/lib/redis/script_manager.rb
CHANGED
|
@@ -3,8 +3,6 @@ require "redis/script_manager/version"
|
|
|
3
3
|
class Redis
|
|
4
4
|
class ScriptManager
|
|
5
5
|
|
|
6
|
-
# TODO: rubocop
|
|
7
|
-
|
|
8
6
|
# TODO: rdoc
|
|
9
7
|
|
|
10
8
|
# Efficiently evaluates a Lua script on Redis.
|
|
@@ -26,8 +24,6 @@ class Redis
|
|
|
26
24
|
# @return the return result of evaluating lua against keys and args
|
|
27
25
|
# on redis
|
|
28
26
|
#
|
|
29
|
-
# TODO: Should this just monkey-patch over Redis.eval?
|
|
30
|
-
#
|
|
31
27
|
def self.eval_gently(redis,lua,keys=[],args=[])
|
|
32
28
|
[:eval,:evalsha,:script,:client].each do |method|
|
|
33
29
|
if !redis.respond_to?(method) || !redis.respond_to?(:script)
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: redis-script_manager
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- jhwillett
|
|
@@ -88,9 +88,10 @@ extensions: []
|
|
|
88
88
|
extra_rdoc_files: []
|
|
89
89
|
files:
|
|
90
90
|
- ".gitignore"
|
|
91
|
+
- ".rubocop.yml"
|
|
92
|
+
- ".rubocop_todo.yml"
|
|
91
93
|
- ".travis.yml"
|
|
92
94
|
- Gemfile
|
|
93
|
-
- Gemfile.lock
|
|
94
95
|
- LICENSE
|
|
95
96
|
- README.md
|
|
96
97
|
- Rakefile
|
data/Gemfile.lock
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
redis-script_manager (0.0.2)
|
|
5
|
-
|
|
6
|
-
GEM
|
|
7
|
-
remote: https://rubygems.org/
|
|
8
|
-
specs:
|
|
9
|
-
minitest (5.10.3)
|
|
10
|
-
rake (10.5.0)
|
|
11
|
-
redis (3.3.3)
|
|
12
|
-
redis-namespace (1.5.3)
|
|
13
|
-
redis (~> 3.0, >= 3.0.4)
|
|
14
|
-
|
|
15
|
-
PLATFORMS
|
|
16
|
-
ruby
|
|
17
|
-
|
|
18
|
-
DEPENDENCIES
|
|
19
|
-
bundler (~> 1.14)
|
|
20
|
-
minitest (~> 5.0)
|
|
21
|
-
rake (~> 10.0)
|
|
22
|
-
redis (~> 3.2)
|
|
23
|
-
redis-namespace (~> 1.5)
|
|
24
|
-
redis-script_manager!
|
|
25
|
-
|
|
26
|
-
BUNDLED WITH
|
|
27
|
-
1.15.3
|