rackdis 0.12.pre.beta → 0.13.pre.beta
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/README.md +3 -5
- data/lib/rackdis/api.rb +2 -2
- data/lib/rackdis/redis_facade.rb +3 -6
- data/lib/rackdis/version.rb +1 -1
- data/lib/rackdis.rb +10 -0
- data/rackdis.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a9bd040fb693bdb802156db1b45b53441db94b83
|
4
|
+
data.tar.gz: 57d16ec524fd6e457d10d8c5a65566611ba552b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5bda607afe98869d81a1ce26af8770196eba8a7971ed4e711fdc94e88140c7f63055fe09338e1f31c5c1ea8d0b82387e2c3153e889deb16fc0a7fccd9063a7d
|
7
|
+
data.tar.gz: 2828c0d819da0e2c2423eb6e87f17bc8ea360b295ea263ff42f044d1610fb080ede747546851f3b3a424e8b4e048db02c3c75db5a4650494bbf0c3cf7012c9a9
|
data/README.md
CHANGED
@@ -37,12 +37,10 @@ Most commands should work, there are a few left unsupported. However this code i
|
|
37
37
|
|
38
38
|
## Installation
|
39
39
|
|
40
|
-
**Sorry I haven't actually pushed it to rubygems yet**
|
41
|
-
|
42
40
|
Add this line to your application's Gemfile:
|
43
41
|
|
44
42
|
```ruby
|
45
|
-
gem 'rackdis'
|
43
|
+
gem 'rackdis', '~> 0.12.pre.beta'
|
46
44
|
```
|
47
45
|
|
48
46
|
And then execute:
|
@@ -51,7 +49,7 @@ And then execute:
|
|
51
49
|
|
52
50
|
Or install it yourself as:
|
53
51
|
|
54
|
-
$ gem install rackdis
|
52
|
+
$ gem install rackdis --pre
|
55
53
|
|
56
54
|
## Usage
|
57
55
|
|
@@ -74,7 +72,7 @@ Usage: rackdis [options]
|
|
74
72
|
-h, --help Display this help message.
|
75
73
|
```
|
76
74
|
|
77
|
-
All of these commands are optional. The hard coded configuration has sane defaults. Specifying a configuration file would override those defaults. Specifying a command line options from above overrides everything. Speaking of configuration files, here's what one looks like:
|
75
|
+
All of these commands are optional. The hard coded configuration has sane defaults. Specifying a configuration file would override those defaults. Specifying a command line options from above overrides everything. Speaking of configuration files, here's what one looks like (with the aforementioned sane defaults specified):
|
78
76
|
|
79
77
|
```yml
|
80
78
|
---
|
data/lib/rackdis/api.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
module Rackdis
|
2
2
|
class API < Grape::API
|
3
3
|
|
4
|
-
|
5
4
|
rescue_from :all do |e|
|
6
5
|
Rackdis.logger.error("#{e.class.name}: #{e.message}")
|
6
|
+
Rackdis.log_backtrace(e)
|
7
7
|
Rack::Response.new({ success: false, error: e.message }.to_json, 500)
|
8
8
|
end
|
9
9
|
|
@@ -59,4 +59,4 @@ module Rackdis
|
|
59
59
|
redis.call params[:command], args
|
60
60
|
end
|
61
61
|
end
|
62
|
-
end
|
62
|
+
end
|
data/lib/rackdis/redis_facade.rb
CHANGED
@@ -10,6 +10,7 @@ module Rackdis
|
|
10
10
|
|
11
11
|
def call(command, args)
|
12
12
|
command.downcase!
|
13
|
+
command = command.to_sym
|
13
14
|
valid_command! command
|
14
15
|
|
15
16
|
@log.info("redis> #{command} #{args.join(' ')}")
|
@@ -17,11 +18,7 @@ module Rackdis
|
|
17
18
|
|
18
19
|
@log.debug("API => REDIS: "+{command: command, args: args}.inspect)
|
19
20
|
|
20
|
-
|
21
|
-
result = @redis.send(command, *args)
|
22
|
-
rescue ArgumentError
|
23
|
-
raise NotImplementedError, "Oops sorry - too beta - this needs fixing. A bug report at https://github.com/penguinpowernz/rackdis/issues would be nice :)"
|
24
|
-
end
|
21
|
+
result = @redis.send(command, *args)
|
25
22
|
|
26
23
|
return Rackdis::ResponseBuilder.new(command).process(args, result)
|
27
24
|
end
|
@@ -69,7 +66,7 @@ module Rackdis
|
|
69
66
|
private
|
70
67
|
|
71
68
|
def valid_command!(cmd)
|
72
|
-
raise ArgumentError, "Unsupported command: #{
|
69
|
+
raise ArgumentError, "Unsupported command: #{cmd}" unless valid_command?(cmd)
|
73
70
|
end
|
74
71
|
|
75
72
|
def valid_command?(cmd)
|
data/lib/rackdis/version.rb
CHANGED
data/lib/rackdis.rb
CHANGED
@@ -72,5 +72,15 @@ module Rackdis
|
|
72
72
|
|
73
73
|
logger
|
74
74
|
end
|
75
|
+
|
76
|
+
# Print each line from the backtrace if log
|
77
|
+
# level is set to debug
|
78
|
+
def log_backtrace(error)
|
79
|
+
if Rackdis.logger.debug?
|
80
|
+
error.backtrace.each do |line|
|
81
|
+
Rackdis.logger.debug(line)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
75
85
|
end
|
76
86
|
end
|
data/rackdis.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency "rack-stream"
|
26
26
|
spec.add_dependency "em-synchrony"
|
27
27
|
spec.add_dependency "slop"
|
28
|
-
spec.add_dependency "thin"
|
28
|
+
spec.add_dependency "thin", "~> 1.6.2"
|
29
29
|
spec.add_dependency "rack-cors"
|
30
30
|
|
31
31
|
spec.add_development_dependency "bundler", "~> 1.7"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rackdis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.13.pre.beta
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert McLeod
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-11-
|
11
|
+
date: 2014-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -112,16 +112,16 @@ dependencies:
|
|
112
112
|
name: thin
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- - "
|
115
|
+
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 1.6.2
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- - "
|
122
|
+
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 1.6.2
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rack-cors
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|