daemon-kit 0.1.8rc3 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +4 -1
- data/README.rdoc +6 -2
- data/daemon-kit.gemspec +3 -3
- data/lib/daemon_kit.rb +4 -3
- data/lib/daemon_kit/cron.rb +5 -2
- data/lib/daemon_kit/initializer.rb +3 -7
- data/lib/generators/daemon_kit/app/templates/Rakefile +1 -1
- data/lib/generators/daemon_kit/app/templates/bin/daemon.tt +1 -1
- data/lib/generators/daemon_kit/app/templates/script/console +1 -1
- data/lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb +6 -1
- data/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake +3 -1
- metadata +9 -11
data/History.txt
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
== 0.1.18
|
1
|
+
== 0.1.18 2010-08-03
|
2
2
|
|
3
3
|
* Generators rewritten to use Thor
|
4
4
|
* Evented XMPP now handled by blather
|
@@ -8,6 +8,9 @@
|
|
8
8
|
* Fix various argument handling bugs
|
9
9
|
* Removed support for exception emails
|
10
10
|
* Improved log rotation support [mperham]
|
11
|
+
* Initial 1.9.2 support
|
12
|
+
* Exception handling for scheduled tasks (cron)
|
13
|
+
* Updates for ruote-amqp versions 2.1 and later
|
11
14
|
|
12
15
|
== 0.1.7.12 2009-12-04
|
13
16
|
|
data/README.rdoc
CHANGED
@@ -66,8 +66,8 @@ The ruote[http://openwfe.rubyforge.org] remote participant generator speeds up t
|
|
66
66
|
|
67
67
|
== Requirements
|
68
68
|
|
69
|
-
* Ruby 1.8.
|
70
|
-
* eventmachine-0.12.
|
69
|
+
* Ruby 1.8.7 or later (developed on REE/1.9.1)
|
70
|
+
* eventmachine-0.12.10[http://rubyeventmachine.com]
|
71
71
|
* rspec (for writing/running your specs)
|
72
72
|
|
73
73
|
== Generator Requirements
|
@@ -94,6 +94,10 @@ Stable versions, when released are available directly from Gemcutter:
|
|
94
94
|
|
95
95
|
$ gem install daemon-kit
|
96
96
|
|
97
|
+
== Upgrading
|
98
|
+
|
99
|
+
When upgrading daemons generated from earlier versions of daemon-kit, it is easier in most cases to re-generate the daemon. Since 0.1.8 the generators use Thor, which allows you to review a diff of each file before deciding to overwrite it.
|
100
|
+
|
97
101
|
== Further reading
|
98
102
|
|
99
103
|
* Configuration.txt
|
data/daemon-kit.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{daemon-kit}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.8"
|
9
9
|
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["kenneth.kalmer@gmail.com"]
|
12
|
-
s.date = %q{2010-08-
|
12
|
+
s.date = %q{2010-08-03}
|
13
13
|
s.default_executable = %q{daemon-kit}
|
14
14
|
s.description = %q{daemon-kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code.}
|
15
15
|
s.email = %q{kenneth.kalmer@gmail.com}
|
data/lib/daemon_kit.rb
CHANGED
@@ -9,11 +9,11 @@ require 'eventmachine'
|
|
9
9
|
require File.dirname(__FILE__) + '/daemon_kit/core_ext'
|
10
10
|
require File.dirname(__FILE__) + '/daemon_kit/exceptions'
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
$LOAD_PATH.unshift( File.dirname(__FILE__).to_absolute_path ) unless
|
13
|
+
$LOAD_PATH.include?( File.dirname(__FILE__).to_absolute_path )
|
14
14
|
|
15
15
|
module DaemonKit
|
16
|
-
VERSION = '0.1.
|
16
|
+
VERSION = '0.1.8'
|
17
17
|
|
18
18
|
autoload :Initializer, 'daemon_kit/initializer'
|
19
19
|
autoload :Application, 'daemon_kit/application'
|
@@ -36,6 +36,7 @@ module DaemonKit
|
|
36
36
|
autoload :XMPP, 'daemon_kit/xmpp'
|
37
37
|
|
38
38
|
class << self
|
39
|
+
|
39
40
|
def logger
|
40
41
|
@logger
|
41
42
|
end
|
data/lib/daemon_kit/cron.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module DaemonKit
|
2
2
|
|
3
3
|
# Thin wrapper around rufus-scheduler gem, specifically designed to ease
|
4
|
-
# configuration of a scheduler and provide some added simplicity.
|
4
|
+
# configuration of a scheduler and provide some added simplicity. It also
|
5
|
+
# logs any exceptions that occur inside the scheduled blocks, ensuring your
|
6
|
+
# code isn't running blind.
|
5
7
|
#
|
6
8
|
# For more information on rufus-scheduler, please visit the RDoc's
|
7
9
|
# at http://rufus.rubyforge.org/rufus-scheduler/
|
@@ -18,15 +20,16 @@ module DaemonKit
|
|
18
20
|
|
19
21
|
class << self
|
20
22
|
|
21
|
-
# Access to the scheduler instance
|
22
23
|
def instance
|
23
24
|
@instance ||= new
|
24
25
|
end
|
25
26
|
|
27
|
+
# Access to the scheduler instance
|
26
28
|
def scheduler
|
27
29
|
instance.scheduler
|
28
30
|
end
|
29
31
|
|
32
|
+
# Define a block for receiving exceptions from inside the scheduler
|
30
33
|
def handle_exception( &block )
|
31
34
|
instance.exception_handler = block
|
32
35
|
end
|
@@ -3,13 +3,9 @@ require 'pathname'
|
|
3
3
|
DAEMON_ENV = (ENV['DAEMON_ENV'] || 'development').dup unless defined?(DAEMON_ENV)
|
4
4
|
|
5
5
|
# Absolute paths to the daemon_kit libraries added to $:
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
else
|
10
|
-
File.expand_path( Pathname.new( incdir ).realpath.to_s )
|
11
|
-
end
|
12
|
-
$:.unshift absincdir unless $:.include?( absincdir )
|
6
|
+
require File.dirname(__FILE__) + '/core_ext'
|
7
|
+
$LOAD_PATH.unshift( File.expand_path('../', __FILE__).to_absolute_path ) unless
|
8
|
+
$LOAD_PATH.include?( File.expand_path('../', __FILE__).to_absolute_path )
|
13
9
|
|
14
10
|
require 'daemon_kit'
|
15
11
|
|
@@ -31,9 +31,14 @@ end
|
|
31
31
|
#end
|
32
32
|
#
|
33
33
|
#DaemonKit::Cron.scheduler.cron "0 22 * * 1-5" do
|
34
|
-
#
|
34
|
+
# DaemonKit.logger.info "activating security system..."
|
35
35
|
# activate_security_system()
|
36
36
|
#end
|
37
|
+
#
|
38
|
+
# Example error handling (NOTE: all exceptions in scheduled tasks are logged)
|
39
|
+
#DaemonKit::Cron.handle_exception do |job, exception|
|
40
|
+
# DaemonKit.logger.error "Caught exception in job #{job.job_id}: '#{exception}'"
|
41
|
+
#end
|
37
42
|
|
38
43
|
DaemonKit::Cron.scheduler.every("1m") do
|
39
44
|
DaemonKit.logger.debug "Scheduled task completed at #{Time.now}"
|
@@ -9,11 +9,13 @@ EOS
|
|
9
9
|
end
|
10
10
|
|
11
11
|
begin
|
12
|
+
require 'spec/rake/spectask'
|
13
|
+
|
12
14
|
desc "Run the specs under spec/"
|
13
15
|
Spec::Rake::SpecTask.new do |t|
|
14
16
|
t.spec_opts = ['--options', "spec/spec.opts"]
|
15
17
|
t.spec_files = FileList['spec/**/*_spec.rb']
|
16
18
|
end
|
17
|
-
rescue NameError
|
19
|
+
rescue NameError, LoadError
|
18
20
|
# No loss, warning printed already
|
19
21
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daemon-kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 8
|
10
|
+
version: 0.1.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- kenneth.kalmer@gmail.com
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-08-
|
18
|
+
date: 2010-08-03 00:00:00 +02:00
|
19
19
|
default_executable: daemon-kit
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -289,14 +289,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
289
289
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
290
290
|
none: false
|
291
291
|
requirements:
|
292
|
-
- - "
|
292
|
+
- - ">="
|
293
293
|
- !ruby/object:Gem::Version
|
294
|
-
hash:
|
294
|
+
hash: 3
|
295
295
|
segments:
|
296
|
-
-
|
297
|
-
|
298
|
-
- 1
|
299
|
-
version: 1.3.1
|
296
|
+
- 0
|
297
|
+
version: "0"
|
300
298
|
requirements: []
|
301
299
|
|
302
300
|
rubyforge_project:
|