beetle 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc
CHANGED
@@ -54,12 +54,11 @@ windows and execute the following commands:
|
|
54
54
|
rake redis:start1
|
55
55
|
rake redis:start2
|
56
56
|
|
57
|
-
|
58
57
|
== Prerequisites
|
59
58
|
|
60
59
|
To set up a redundant messaging system you will need
|
61
60
|
* at least 2 AMQP servers (we use {RabbitMQ}[http://www.rabbitmq.com/])
|
62
|
-
* at least one Redis server (better are two in a master/slave setup)
|
61
|
+
* at least one {Redis}[http://github.com/antirez/redis] server (better are two in a master/slave setup)
|
63
62
|
|
64
63
|
== Gem Dependencies
|
65
64
|
|
@@ -67,15 +66,17 @@ At runtime, Beetle will use
|
|
67
66
|
* {uuid4r}[http://github.com/skaes/uuid4r]
|
68
67
|
(which needs ossp-uuid)
|
69
68
|
* {bunny}[http://github.com/celldee/bunny]
|
70
|
-
* {redis
|
71
|
-
(which needs {redis}[http://github.com/antirez/redis])
|
69
|
+
* {redis}[http://github.com/ezmobius/redis-rb]
|
72
70
|
* {amqp}[http://github.com/tmm1/amqp]
|
73
71
|
(which is based on {eventmachine}[http://github.com/eventmachine/eventmachine])
|
72
|
+
* {daemons}[http://daemons.rubyforge.org/]
|
74
73
|
* activesupport
|
75
74
|
|
76
75
|
For development, you'll need
|
77
|
-
* mocha
|
78
|
-
* rcov
|
76
|
+
* {mocha}[http://github.com/floehopper/mocha]
|
77
|
+
* {rcov}[http://github.com/relevance/rcov]
|
78
|
+
* {cucumber}[http://github.com/aslakhellesoy/cucumber]
|
79
|
+
* {daemon_controller}[http://github.com/FooBarWidget/daemon_controller]
|
79
80
|
|
80
81
|
== Authors
|
81
82
|
|
data/beetle.gemspec
CHANGED
data/lib/beetle/configuration.rb
CHANGED
@@ -4,8 +4,10 @@ module Beetle
|
|
4
4
|
class Configuration
|
5
5
|
# system name (used for redis cluster partitioning) (defaults to <tt>system</tt>)
|
6
6
|
attr_accessor :system_name
|
7
|
-
# default logger (defaults to <tt>Logger.new(
|
7
|
+
# default logger (defaults to <tt>Logger.new(log_file)</tt>)
|
8
8
|
attr_accessor :logger
|
9
|
+
# defaults to <tt>STDOUT</tt>
|
10
|
+
attr_accessor :log_file
|
9
11
|
# number of seconds after which keys are removed form the message deduplication store (defaults to <tt>3.days</tt>)
|
10
12
|
attr_accessor :gc_threshold
|
11
13
|
# the redis server to use for deduplication
|
@@ -49,14 +51,6 @@ module Beetle
|
|
49
51
|
def initialize #:nodoc:
|
50
52
|
self.system_name = "system"
|
51
53
|
|
52
|
-
self.logger = begin
|
53
|
-
logger = Logger.new(STDOUT)
|
54
|
-
logger.formatter = Logger::Formatter.new
|
55
|
-
logger.level = Logger::INFO
|
56
|
-
logger.datetime_format = "%Y-%m-%d %H:%M:%S"
|
57
|
-
logger
|
58
|
-
end
|
59
|
-
|
60
54
|
self.gc_threshold = 3.days
|
61
55
|
self.redis_server = "localhost:6379"
|
62
56
|
self.redis_servers = ""
|
@@ -72,6 +66,8 @@ module Beetle
|
|
72
66
|
self.vhost = "/"
|
73
67
|
self.user = "guest"
|
74
68
|
self.password = "guest"
|
69
|
+
|
70
|
+
self.log_file = STDOUT
|
75
71
|
end
|
76
72
|
|
77
73
|
# setting the external config file will load it on assignment
|
@@ -80,6 +76,16 @@ module Beetle
|
|
80
76
|
load_config
|
81
77
|
end
|
82
78
|
|
79
|
+
def logger
|
80
|
+
@logger ||= begin
|
81
|
+
l = Logger.new(log_file)
|
82
|
+
l.formatter = Logger::Formatter.new
|
83
|
+
l.level = Logger::INFO
|
84
|
+
l.datetime_format = "%Y-%m-%d %H:%M:%S"
|
85
|
+
l
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
83
89
|
private
|
84
90
|
def load_config
|
85
91
|
hash = YAML::load(ERB.new(IO.read(config_file)).result)
|
@@ -1,5 +1,4 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
|
2
|
-
require 'tempfile'
|
3
2
|
|
4
3
|
module Beetle
|
5
4
|
class ConfigurationTest < Test::Unit::TestCase
|
@@ -13,5 +12,19 @@ module Beetle
|
|
13
12
|
config.config_file = "some/path/to/a/file"
|
14
13
|
assert_equal new_value, config.gc_threshold
|
15
14
|
end
|
15
|
+
|
16
|
+
test "should log to STDOUT if no log_file given" do
|
17
|
+
config = Configuration.new
|
18
|
+
Logger.expects(:new).with(STDOUT).returns(stub_everything)
|
19
|
+
config.logger
|
20
|
+
end
|
21
|
+
|
22
|
+
test "should log to file if log_file given" do
|
23
|
+
file = '/path/to/file'
|
24
|
+
config = Configuration.new
|
25
|
+
config.log_file = file
|
26
|
+
Logger.expects(:new).with(file).returns(stub_everything)
|
27
|
+
config.logger
|
28
|
+
end
|
16
29
|
end
|
17
30
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: beetle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 3
|
10
|
+
version: 0.2.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Stefan Kaes
|
@@ -18,7 +18,7 @@ autorequire:
|
|
18
18
|
bindir: bin
|
19
19
|
cert_chain: []
|
20
20
|
|
21
|
-
date: 2010-07-
|
21
|
+
date: 2010-07-27 00:00:00 +02:00
|
22
22
|
default_executable: beetle
|
23
23
|
dependencies:
|
24
24
|
- !ruby/object:Gem::Dependency
|