daemon-kit 0.1.7.12 → 0.1.8pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (144) hide show
  1. data/History.txt +7 -0
  2. data/Manifest.txt +4 -0
  3. data/README.rdoc +11 -9
  4. data/Rakefile +0 -1
  5. data/TODO.txt +1 -2
  6. data/bin/daemon-kit +11 -11
  7. data/daemon-kit.gemspec +109 -78
  8. data/lib/daemon_kit.rb +7 -10
  9. data/lib/daemon_kit/abstract_logger.rb +22 -14
  10. data/lib/daemon_kit/application.rb +0 -1
  11. data/lib/daemon_kit/arguments.rb +1 -6
  12. data/lib/daemon_kit/commands/destroy.rb +10 -0
  13. data/lib/daemon_kit/commands/generate.rb +10 -0
  14. data/lib/daemon_kit/config.rb +7 -2
  15. data/lib/daemon_kit/generators.rb +67 -0
  16. data/lib/daemon_kit/generators/base.rb +60 -0
  17. data/lib/daemon_kit/initializer.rb +1 -1
  18. data/lib/daemon_kit/jabber.rb +1 -0
  19. data/lib/daemon_kit/tasks/framework.rake +6 -1
  20. data/lib/daemon_kit/vendor/thor-0.12.3/CHANGELOG.rdoc +80 -0
  21. data/lib/daemon_kit/vendor/thor-0.12.3/LICENSE +20 -0
  22. data/lib/daemon_kit/vendor/thor-0.12.3/README.rdoc +234 -0
  23. data/lib/daemon_kit/vendor/thor-0.12.3/Thorfile +64 -0
  24. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor.rb +242 -0
  25. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions.rb +274 -0
  26. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/create_file.rb +103 -0
  27. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/directory.rb +91 -0
  28. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/empty_directory.rb +134 -0
  29. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/file_manipulation.rb +223 -0
  30. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/inject_into_file.rb +101 -0
  31. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/base.rb +515 -0
  32. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/file_binary_read.rb +9 -0
  33. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  34. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/ordered_hash.rb +100 -0
  35. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/error.rb +27 -0
  36. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/group.rb +271 -0
  37. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/invocation.rb +178 -0
  38. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser.rb +4 -0
  39. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/argument.rb +67 -0
  40. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/arguments.rb +145 -0
  41. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/option.rb +132 -0
  42. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/options.rb +142 -0
  43. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/rake_compat.rb +66 -0
  44. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/runner.rb +303 -0
  45. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell.rb +78 -0
  46. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell/basic.rb +239 -0
  47. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell/color.rb +108 -0
  48. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/task.rb +111 -0
  49. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/util.rb +233 -0
  50. data/lib/daemon_kit/vendor/thor-0.12.3/lib/thor/version.rb +3 -0
  51. data/lib/daemon_kit/xmpp.rb +75 -6
  52. data/{daemon_generators → lib/generators/daemon_kit}/amqp/USAGE +0 -0
  53. data/lib/generators/daemon_kit/amqp/amqp_generator.rb +24 -0
  54. data/{daemon_generators → lib/generators/daemon_kit}/amqp/templates/config/amqp.yml +0 -0
  55. data/{daemon_generators/amqp/templates/config/initializers → lib/generators/daemon_kit/amqp/templates/config/pre-daemonize}/amqp.rb +0 -0
  56. data/{daemon_generators/amqp/templates/libexec/daemon.rb → lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb} +0 -0
  57. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/USAGE +0 -0
  58. data/lib/generators/daemon_kit/app/app_generator.rb +140 -0
  59. data/lib/generators/daemon_kit/app/templates/Gemfile +8 -0
  60. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/README +0 -0
  61. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/Rakefile +0 -0
  62. data/lib/generators/daemon_kit/app/templates/bin/daemon.tt +7 -0
  63. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/arguments.rb +0 -0
  64. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/boot.rb +10 -3
  65. data/{app_generators/daemon_kit/templates/config/environment.rb → lib/generators/daemon_kit/app/templates/config/environment.rb.tt} +1 -1
  66. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/environments/development.rb +0 -0
  67. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/environments/production.rb +0 -0
  68. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/environments/test.rb +0 -0
  69. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/post-daemonize/readme +0 -0
  70. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/config/pre-daemonize/readme +0 -0
  71. data/{app_generators/daemon_kit/templates/lib/daemon.rb → lib/generators/daemon_kit/app/templates/lib/%app_name%.rb} +0 -0
  72. data/{app_generators/daemon_kit/templates/libexec/daemon.erb → lib/generators/daemon_kit/app/templates/libexec/%app_name%-daemon.rb} +0 -0
  73. data/{app_generators/daemon_kit → lib/generators/daemon_kit/app}/templates/script/console +0 -0
  74. data/lib/generators/daemon_kit/app/templates/script/destroy +2 -0
  75. data/lib/generators/daemon_kit/app/templates/script/generate +2 -0
  76. data/lib/generators/daemon_kit/capistrano/capistrano_generator.rb +21 -0
  77. data/{daemon_generators/deploy_capistrano → lib/generators/daemon_kit/capistrano}/templates/Capfile +0 -0
  78. data/{daemon_generators/deploy_capistrano → lib/generators/daemon_kit/capistrano}/templates/USAGE +0 -0
  79. data/{daemon_generators/deploy_capistrano/templates/config/deploy.rb → lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt} +1 -1
  80. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/production.rb.tt +6 -0
  81. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/staging.rb.tt +6 -0
  82. data/{daemon_generators/deploy_capistrano → lib/generators/daemon_kit/capistrano}/templates/config/environments/staging.rb +0 -0
  83. data/{daemon_generators → lib/generators/daemon_kit}/cron/USAGE +0 -0
  84. data/lib/generators/daemon_kit/cron/cron_generator.rb +24 -0
  85. data/{daemon_generators/cron/templates/config/initializers → lib/generators/daemon_kit/cron/templates/config/pre-daemonize}/cron.rb +0 -0
  86. data/{daemon_generators/cron/templates/libexec/daemon.rb → lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb} +0 -0
  87. data/{daemon_generators → lib/generators/daemon_kit}/cucumber/USAGE +0 -0
  88. data/lib/generators/daemon_kit/cucumber/cucumber_generator.rb +45 -0
  89. data/{daemon_generators/cucumber/templates/cucumber_environment.rb → lib/generators/daemon_kit/cucumber/templates/config/environments/cucumber.rb} +0 -0
  90. data/lib/generators/daemon_kit/cucumber/templates/features/step_definitions/.empty_directory +0 -0
  91. data/{daemon_generators/cucumber/templates → lib/generators/daemon_kit/cucumber/templates/features/support}/env.rb +0 -0
  92. data/{daemon_generators/cucumber/templates → lib/generators/daemon_kit/cucumber/templates/script}/cucumber +1 -2
  93. data/{daemon_generators/cucumber/templates → lib/generators/daemon_kit/cucumber/templates/tasks}/cucumber.rake +0 -0
  94. data/{daemon_generators/jabber → lib/generators/daemon_kit/nanite_agent}/USAGE +0 -0
  95. data/lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb +29 -0
  96. data/{daemon_generators → lib/generators/daemon_kit}/nanite_agent/templates/config/nanite.yml +0 -0
  97. data/{daemon_generators/nanite_agent/templates/config/initializers → lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize}/nanite_agent.rb +0 -0
  98. data/{daemon_generators → lib/generators/daemon_kit}/nanite_agent/templates/lib/actors/sample.rb +0 -0
  99. data/{daemon_generators/nanite_agent/templates/libexec/daemon.rb → lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb} +0 -0
  100. data/{daemon_generators/nanite_agent → lib/generators/daemon_kit/rspec}/USAGE +0 -0
  101. data/lib/generators/daemon_kit/rspec/rspec_generator.rb +20 -0
  102. data/{daemon_generators/rspec/templates/spec.rb → lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb} +0 -0
  103. data/{daemon_generators → lib/generators/daemon_kit}/rspec/templates/spec/spec.opts +0 -0
  104. data/{daemon_generators → lib/generators/daemon_kit}/rspec/templates/spec/spec_helper.rb +0 -0
  105. data/{daemon_generators → lib/generators/daemon_kit}/rspec/templates/tasks/rspec.rake +0 -0
  106. data/{daemon_generators/rspec → lib/generators/daemon_kit/ruote}/USAGE +0 -0
  107. data/lib/generators/daemon_kit/ruote/ruote_generator.rb +29 -0
  108. data/{daemon_generators → lib/generators/daemon_kit}/ruote/templates/config/amqp.yml +0 -0
  109. data/{daemon_generators/ruote/templates/config/initializers → lib/generators/daemon_kit/ruote/templates/config/pre-daemonize}/ruote.rb +0 -0
  110. data/{daemon_generators → lib/generators/daemon_kit}/ruote/templates/config/ruote.yml +0 -0
  111. data/{daemon_generators/ruote/templates/lib/daemon.rb → lib/generators/daemon_kit/ruote/templates/lib/%app_name%.rb} +0 -0
  112. data/{daemon_generators → lib/generators/daemon_kit}/ruote/templates/lib/sample.rb +0 -0
  113. data/{daemon_generators/ruote/templates/libexec/daemon.rb → lib/generators/daemon_kit/ruote/templates/libexec/%app_name%-daemon.rb} +0 -0
  114. data/{daemon_generators/ruote → lib/generators/daemon_kit/test_unit}/USAGE +0 -0
  115. data/{daemon_generators → lib/generators/daemon_kit}/test_unit/templates/tasks/test_unit.rake +0 -0
  116. data/{daemon_generators/test_unit/templates/test/test.rb → lib/generators/daemon_kit/test_unit/templates/test/%app_name%_test.rb.tt} +1 -1
  117. data/{daemon_generators → lib/generators/daemon_kit}/test_unit/templates/test/test_helper.rb +0 -0
  118. data/lib/generators/daemon_kit/test_unit/test_unit_generator.rb +20 -0
  119. data/lib/generators/daemon_kit/xmpp/templates/config/pre-daemonize/xmpp.rb +6 -0
  120. data/{daemon_generators/jabber/templates/config/jabber.yml → lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml} +5 -2
  121. data/lib/generators/daemon_kit/xmpp/templates/libexec/%app_name%-daemon.rb +27 -0
  122. data/lib/generators/daemon_kit/xmpp/xmpp_generator.rb +24 -0
  123. data/spec/argument_spec.rb +1 -1
  124. data/spec/config_spec.rb +7 -3
  125. metadata +110 -86
  126. data/app_generators/daemon_kit/daemon_kit_generator.rb +0 -178
  127. data/app_generators/daemon_kit/templates/bin/daemon.erb +0 -7
  128. data/app_generators/daemon_kit/templates/script/destroy +0 -14
  129. data/app_generators/daemon_kit/templates/script/generate +0 -14
  130. data/daemon_generators/amqp/amqp_generator.rb +0 -65
  131. data/daemon_generators/cron/cron_generator.rb +0 -64
  132. data/daemon_generators/cucumber/cucumber_generator.rb +0 -38
  133. data/daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb +0 -35
  134. data/daemon_generators/deploy_capistrano/templates/config/deploy/production.rb +0 -6
  135. data/daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb +0 -6
  136. data/daemon_generators/jabber/jabber_generator.rb +0 -65
  137. data/daemon_generators/jabber/templates/config/initializers/jabber.rb +0 -7
  138. data/daemon_generators/jabber/templates/libexec/daemon.rb +0 -27
  139. data/daemon_generators/nanite_agent/nanite_agent_generator.rb +0 -68
  140. data/daemon_generators/rspec/rspec_generator.rb +0 -55
  141. data/daemon_generators/ruote/ruote_generator.rb +0 -67
  142. data/daemon_generators/test_unit/USAGE +0 -5
  143. data/daemon_generators/test_unit/test_unit_generator.rb +0 -51
  144. data/test/test_jabber_generator.rb +0 -49
