restalk 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +1 -1
- data/lib/restalk.rb +14 -2
- metadata +2 -2
data/README.md
CHANGED
data/lib/restalk.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
class Restalk
|
2
2
|
class RestalkBeanstalkException < StandardError; end
|
3
3
|
|
4
|
-
VERSION = '0.1.
|
4
|
+
VERSION = '0.1.4'
|
5
5
|
def initialize(adapter, server=nil, queue=nil)
|
6
6
|
extend BeanstalkAdapter if adapter == :beanstalk
|
7
7
|
extend ResqueAdapter if [:resque, :redis].include? adapter
|
@@ -47,7 +47,19 @@ class Restalk
|
|
47
47
|
def init(server = nil, queue = nil)
|
48
48
|
@queue = queue || ENV['RESQUE_QUEUE'] || 'restalk_queue'
|
49
49
|
require 'resque'
|
50
|
-
|
50
|
+
server = get_redis_object(server || ENV['REDIS'] || 'localhost:6379')
|
51
|
+
Resque.redis = server
|
52
|
+
end
|
53
|
+
|
54
|
+
def get_redis_object(url)
|
55
|
+
return url unless url['@']
|
56
|
+
credentials, url = url.split '@'
|
57
|
+
host, port = url.split ':'
|
58
|
+
username, password = credentials.split ':'
|
59
|
+
Redis.new(:host => host,
|
60
|
+
:port => port,
|
61
|
+
:username => username,
|
62
|
+
:password => password)
|
51
63
|
end
|
52
64
|
|
53
65
|
def push(data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restalk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: beaneater
|