datalogger-redis 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/datalogger-redis.gemspec +2 -2
- data/lib/datalogger/sinks/redis.rb +3 -0
- data/lib/datalogger/sinks/redis/list.rb +20 -0
- data/lib/datalogger/sinks/redis/pubsub.rb +20 -0
- data/lib/datalogger/sinks/redis/version.rb +7 -0
- metadata +11 -11
- data/lib/datalogger/redis.rb +0 -3
- data/lib/datalogger/redis/list_sink.rb +0 -20
- data/lib/datalogger/redis/pubsub_sink.rb +0 -20
- data/lib/datalogger/redis/version.rb +0 -5
data/datalogger-redis.gemspec
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
|
-
require File.expand_path('../lib/datalogger/redis/version', __FILE__)
|
2
|
+
require File.expand_path('../lib/datalogger/sinks/redis/version', __FILE__)
|
3
3
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.authors = ["Michael Gorsuch"]
|
@@ -13,7 +13,7 @@ Gem::Specification.new do |gem|
|
|
13
13
|
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
14
14
|
gem.name = "datalogger-redis"
|
15
15
|
gem.require_paths = ["lib"]
|
16
|
-
gem.version = DataLogger::Redis::VERSION
|
16
|
+
gem.version = DataLogger::Sinks::Redis::VERSION
|
17
17
|
gem.add_dependency('datalogger')
|
18
18
|
gem.add_dependency('json')
|
19
19
|
gem.add_dependency('redis')
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'redis'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module DataLogger
|
6
|
+
module Sinks
|
7
|
+
class RedisList
|
8
|
+
def initialize(opts={})
|
9
|
+
redis_url = opts[:redis_url] || "redis://localhost:6379"
|
10
|
+
uri = URI.parse(redis_url)
|
11
|
+
@redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
|
12
|
+
@list = opts[:list] || 'logs'
|
13
|
+
end
|
14
|
+
|
15
|
+
def log(component, data)
|
16
|
+
@redis.rpush @list, data.merge(component: component).to_json
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'redis'
|
3
|
+
require 'uri'
|
4
|
+
|
5
|
+
module DataLogger
|
6
|
+
module Sinks
|
7
|
+
class RedisPubSub
|
8
|
+
def initialize(opts={})
|
9
|
+
redis_url = opts[:redis_url] || "redis://localhost:6379"
|
10
|
+
uri = URI.parse(redis_url)
|
11
|
+
@redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
|
12
|
+
@channel = opts[:channel] || 'logs'
|
13
|
+
end
|
14
|
+
|
15
|
+
def log(component, data)
|
16
|
+
@redis.publish @channel, data.merge(component: component).to_json
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: datalogger-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-21 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: datalogger
|
16
|
-
requirement: &
|
16
|
+
requirement: &70106376677200 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70106376677200
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70106376676420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70106376676420
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: redis
|
38
|
-
requirement: &
|
38
|
+
requirement: &70106376675920 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70106376675920
|
47
47
|
description: A DataLogger data sink to Redis
|
48
48
|
email:
|
49
49
|
- michael.gorsuch@gmail.com
|
@@ -56,10 +56,10 @@ files:
|
|
56
56
|
- Rakefile
|
57
57
|
- Readme.md
|
58
58
|
- datalogger-redis.gemspec
|
59
|
-
- lib/datalogger/redis.rb
|
60
|
-
- lib/datalogger/redis/
|
61
|
-
- lib/datalogger/redis/
|
62
|
-
- lib/datalogger/redis/version.rb
|
59
|
+
- lib/datalogger/sinks/redis.rb
|
60
|
+
- lib/datalogger/sinks/redis/list.rb
|
61
|
+
- lib/datalogger/sinks/redis/pubsub.rb
|
62
|
+
- lib/datalogger/sinks/redis/version.rb
|
63
63
|
homepage: ''
|
64
64
|
licenses: []
|
65
65
|
post_install_message:
|
data/lib/datalogger/redis.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'redis'
|
3
|
-
require 'uri'
|
4
|
-
|
5
|
-
module DataLogger
|
6
|
-
class RedisListSink
|
7
|
-
VERSION='0.0.1'
|
8
|
-
|
9
|
-
def initialize(opts={})
|
10
|
-
redis_url = opts[:redis_url] || "redis://localhost:6379"
|
11
|
-
uri = URI.parse(redis_url)
|
12
|
-
@redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
|
13
|
-
@list = opts[:list] || 'logs'
|
14
|
-
end
|
15
|
-
|
16
|
-
def log(component, data)
|
17
|
-
@redis.rpush @list, data.merge(component: component).to_json
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
@@ -1,20 +0,0 @@
|
|
1
|
-
require 'json'
|
2
|
-
require 'redis'
|
3
|
-
require 'uri'
|
4
|
-
|
5
|
-
module DataLogger
|
6
|
-
class RedisPubSubSink
|
7
|
-
VERSION='0.0.1'
|
8
|
-
|
9
|
-
def initialize(opts={})
|
10
|
-
redis_url = opts[:redis_url] || "redis://localhost:6379"
|
11
|
-
uri = URI.parse(redis_url)
|
12
|
-
@redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
|
13
|
-
@channel = opts[:channel] || 'logs'
|
14
|
-
end
|
15
|
-
|
16
|
-
def log(component, data)
|
17
|
-
@redis.publish @channel, data.merge(component: component).to_json
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|