data/History.txt CHANGED
@@ -1,3 +1,10 @@
1
+ == 0.1.18 (WIP)
2
+
3
+ * Generators rewritten to use Thor
4
+ * Evented XMPP now handled by blather
5
+ * Boot script fixes
6
+ * Removed Jabber generator, deprecating Jabber class (use XMPP)
7
+
1
8
  == 0.1.7.12 2009-12-04
2
9
 
3
10
  * Bug fix, don't load environment files twice [grockit]
data/Manifest.txt CHANGED
@@ -79,6 +79,10 @@ daemon_generators/test_unit/templates/tasks/test_unit.rake
79
79
  daemon_generators/test_unit/templates/test/test.rb
80
80
  daemon_generators/test_unit/templates/test/test_helper.rb
81
81
  daemon_generators/test_unit/test_unit_generator.rb
82
+ daemon_generators/xmpp/templates/config/initializers/xmpp.rb
83
+ daemon_generators/xmpp/templates/config/xmpp.yml
84
+ daemon_generators/xmpp/templates/libexec/daemon.rb
85
+ daemon_generators/xmpp/xmpp_generator.rb
82
86
  lib/daemon_kit.rb
83
87
  lib/daemon_kit/abstract_logger.rb
84
88
  lib/daemon_kit/amqp.rb
