allora 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -0
- data/lib/allora/scheduler.rb +9 -1
- data/lib/allora/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -20,6 +20,11 @@ a job at midnight and the process is stopped at 23:59, then restarted at 00:01,
|
|
20
20
|
midnight job will still run. Reentry is smart, however: it catches back up as soon
|
21
21
|
as it has processed any overdue jobs (so it doesn't get stuck in the past).
|
22
22
|
|
23
|
+
## Minimum Requirements
|
24
|
+
|
25
|
+
- ruby >= 1.9
|
26
|
+
- redis >= 1.3 (only if using the redis backend)
|
27
|
+
|
23
28
|
## Installation
|
24
29
|
|
25
30
|
Via rubygems:
|
@@ -52,6 +57,8 @@ probably shouldn't be run on multiple machines.
|
|
52
57
|
In the following example, we specify to use a Redis backend, which is safe to run on
|
53
58
|
multiple machines:
|
54
59
|
|
60
|
+
require "redis"
|
61
|
+
|
55
62
|
Allora.start(:backend => :redis, :host => "redis.lan", :join => true) do |s|
|
56
63
|
# a job that runs hourly
|
57
64
|
s.add("empty_cache", :every => 1.hour) { `rm -f /path/to/cache/*` }
|
@@ -62,6 +69,9 @@ multiple machines:
|
|
62
69
|
|
63
70
|
We specify a redis host (and port) so that schedule data can be shared.
|
64
71
|
|
72
|
+
Note that you must load redis yourself. Allora does not directly depend on it, so that users
|
73
|
+
may choose not to use it.
|
74
|
+
|
65
75
|
## Accessing your application environment
|
66
76
|
|
67
77
|
Allora will not make any assumptions about your application. It is your responsibility
|
data/lib/allora/scheduler.rb
CHANGED
@@ -42,7 +42,7 @@ module Allora
|
|
42
42
|
|
43
43
|
@backend = create_backend(opts)
|
44
44
|
@interval = opts.fetch(:interval, 0.333)
|
45
|
-
@logger = opts.fetch(:logger,
|
45
|
+
@logger = opts.fetch(:logger, default_logger)
|
46
46
|
@jobs = {}
|
47
47
|
end
|
48
48
|
|
@@ -128,5 +128,13 @@ module Allora
|
|
128
128
|
def log(str)
|
129
129
|
@logger.info("Allora: #{str}") if @logger
|
130
130
|
end
|
131
|
+
|
132
|
+
def default_logger
|
133
|
+
Logger.new(STDOUT).tap do |logger|
|
134
|
+
logger.formatter = proc do |severity, datetime, progname, msg|
|
135
|
+
"#{datetime}: #{msg}\n"
|
136
|
+
end
|
137
|
+
end
|
138
|
+
end
|
131
139
|
end
|
132
140
|
end
|
data/lib/allora/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: allora
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-03-13 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
16
|
-
requirement: &
|
16
|
+
requirement: &70230789646860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,7 +21,7 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70230789646860
|
25
25
|
description: ! "Allora (Italian for \"at that time\") provides a replacement for the
|
26
26
|
classic UNIX\n cron, using nothing but ruby. It is very small,
|
27
27
|
easy to follow and relatively\n feature-light. It does support
|