data/README.rdoc CHANGED
@@ -13,7 +13,7 @@ Using simple built-in generators it is easy to created evented and non-evented d
13
13
 
14
14
  Supported generators:
15
15
 
16
- * XMPP bot (non-evented)
16
+ * XMPP bot (evented)
17
17
  * AMQP consumer (evented)
18
18
  * Nanite agent
19
19
  * Cron-style daemon
@@ -34,19 +34,19 @@ Get some help
34
34
 
35
35
  The above command generates a skeleton daemon environment for you to adapt.
36
36
 
37
- $ daemon-kit [/path/to/your/daemon] -i jabber
37
+ $ daemon-kit [/path/to/your/daemon] -i xmpp
38
38
 
39
- Use the 'jabber' generator instead of the default one.
39
+ Use the 'xmpp' generator instead of the default one.
40
40
 
41
41
  == Generators
42
42
 
43
- Currently six generators exist: default, jabber, amqp, cron, nanite & ruote
43
+ Currently six generators exist: default, xmpp, amqp, cron, nanite & ruote
44
44
 
45
45
  The default generator creates a simple daemon with an infinite loop inside that you can adapt.
46
46
 
47
- === Jabber Generator
47
+ === XMPP Generator
48
48
 
49
- The jabber generator creates a simple daemon that leverages the xmpp4r-simple[http://xmpp4r-simple.rubyforge.org/] gem to process inbound messages. The daemon will manage the roster and other little tasks, leaving you to provide the hooks for processing messages, presence notifications and subscription request.
49
+ The jabber generator creates a simple daemon that leverages the blather[http://blather.squishtech.com/] gem to process inbound messages. The daemon will manage the roster and other little tasks, leaving you to provide the hooks for processing messages, presence notifications and subscription request.
50
50
 
51
51
  === Cron Generator
52
52
 
@@ -66,7 +66,7 @@ The ruote[http://openwfe.rubyforge.org] remote participant generator speeds up t
66
66
 
67
67
  == Requirements
68
68
 
69
- * Ruby 1.8.6
69
+ * Ruby 1.8.6 or later (developed on 1.9.1)
70
70
  * eventmachine-0.12.8[http://rubyeventmachine.com]
71
71
  * rspec (for writing/running your specs)
72
72
 
@@ -74,18 +74,20 @@ The ruote[http://openwfe.rubyforge.org] remote participant generator speeds up t
74
74
 
75
75
  Depending on the generator you choose for your daemon, it might require additional gems to run.
76
76
 
77
- * jabber - xmpp4r-simple[http://xmpp4r-simple.rubyforge.org]
77
+ * xmpp - blather[http://blather.squishtech.com/]
78
78
  * cron - rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] (at least version 2.0.0)
79
79
  * amqp - amqp[http://github.com/tmm1/amqp]
80
80
  * nanite - nanite[http://github.com/ezmobius/nanite]
81
81
  * ruote - none, although ruote[http://openwfe.rubyforge.org] should probably be running somewhere
82
82
 
83
+ The generators are all written using Thor[http://rdoc.info/rdoc/wycats/thor], which is bundled with daemon-kit and not needed for running any of the generators.
84
+
83
85
  == Install
84
86
 
85
87
  Currently recommended to stick to the git repo:
86
88
 
87
89
  $ git clone git://github.com/kennethkalmer/daemon-kit.git
88
- $ rake gem
90
+ $ rake build
89
91
  $ gem install pkg/daemon-kit-X.X.X.gem
90
92
 
91
93
  Stable versions, when released are available directly from Gemcutter:
data/Rakefile CHANGED
@@ -16,7 +16,6 @@ begin
16
16
  gemspec.extra_rdoc_files.include '*.txt'
17
17
 
18
18
  gemspec.add_dependency 'eventmachine', '>=0.12.8'
19
- gemspec.add_dependency 'rubigen', '>=1.5.2'
20
19
  gemspec.add_development_dependency 'rspec'
21
20
  gemspec.add_development_dependency 'cucumber'
22
21
  end
data/TODO.txt CHANGED
@@ -11,10 +11,9 @@ This is purely a drop in the bucket of what has to come...
11
11
  * Support for custom error handlers in the project
12
12
  * Easy configuration of an ORM of choice, including patching it if needed (ActiveRecord *cough*)
13
13
  * Improved generators for creating skeleton daemons:
14
- * Evented jabber bot
15
14
  * Empty periodic event loop
16
15
  * Empty periodic loop (non-evented)
17
- * Queue (SQS, AMQP, etc) pollers
16
+ * Queue (SQS, etc) pollers
18
17
  * Rake tasks for generating:
19
18
  * Sys-V style init scripts
20
19
  * Plenty of docs, seriously a lot of docs
data/bin/daemon-kit CHANGED
@@ -1,18 +1,18 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require 'rubygems'
4
- require 'rubigen'
3
+ begin
4
+ require 'daemon_kit'
5
+ rescue LoadError
6
+ $:.unshift File.expand_path( '../../lib', __FILE__ )
7
+ require 'daemon_kit'
8
+ end
5
9
 
6
10
  if %w(-v --version).include? ARGV.first
7
- require 'daemon_kit'
8
- puts "#{File.basename($0)} #{DaemonKit::VERSION}"
11
+ puts "#{File.basename($0)} #{DaemonKit::VERSION} (http://github.com/kennethkalmer/daemon-kit)"
9
12
  exit(0)
10
13
  end
11
14
 
12
- require 'rubigen/scripts/generate'
13
- RubiGen::Base.use_application_sources! :rubygems
14
- RubiGen::Base.prepend_sources(*[
15
- RubiGen::PathSource.new(:app, File.join(File.dirname(__FILE__), "..", "app_generators")),
16
- RubiGen::PathSource.new(:app, File.join(File.dirname(__FILE__), "..", "daemon_generators"))
17
- ])
18
- RubiGen::Scripts::Generate.new.run(ARGV, :generator => 'daemon_kit')
15
+ require 'daemon_kit/generators'
16
+ require 'generators/daemon_kit/app/app_generator'
17
+
18
+ DaemonKit::Generators::AppGenerator.start
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.7.12"
8
+ s.version = "0.1.8pre"
9
9
 
10
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
10
+ s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["kenneth.kalmer@gmail.com"]
12
- s.date = %q{2009-12-04}
12
+ s.date = %q{2010-02-05}
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}
@@ -37,85 +37,17 @@ Gem::Specification.new do |s|
37
37
  "Rakefile",
38
38
  "RuoteParticipants.txt",
39
39
  "TODO.txt",
40
- "app_generators/daemon_kit/USAGE",
41
- "app_generators/daemon_kit/daemon_kit_generator.rb",
42
- "app_generators/daemon_kit/templates/README",
43
- "app_generators/daemon_kit/templates/Rakefile",
44
- "app_generators/daemon_kit/templates/bin/daemon.erb",
45
- "app_generators/daemon_kit/templates/config/arguments.rb",
46
- "app_generators/daemon_kit/templates/config/boot.rb",
47
- "app_generators/daemon_kit/templates/config/environment.rb",
48
- "app_generators/daemon_kit/templates/config/environments/development.rb",
49
- "app_generators/daemon_kit/templates/config/environments/production.rb",
50
- "app_generators/daemon_kit/templates/config/environments/test.rb",
51
- "app_generators/daemon_kit/templates/config/post-daemonize/readme",
52
- "app_generators/daemon_kit/templates/config/pre-daemonize/readme",
53
- "app_generators/daemon_kit/templates/lib/daemon.rb",
54
- "app_generators/daemon_kit/templates/libexec/daemon.erb",
55
- "app_generators/daemon_kit/templates/script/console",
56
- "app_generators/daemon_kit/templates/script/destroy",
57
- "app_generators/daemon_kit/templates/script/generate",
58
40
  "bin/daemon-kit",
59
41
  "config/website.yml",
60
42
  "daemon-kit.gemspec",
61
- "daemon_generators/amqp/USAGE",
62
- "daemon_generators/amqp/amqp_generator.rb",
63
- "daemon_generators/amqp/templates/config/amqp.yml",
64
- "daemon_generators/amqp/templates/config/initializers/amqp.rb",
65
- "daemon_generators/amqp/templates/libexec/daemon.rb",
66
- "daemon_generators/cron/USAGE",
67
- "daemon_generators/cron/cron_generator.rb",
68
- "daemon_generators/cron/templates/config/initializers/cron.rb",
69
- "daemon_generators/cron/templates/libexec/daemon.rb",
70
- "daemon_generators/cucumber/USAGE",
71
- "daemon_generators/cucumber/cucumber_generator.rb",
72
- "daemon_generators/cucumber/templates/cucumber",
73
- "daemon_generators/cucumber/templates/cucumber.rake",
74
- "daemon_generators/cucumber/templates/cucumber_environment.rb",
75
- "daemon_generators/cucumber/templates/env.rb",
76
- "daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb",
77
- "daemon_generators/deploy_capistrano/templates/Capfile",
78
- "daemon_generators/deploy_capistrano/templates/USAGE",
79
- "daemon_generators/deploy_capistrano/templates/config/deploy.rb",
80
- "daemon_generators/deploy_capistrano/templates/config/deploy/production.rb",
81
- "daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb",
82
- "daemon_generators/deploy_capistrano/templates/config/environments/staging.rb",
83
- "daemon_generators/jabber/USAGE",
84
- "daemon_generators/jabber/jabber_generator.rb",
85
- "daemon_generators/jabber/templates/config/initializers/jabber.rb",
86
- "daemon_generators/jabber/templates/config/jabber.yml",
87
- "daemon_generators/jabber/templates/libexec/daemon.rb",
88
- "daemon_generators/nanite_agent/USAGE",
89
- "daemon_generators/nanite_agent/nanite_agent_generator.rb",
90
- "daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb",
91
- "daemon_generators/nanite_agent/templates/config/nanite.yml",
92
- "daemon_generators/nanite_agent/templates/lib/actors/sample.rb",
93
- "daemon_generators/nanite_agent/templates/libexec/daemon.rb",
94
- "daemon_generators/rspec/USAGE",
95
- "daemon_generators/rspec/rspec_generator.rb",
96
- "daemon_generators/rspec/templates/spec.rb",
97
- "daemon_generators/rspec/templates/spec/spec.opts",
98
- "daemon_generators/rspec/templates/spec/spec_helper.rb",
99
- "daemon_generators/rspec/templates/tasks/rspec.rake",
100
- "daemon_generators/ruote/USAGE",
101
- "daemon_generators/ruote/ruote_generator.rb",
102
- "daemon_generators/ruote/templates/config/amqp.yml",
103
- "daemon_generators/ruote/templates/config/initializers/ruote.rb",
104
- "daemon_generators/ruote/templates/config/ruote.yml",
105
- "daemon_generators/ruote/templates/lib/daemon.rb",
106
- "daemon_generators/ruote/templates/lib/sample.rb",
107
- "daemon_generators/ruote/templates/libexec/daemon.rb",
108
- "daemon_generators/test_unit/USAGE",
109
- "daemon_generators/test_unit/templates/tasks/test_unit.rake",
110
- "daemon_generators/test_unit/templates/test/test.rb",
111
- "daemon_generators/test_unit/templates/test/test_helper.rb",
112
- "daemon_generators/test_unit/test_unit_generator.rb",
113
43
  "lib/daemon_kit.rb",
114
44
  "lib/daemon_kit/abstract_logger.rb",
115
45
  "lib/daemon_kit/amqp.rb",
116
46
  "lib/daemon_kit/application.rb",
117
47
  "lib/daemon_kit/arguments.rb",
118
48
  "lib/daemon_kit/commands/console.rb",
49
+ "lib/daemon_kit/commands/destroy.rb",
50
+ "lib/daemon_kit/commands/generate.rb",
119
51
  "lib/daemon_kit/config.rb",
120
52
  "lib/daemon_kit/console_daemon.rb",
121
53
  "lib/daemon_kit/core_ext.rb",
@@ -129,6 +61,8 @@ Gem::Specification.new do |s|
129
61
  "lib/daemon_kit/error_handlers/hoptoad.rb",
130
62
  "lib/daemon_kit/error_handlers/mail.rb",
131
63
  "lib/daemon_kit/exceptions.rb",
64
+ "lib/daemon_kit/generators.rb",
65
+ "lib/daemon_kit/generators/base.rb",
132
66
  "lib/daemon_kit/initializer.rb",
133
67
  "lib/daemon_kit/jabber.rb",
134
68
  "lib/daemon_kit/nanite.rb",
@@ -144,7 +78,109 @@ Gem::Specification.new do |s|
144
78
  "lib/daemon_kit/tasks/god.rake",
145
79
  "lib/daemon_kit/tasks/log.rake",
146
80
  "lib/daemon_kit/tasks/monit.rake",
81
+ "lib/daemon_kit/vendor/thor-0.12.3/CHANGELOG.rdoc",
82
+ "lib/daemon_kit/vendor/thor-0.12.3/LICENSE",
83
+ "lib/daemon_kit/vendor/thor-0.12.3/README.rdoc",
84
+ "lib/daemon_kit/vendor/thor-0.12.3/Thorfile",
85
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor.rb",
86
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions.rb",
87
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/create_file.rb",
88
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/directory.rb",
89
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/empty_directory.rb",
90
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/file_manipulation.rb",
91
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/actions/inject_into_file.rb",
92
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/base.rb",
93
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/file_binary_read.rb",
94
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/hash_with_indifferent_access.rb",
95
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/core_ext/ordered_hash.rb",
96
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/error.rb",
97
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/group.rb",
98
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/invocation.rb",
99
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser.rb",
100
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/argument.rb",
101
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/arguments.rb",
102
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/option.rb",
103
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/parser/options.rb",
104
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/rake_compat.rb",
105
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/runner.rb",
106
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell.rb",
107
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell/basic.rb",
108
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/shell/color.rb",
109
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/task.rb",
110
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/util.rb",
111
+ "lib/daemon_kit/vendor/thor-0.12.3/lib/thor/version.rb",
147
112
  "lib/daemon_kit/xmpp.rb",
113
+ "lib/generators/daemon_kit/amqp/USAGE",
114
+ "lib/generators/daemon_kit/amqp/amqp_generator.rb",
115
+ "lib/generators/daemon_kit/amqp/templates/config/amqp.yml",
116
+ "lib/generators/daemon_kit/amqp/templates/config/pre-daemonize/amqp.rb",
117
+ "lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb",
118
+ "lib/generators/daemon_kit/app/USAGE",
119
+ "lib/generators/daemon_kit/app/app_generator.rb",
120
+ "lib/generators/daemon_kit/app/templates/Gemfile",
121
+ "lib/generators/daemon_kit/app/templates/README",
122
+ "lib/generators/daemon_kit/app/templates/Rakefile",
123
+ "lib/generators/daemon_kit/app/templates/bin/daemon.tt",
124
+ "lib/generators/daemon_kit/app/templates/config/arguments.rb",
125
+ "lib/generators/daemon_kit/app/templates/config/boot.rb",
126
+ "lib/generators/daemon_kit/app/templates/config/environment.rb.tt",
127
+ "lib/generators/daemon_kit/app/templates/config/environments/development.rb",
128
+ "lib/generators/daemon_kit/app/templates/config/environments/production.rb",
129
+ "lib/generators/daemon_kit/app/templates/config/environments/test.rb",
130
+ "lib/generators/daemon_kit/app/templates/config/post-daemonize/readme",
131
+ "lib/generators/daemon_kit/app/templates/config/pre-daemonize/readme",
132
+ "lib/generators/daemon_kit/app/templates/lib/%app_name%.rb",
133
+ "lib/generators/daemon_kit/app/templates/libexec/%app_name%-daemon.rb",
134
+ "lib/generators/daemon_kit/app/templates/script/console",
135
+ "lib/generators/daemon_kit/app/templates/script/destroy",
136
+ "lib/generators/daemon_kit/app/templates/script/generate",
137
+ "lib/generators/daemon_kit/capistrano/capistrano_generator.rb",
138
+ "lib/generators/daemon_kit/capistrano/templates/Capfile",
139
+ "lib/generators/daemon_kit/capistrano/templates/USAGE",
140
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt",
141
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy/production.rb.tt",
142
+ "lib/generators/daemon_kit/capistrano/templates/config/deploy/staging.rb.tt",
143
+ "lib/generators/daemon_kit/capistrano/templates/config/environments/staging.rb",
144
+ "lib/generators/daemon_kit/cron/USAGE",
145
+ "lib/generators/daemon_kit/cron/cron_generator.rb",
146
+ "lib/generators/daemon_kit/cron/templates/config/pre-daemonize/cron.rb",
147
+ "lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb",
148
+ "lib/generators/daemon_kit/cucumber/USAGE",
149
+ "lib/generators/daemon_kit/cucumber/cucumber_generator.rb",
150
+ "lib/generators/daemon_kit/cucumber/templates/config/environments/cucumber.rb",
151
+ "lib/generators/daemon_kit/cucumber/templates/features/step_definitions/.empty_directory",
152
+ "lib/generators/daemon_kit/cucumber/templates/features/support/env.rb",
153
+ "lib/generators/daemon_kit/cucumber/templates/script/cucumber",
154
+ "lib/generators/daemon_kit/cucumber/templates/tasks/cucumber.rake",
155
+ "lib/generators/daemon_kit/nanite_agent/USAGE",
156
+ "lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb",
157
+ "lib/generators/daemon_kit/nanite_agent/templates/config/nanite.yml",
158
+ "lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize/nanite_agent.rb",
159
+ "lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb",
160
+ "lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb",
161
+ "lib/generators/daemon_kit/rspec/USAGE",
162
+ "lib/generators/daemon_kit/rspec/rspec_generator.rb",
163
+ "lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb",
164
+ "lib/generators/daemon_kit/rspec/templates/spec/spec.opts",
165
+ "lib/generators/daemon_kit/rspec/templates/spec/spec_helper.rb",
166
+ "lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake",
167
+ "lib/generators/daemon_kit/ruote/USAGE",
168
+ "lib/generators/daemon_kit/ruote/ruote_generator.rb",
169
+ "lib/generators/daemon_kit/ruote/templates/config/amqp.yml",
170
+ "lib/generators/daemon_kit/ruote/templates/config/pre-daemonize/ruote.rb",
171
+ "lib/generators/daemon_kit/ruote/templates/config/ruote.yml",
172
+ "lib/generators/daemon_kit/ruote/templates/lib/%app_name%.rb",
173
+ "lib/generators/daemon_kit/ruote/templates/lib/sample.rb",
174
+ "lib/generators/daemon_kit/ruote/templates/libexec/%app_name%-daemon.rb",
175
+ "lib/generators/daemon_kit/test_unit/USAGE",
176
+ "lib/generators/daemon_kit/test_unit/templates/tasks/test_unit.rake",
177
+ "lib/generators/daemon_kit/test_unit/templates/test/%app_name%_test.rb.tt",
178
+ "lib/generators/daemon_kit/test_unit/templates/test/test_helper.rb",
179
+ "lib/generators/daemon_kit/test_unit/test_unit_generator.rb",
180
+ "lib/generators/daemon_kit/xmpp/templates/config/pre-daemonize/xmpp.rb",
181
+ "lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml",
182
+ "lib/generators/daemon_kit/xmpp/templates/libexec/%app_name%-daemon.rb",
183
+ "lib/generators/daemon_kit/xmpp/xmpp_generator.rb",
148
184
  "script/console",
149
185
  "script/destroy",
150
186
  "script/generate",
@@ -172,7 +208,6 @@ Gem::Specification.new do |s|
172
208
  "test/test_deploy_capistrano_generator.rb",
173
209
  "test/test_generator_helper.rb",
174
210
  "test/test_helper.rb",
175
- "test/test_jabber_generator.rb",
176
211
  "test/test_nanite_agent_generator.rb",
177
212
  "test/test_ruote_generator.rb",
178
213
  "test/test_test_unit_generator.rb",
@@ -233,7 +268,6 @@ To get started quickly run 'daemon-kit' without any arguments
233
268
  "test/test_deploy_capistrano_generator.rb",
234
269
  "test/test_generator_helper.rb",
235
270
  "test/test_helper.rb",
236
- "test/test_jabber_generator.rb",
237
271
  "test/test_nanite_agent_generator.rb",
238
272
  "test/test_ruote_generator.rb",
239
273
  "test/test_test_unit_generator.rb"
@@ -245,18 +279,15 @@ To get started quickly run 'daemon-kit' without any arguments
245
279
 
246
280
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
247
281
  s.add_runtime_dependency(%q<eventmachine>, [">= 0.12.8"])
248
- s.add_runtime_dependency(%q<rubigen>, [">= 1.5.2"])
249
282
  s.add_development_dependency(%q<rspec>, [">= 0"])
250
283
  s.add_development_dependency(%q<cucumber>, [">= 0"])
251
284
  else
252
285
  s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
253
- s.add_dependency(%q<rubigen>, [">= 1.5.2"])
254
286
  s.add_dependency(%q<rspec>, [">= 0"])
255
287
  s.add_dependency(%q<cucumber>, [">= 0"])
256
288
  end
257
289
  else
258
290
  s.add_dependency(%q<eventmachine>, [">= 0.12.8"])
259
- s.add_dependency(%q<rubigen>, [">= 1.5.2"])
260
291
  s.add_dependency(%q<rspec>, [">= 0"])
261
292
  s.add_dependency(%q<cucumber>, [">= 0"])
262
293
  end
data/lib/daemon_kit.rb CHANGED
@@ -1,13 +1,8 @@
1
- # TODO: Strip this out eventually so we can run without rubygems
2
- require 'rubygems'
3
-
4
- # Seems in 1.9 we need to load openssl before em or there is failures all around.
1
+ # Seems we need to load openssl before em or there are failures all around.
5
2
  # But we need to consider that people might not have ssl in the first place.
6
- if RUBY_VERSION >= "1.9"
7
- begin
8
- require 'openssl'
9
- rescue LoadError
10
- end
3
+ begin
4
+ require 'openssl'
5
+ rescue LoadError
11
6
  end
12
7
  require 'eventmachine'
13
8
 
@@ -18,7 +13,7 @@ $:.unshift( File.dirname(__FILE__).to_absolute_path ) unless
18
13
  $:.include?( File.dirname(__FILE__).to_absolute_path )
19
14
 
20
15
  module DaemonKit
21
- VERSION = '0.1.7.12'
16
+ VERSION = '0.1.8pre'
22
17
 
23
18
  autoload :Initializer, 'daemon_kit/initializer'
24
19
  autoload :Application, 'daemon_kit/application'
@@ -29,6 +24,7 @@ module DaemonKit
29
24
  autoload :AbstractLogger, 'daemon_kit/abstract_logger'
30
25
  autoload :EM, 'daemon_kit/em'
31
26
  autoload :Configurable, 'daemon_kit/core_ext/configurable'
27
+ autoload :Generators, 'daemon_kit/generators'
32
28
 
33
29
  autoload :Cron, 'daemon_kit/cron'
34
30
  autoload :Jabber, 'daemon_kit/jabber'
@@ -37,6 +33,7 @@ module DaemonKit
37
33
  autoload :RuoteParticipants, 'daemon_kit/ruote_participants'
38
34
  autoload :RuoteWorkitem, 'daemon_kit/ruote_workitem'
39
35
  autoload :RuotePseudoParticipant, 'daemon_kit/ruote_pseudo_participant'
36
+ autoload :XMPP, 'daemon_kit/xmpp'
40
37
 
41
38
  class << self
42
39
  def logger
@@ -69,60 +69,63 @@ module DaemonKit
69
69
  self.logger.write( msg ) if self.logger && self.logger.respond_to?( :write )
70
70
  end
71
71
 
72
- def debug( msg )
73
- add( :debug, msg )
72
+ def debug( msg = nil, &block )
73
+ add( :debug, msg, &block )
74
74
  end
75
75
 
76
76
  def debug?
77
77
  self.level == :debug
78
78
  end
79
79
 
80
- def info( msg )
81
- add( :info, msg )
80
+ def info( msg = nil, &block )
81
+ add( :info, msg, &block )
82
82
  end
83
83
 
84
84
  def info?
85
85
  self.level == :info
86
86
  end
87
87
 
88
- def warn( msg )
89
- add( :warn, msg )
88
+ def warn( msg = nil, &block )
89
+ add( :warn, msg, &block )
90
90
  end
91
91
 
92
92
  def warn?
93
93
  self.level == :warn
94
94
  end
95
95
 
96
- def error( msg )
97
- add( :error, msg )
96
+ def error( msg = nil, &block )
97
+ add( :error, msg, &block )
98
98
  end
99
99
 
100
100
  def error?
101
101
  self.level == :error
102
102
  end
103
103
 
104
- def fatal( msg )
105
- add( :fatal, msg )
104
+ def fatal( msg = nil, &block )
105
+ add( :fatal, msg, &block )
106
106
  end
107
107
 
108
108
  def fatal?
109
109
  self.level == :fatal
110
110
  end
111
111
 
112
- def unknown( msg )
113
- add( :unknown, msg )
112
+ def unknown( msg = nil, &block )
113
+ add( :unknown, msg, &block )
114
114
  end
115
115
 
116
116
  def unknown?
117
117
  self.level == :unknown
118
118
  end
119
119
 
120
+ # Conveniently log an exception and the backtrace
120
121
  def exception( e )
121
122
  message = "EXCEPTION: #{e.message}: #{clean_trace( e.backtrace )}"
122
123
  self.add( :error, message, true )
123
124
  end
124
125
 
125
- def add( severity, message, skip_caller = false )
126
+ def add( severity, message = nil, skip_caller = false, &block )
127
+ message = yield if block_given?
128
+
126
129
  message = "#{called(caller)}: #{message}" unless skip_caller
127
130
 
128
131
  self.logger.add( self.class.severities[ severity ] ) { message }
@@ -175,7 +178,12 @@ module DaemonKit
175
178
  l = trace.detect('unknown:0') { |l| l.index('abstract_logger.rb').nil? }
176
179
  file, num, _ = l.split(':')
177
180
 
178
- [ File.basename(file), num ].join(':')
181
+ if file =~ /daemon[\-_]kit/
182
+ "[daemon-kit]"
183
+
184
+ else
185
+ [ File.basename(file), num ].join(':')
186
+ end
179
187
  end
180
188
 
181
189
  def create_logger