bunnicula 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (181) hide show
  1. data/Rakefile +2 -2
  2. data/bunnicula.gemspec +180 -3
  3. data/lib/bunnicula/version.rb +1 -1
  4. data/vendor/daemon_kit/daemon-kit/Configuration.txt +110 -0
  5. data/vendor/daemon_kit/daemon-kit/Deployment.txt +113 -0
  6. data/vendor/daemon_kit/daemon-kit/History.txt +113 -0
  7. data/vendor/daemon_kit/daemon-kit/Logging.txt +96 -0
  8. data/vendor/daemon_kit/daemon-kit/Manifest.txt +172 -0
  9. data/vendor/daemon_kit/daemon-kit/PostInstall.txt +6 -0
  10. data/vendor/daemon_kit/daemon-kit/README.rdoc +126 -0
  11. data/vendor/daemon_kit/daemon-kit/Rakefile +29 -0
  12. data/vendor/daemon_kit/daemon-kit/RuoteParticipants.txt +113 -0
  13. data/vendor/daemon_kit/daemon-kit/TODO.txt +28 -0
  14. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/USAGE +7 -0
  15. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/daemon_kit_generator.rb +178 -0
  16. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/README +48 -0
  17. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/Rakefile +6 -0
  18. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/bin/daemon.erb +7 -0
  19. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/arguments.rb +12 -0
  20. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/boot.rb +59 -0
  21. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/environment.rb +23 -0
  22. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/environments/development.rb +2 -0
  23. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/environments/production.rb +5 -0
  24. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/environments/test.rb +2 -0
  25. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/post-daemonize/readme +5 -0
  26. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/config/pre-daemonize/readme +12 -0
  27. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/lib/daemon.rb +2 -0
  28. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/libexec/daemon.erb +18 -0
  29. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/script/console +3 -0
  30. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/script/destroy +14 -0
  31. data/vendor/daemon_kit/daemon-kit/app_generators/daemon_kit/templates/script/generate +14 -0
  32. data/vendor/daemon_kit/daemon-kit/bin/daemon-kit +18 -0
  33. data/vendor/daemon_kit/daemon-kit/config/website.yml +2 -0
  34. data/vendor/daemon_kit/daemon-kit/daemon-kit.gemspec +264 -0
  35. data/vendor/daemon_kit/daemon-kit/daemon_generators/amqp/USAGE +5 -0
  36. data/vendor/daemon_kit/daemon-kit/daemon_generators/amqp/amqp_generator.rb +65 -0
  37. data/vendor/daemon_kit/daemon-kit/daemon_generators/amqp/templates/config/amqp.yml +28 -0
  38. data/vendor/daemon_kit/daemon-kit/daemon_generators/amqp/templates/config/initializers/amqp.rb +7 -0
  39. data/vendor/daemon_kit/daemon-kit/daemon_generators/amqp/templates/libexec/daemon.rb +37 -0
  40. data/vendor/daemon_kit/daemon-kit/daemon_generators/cron/USAGE +5 -0
  41. data/vendor/daemon_kit/daemon-kit/daemon_generators/cron/cron_generator.rb +64 -0
  42. data/vendor/daemon_kit/daemon-kit/daemon_generators/cron/templates/config/initializers/cron.rb +11 -0
  43. data/vendor/daemon_kit/daemon-kit/daemon_generators/cron/templates/libexec/daemon.rb +43 -0
  44. data/vendor/daemon_kit/daemon-kit/daemon_generators/cucumber/USAGE +11 -0
  45. data/vendor/daemon_kit/daemon-kit/daemon_generators/cucumber/cucumber_generator.rb +38 -0
  46. data/vendor/daemon_kit/daemon-kit/daemon_generators/cucumber/templates/cucumber +8 -0
  47. data/vendor/daemon_kit/daemon-kit/daemon_generators/cucumber/templates/cucumber.rake +13 -0
  48. data/vendor/daemon_kit/daemon-kit/daemon_generators/cucumber/templates/cucumber_environment.rb +2 -0
  49. data/vendor/daemon_kit/daemon-kit/daemon_generators/cucumber/templates/env.rb +7 -0
  50. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb +35 -0
  51. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/templates/Capfile +10 -0
  52. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/templates/USAGE +10 -0
  53. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/templates/config/deploy.rb +53 -0
  54. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/templates/config/deploy/production.rb +6 -0
  55. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb +6 -0
  56. data/vendor/daemon_kit/daemon-kit/daemon_generators/deploy_capistrano/templates/config/environments/staging.rb +0 -0
  57. data/vendor/daemon_kit/daemon-kit/daemon_generators/jabber/USAGE +5 -0
  58. data/vendor/daemon_kit/daemon-kit/daemon_generators/jabber/jabber_generator.rb +65 -0
  59. data/vendor/daemon_kit/daemon-kit/daemon_generators/jabber/templates/config/initializers/jabber.rb +7 -0
  60. data/vendor/daemon_kit/daemon-kit/daemon_generators/jabber/templates/config/jabber.yml +26 -0
  61. data/vendor/daemon_kit/daemon-kit/daemon_generators/jabber/templates/libexec/daemon.rb +27 -0
  62. data/vendor/daemon_kit/daemon-kit/daemon_generators/nanite_agent/USAGE +5 -0
  63. data/vendor/daemon_kit/daemon-kit/daemon_generators/nanite_agent/nanite_agent_generator.rb +68 -0
  64. data/vendor/daemon_kit/daemon-kit/daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb +6 -0
  65. data/vendor/daemon_kit/daemon-kit/daemon_generators/nanite_agent/templates/config/nanite.yml +35 -0
  66. data/vendor/daemon_kit/daemon-kit/daemon_generators/nanite_agent/templates/lib/actors/sample.rb +11 -0
  67. data/vendor/daemon_kit/daemon-kit/daemon_generators/nanite_agent/templates/libexec/daemon.rb +31 -0
  68. data/vendor/daemon_kit/daemon-kit/daemon_generators/rspec/USAGE +5 -0
  69. data/vendor/daemon_kit/daemon-kit/daemon_generators/rspec/rspec_generator.rb +55 -0
  70. data/vendor/daemon_kit/daemon-kit/daemon_generators/rspec/templates/spec.rb +11 -0
  71. data/vendor/daemon_kit/daemon-kit/daemon_generators/rspec/templates/spec/spec.opts +1 -0
  72. data/vendor/daemon_kit/daemon-kit/daemon_generators/rspec/templates/spec/spec_helper.rb +23 -0
  73. data/vendor/daemon_kit/daemon-kit/daemon_generators/rspec/templates/tasks/rspec.rake +19 -0
  74. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/USAGE +5 -0
  75. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/ruote_generator.rb +67 -0
  76. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/templates/config/amqp.yml +30 -0
  77. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/templates/config/initializers/ruote.rb +13 -0
  78. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/templates/config/ruote.yml +23 -0
  79. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/templates/lib/daemon.rb +4 -0
  80. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/templates/lib/sample.rb +26 -0
  81. data/vendor/daemon_kit/daemon-kit/daemon_generators/ruote/templates/libexec/daemon.rb +33 -0
  82. data/vendor/daemon_kit/daemon-kit/daemon_generators/test_unit/USAGE +5 -0
  83. data/vendor/daemon_kit/daemon-kit/daemon_generators/test_unit/templates/tasks/test_unit.rake +7 -0
  84. data/vendor/daemon_kit/daemon-kit/daemon_generators/test_unit/templates/test/test.rb +9 -0
  85. data/vendor/daemon_kit/daemon-kit/daemon_generators/test_unit/templates/test/test_helper.rb +6 -0
  86. data/vendor/daemon_kit/daemon-kit/daemon_generators/test_unit/test_unit_generator.rb +51 -0
  87. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit.rb +62 -0
  88. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/abstract_logger.rb +241 -0
  89. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/amqp.rb +38 -0
  90. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/application.rb +188 -0
  91. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/arguments.rb +170 -0
  92. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/commands/console.rb +38 -0
  93. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/config.rb +108 -0
  94. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/console_daemon.rb +2 -0
  95. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/core_ext.rb +1 -0
  96. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/core_ext/configurable.rb +96 -0
  97. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/core_ext/string.rb +22 -0
  98. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/cron.rb +48 -0
  99. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/cucumber/world.rb +38 -0
  100. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/deployment/capistrano.rb +482 -0
  101. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/em.rb +43 -0
  102. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/error_handlers/base.rb +32 -0
  103. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/error_handlers/hoptoad.rb +61 -0
  104. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/error_handlers/mail.rb +85 -0
  105. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/exceptions.rb +15 -0
  106. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/initializer.rb +453 -0
  107. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/jabber.rb +170 -0
  108. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/nanite.rb +7 -0
  109. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/nanite/agent.rb +77 -0
  110. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/pid_file.rb +61 -0
  111. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/ruote_participants.rb +119 -0
  112. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/ruote_pseudo_participant.rb +68 -0
  113. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/ruote_workitem.rb +177 -0
  114. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/safety.rb +85 -0
  115. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/tasks.rb +2 -0
  116. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/tasks/environment.rake +10 -0
  117. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/tasks/framework.rake +120 -0
  118. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/tasks/god.rake +62 -0
  119. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/tasks/log.rake +8 -0
  120. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/tasks/monit.rake +29 -0
  121. data/vendor/daemon_kit/daemon-kit/lib/daemon_kit/xmpp.rb +31 -0
  122. data/vendor/daemon_kit/daemon-kit/script/console +10 -0
  123. data/vendor/daemon_kit/daemon-kit/script/destroy +14 -0
  124. data/vendor/daemon_kit/daemon-kit/script/generate +14 -0
  125. data/vendor/daemon_kit/daemon-kit/script/txt2html +71 -0
  126. data/vendor/daemon_kit/daemon-kit/spec/abstract_logger_spec.rb +126 -0
  127. data/vendor/daemon_kit/daemon-kit/spec/argument_spec.rb +70 -0
  128. data/vendor/daemon_kit/daemon-kit/spec/config_spec.rb +79 -0
  129. data/vendor/daemon_kit/daemon-kit/spec/configurable_spec.rb +56 -0
  130. data/vendor/daemon_kit/daemon-kit/spec/daemon_kit_spec.rb +7 -0
  131. data/vendor/daemon_kit/daemon-kit/spec/error_handlers_spec.rb +23 -0
  132. data/vendor/daemon_kit/daemon-kit/spec/fixtures/env.yml +15 -0
  133. data/vendor/daemon_kit/daemon-kit/spec/fixtures/noenv.yml +4 -0
  134. data/vendor/daemon_kit/daemon-kit/spec/initializer_spec.rb +26 -0
  135. data/vendor/daemon_kit/daemon-kit/spec/spec.opts +1 -0
  136. data/vendor/daemon_kit/daemon-kit/spec/spec_helper.rb +27 -0
  137. data/vendor/daemon_kit/daemon-kit/tasks/cucumber.rake +13 -0
  138. data/vendor/daemon_kit/daemon-kit/tasks/rspec.rake +21 -0
  139. data/vendor/daemon_kit/daemon-kit/tasks/tests.rake +6 -0
  140. data/vendor/daemon_kit/daemon-kit/templates/god/god.erb +69 -0
  141. data/vendor/daemon_kit/daemon-kit/templates/monit/monit.erb +14 -0
  142. data/vendor/daemon_kit/daemon-kit/test/test_amqp_generator.rb +48 -0
  143. data/vendor/daemon_kit/daemon-kit/test/test_cron_generator.rb +45 -0
  144. data/vendor/daemon_kit/daemon-kit/test/test_daemon-kit_generator.rb +84 -0
  145. data/vendor/daemon_kit/daemon-kit/test/test_daemon_kit_config.rb +28 -0
  146. data/vendor/daemon_kit/daemon-kit/test/test_deploy_capistrano_generator.rb +48 -0
  147. data/vendor/daemon_kit/daemon-kit/test/test_generator_helper.rb +29 -0
  148. data/vendor/daemon_kit/daemon-kit/test/test_helper.rb +7 -0
  149. data/vendor/daemon_kit/daemon-kit/test/test_jabber_generator.rb +49 -0
  150. data/vendor/daemon_kit/daemon-kit/test/test_nanite_agent_generator.rb +49 -0
  151. data/vendor/daemon_kit/daemon-kit/test/test_ruote_generator.rb +51 -0
  152. data/vendor/daemon_kit/daemon-kit/test/test_test_unit_generator.rb +46 -0
  153. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail.rb +5 -0
  154. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/address.rb +426 -0
  155. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/attachments.rb +46 -0
  156. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/base64.rb +46 -0
  157. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/compat.rb +41 -0
  158. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/config.rb +67 -0
  159. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/core_extensions.rb +63 -0
  160. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/encode.rb +581 -0
  161. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/header.rb +960 -0
  162. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/index.rb +9 -0
  163. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/interface.rb +1130 -0
  164. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/loader.rb +3 -0
  165. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/mail.rb +578 -0
  166. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/mailbox.rb +495 -0
  167. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/main.rb +6 -0
  168. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/mbox.rb +3 -0
  169. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/net.rb +248 -0
  170. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/obsolete.rb +132 -0
  171. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/parser.rb +1476 -0
  172. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/port.rb +379 -0
  173. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/quoting.rb +118 -0
  174. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/require_arch.rb +58 -0
  175. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/scanner.rb +49 -0
  176. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/scanner_r.rb +261 -0
  177. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/stringio.rb +280 -0
  178. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/utils.rb +337 -0
  179. data/vendor/daemon_kit/daemon-kit/vendor/tmail-1.2.3/tmail/version.rb +39 -0
  180. data/vendor/daemon_kit/daemon-kit/vendor/tmail.rb +13 -0
  181. metadata +181 -4
@@ -0,0 +1,96 @@
1
+ = Logging from inside your daemon
2
+
3
+ Proper logging inside your daemon process is critical, and daemon-kit
4
+ provides you with a great logging facility to (ab)use.
5
+
6
+ == Logging examples
7
+
8
+ From anywhere in your code you can access the
9
+ <em>DaemonKit.logger</em> instance, which is a configured
10
+ DaemonKit::AbstractLogger. It is compatible with Ruby's Logger class
11
+ but is much more verbose to help you gain some insight into your
12
+ running process.
13
+
14
+ DaemonKit.logger.info( "Hello world" )
15
+
16
+ This logs a 'Hello world' line to the log file, complete with the
17
+ calling file name and line number. Log lines look something like this:
18
+
19
+ 2009-06-07 23:21:30.248575 capd(32513) [INFO] initializer.rb:91: DaemonKit (0.1.7.4) booted, now running capd
20
+
21
+ Log as much as you can, but be careful not to abuse the <em>info</em>
22
+ level since your log files can become huge. For general processing
23
+ hints, use the <em>debug</em> level.
24
+
25
+ To log exceptions, use the special <em>exception</em> helper:
26
+
27
+ begin
28
+ # dangerous operation
29
+ rescue => e
30
+ DaemonKit.logger.exception( e )
31
+ end
32
+
33
+ == Controlling logging in a running process
34
+
35
+ Logging can be controlled in a running process, either via code or by
36
+ sending UNIX signals to the running process.
37
+
38
+ === Changing log levels in your code
39
+
40
+ Log levels can be toggled with the <em>level=</em> method:
41
+
42
+ DaemonKit.logger.level = :info
43
+
44
+ Alternatively you can silence all the logging activity for a while
45
+ using the silence helper:
46
+
47
+ DaemonKit.logger.silence do |logger|
48
+ # logger will only report :error or higher levels
49
+ end
50
+
51
+ You can also set the logging per environment by editing the correct file in <em>config/environments</em>
52
+
53
+ config.log_level = :debug
54
+
55
+ === Changing log levels via UNIX signals
56
+
57
+ Send your process the +USR1+ signal to toggle between <em>:debug</em>
58
+ and <em>:info</em> log levels. Sending a +USR2+ signal will force the
59
+ logger into <em>:debug</em> mode (+USR1+ will revert).
60
+
61
+ == Support for log rotation
62
+
63
+ Support for logrotate is baked right into daemon-kit. By sending your
64
+ daemon a +HUP+ signal all the log files file be closed and re-opened
65
+ again on first use. Here is an example logrotate configuration:
66
+
67
+ /path/to/daemon.log {
68
+ rotate 5
69
+ weekly
70
+ postrotate
71
+ kill -HUP `cat /path/to/daemon.pid`
72
+ endscript
73
+ }
74
+
75
+ == Support for syslog logging
76
+
77
+ If you have the
78
+ SyslogLogger[http://seattlerb.rubyforge.org/SyslogLogger/] gem
79
+ installed, you can have your process log to a UNIX syslog server. You
80
+ can change the logging to syslog by either updating your
81
+ <em>environment.rb</em> file like this:
82
+
83
+ config.log_path = :syslog
84
+
85
+ Or by passing 'syslog' as the logfile argument when starting a daemon
86
+
87
+ $ ruby ./bin/daemon start -l syslog
88
+
89
+ The SyslogLogger rdoc's provide configuration examples for configuring
90
+ various UNIX syslog servers.
91
+
92
+ == More logging information
93
+
94
+ If you're running your daemon in the foreground (with the <em>run</em>
95
+ command, you'll get copies of all the log messages on STDOUT, and thus
96
+ voiding the need to tail log files the whole time.
@@ -0,0 +1,172 @@
1
+ Configuration.txt
2
+ Deployment.txt
3
+ History.txt
4
+ Logging.txt
5
+ Manifest.txt
6
+ PostInstall.txt
7
+ README.rdoc
8
+ Rakefile
9
+ RuoteParticipants.txt
10
+ TODO.txt
11
+ app_generators/daemon_kit/USAGE
12
+ app_generators/daemon_kit/daemon_kit_generator.rb
13
+ app_generators/daemon_kit/templates/README
14
+ app_generators/daemon_kit/templates/Rakefile
15
+ app_generators/daemon_kit/templates/bin/daemon.erb
16
+ app_generators/daemon_kit/templates/config/arguments.rb
17
+ app_generators/daemon_kit/templates/config/boot.rb
18
+ app_generators/daemon_kit/templates/config/environment.rb
19
+ app_generators/daemon_kit/templates/config/environments/development.rb
20
+ app_generators/daemon_kit/templates/config/environments/production.rb
21
+ app_generators/daemon_kit/templates/config/environments/test.rb
22
+ app_generators/daemon_kit/templates/config/post-daemonize/readme
23
+ app_generators/daemon_kit/templates/config/pre-daemonize/readme
24
+ app_generators/daemon_kit/templates/lib/daemon.rb
25
+ app_generators/daemon_kit/templates/libexec/daemon.erb
26
+ app_generators/daemon_kit/templates/script/console
27
+ app_generators/daemon_kit/templates/script/destroy
28
+ app_generators/daemon_kit/templates/script/generate
29
+ bin/daemon-kit
30
+ daemon_generators/amqp/USAGE
31
+ daemon_generators/amqp/amqp_generator.rb
32
+ daemon_generators/amqp/templates/config/amqp.yml
33
+ daemon_generators/amqp/templates/config/initializers/amqp.rb
34
+ daemon_generators/amqp/templates/libexec/daemon.rb
35
+ daemon_generators/cron/USAGE
36
+ daemon_generators/cron/cron_generator.rb
37
+ daemon_generators/cron/templates/config/initializers/cron.rb
38
+ daemon_generators/cron/templates/libexec/daemon.rb
39
+ daemon_generators/cucumber/USAGE
40
+ daemon_generators/cucumber/cucumber_generator.rb
41
+ daemon_generators/cucumber/templates/cucumber
42
+ daemon_generators/cucumber/templates/cucumber.rake
43
+ daemon_generators/cucumber/templates/cucumber_environment.rb
44
+ daemon_generators/cucumber/templates/env.rb
45
+ daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb
46
+ daemon_generators/deploy_capistrano/templates/Capfile
47
+ daemon_generators/deploy_capistrano/templates/USAGE
48
+ daemon_generators/deploy_capistrano/templates/config/deploy.rb
49
+ daemon_generators/deploy_capistrano/templates/config/deploy/production.rb
50
+ daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb
51
+ daemon_generators/deploy_capistrano/templates/config/environments/staging.rb
52
+ daemon_generators/jabber/USAGE
53
+ daemon_generators/jabber/jabber_generator.rb
54
+ daemon_generators/jabber/templates/config/initializers/jabber.rb
55
+ daemon_generators/jabber/templates/config/jabber.yml
56
+ daemon_generators/jabber/templates/libexec/daemon.rb
57
+ daemon_generators/nanite_agent/USAGE
58
+ daemon_generators/nanite_agent/nanite_agent_generator.rb
59
+ daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb
60
+ daemon_generators/nanite_agent/templates/config/nanite.yml
61
+ daemon_generators/nanite_agent/templates/lib/actors/sample.rb
62
+ daemon_generators/nanite_agent/templates/libexec/daemon.rb
63
+ daemon_generators/rspec/USAGE
64
+ daemon_generators/rspec/rspec_generator.rb
65
+ daemon_generators/rspec/templates/spec.rb
66
+ daemon_generators/rspec/templates/spec/spec.opts
67
+ daemon_generators/rspec/templates/spec/spec_helper.rb
68
+ daemon_generators/rspec/templates/tasks/rspec.rake
69
+ daemon_generators/ruote/USAGE
70
+ daemon_generators/ruote/ruote_generator.rb
71
+ daemon_generators/ruote/templates/config/amqp.yml
72
+ daemon_generators/ruote/templates/config/initializers/ruote.rb
73
+ daemon_generators/ruote/templates/config/ruote.yml
74
+ daemon_generators/ruote/templates/lib/daemon.rb
75
+ daemon_generators/ruote/templates/lib/sample.rb
76
+ daemon_generators/ruote/templates/libexec/daemon.rb
77
+ daemon_generators/test_unit/USAGE
78
+ daemon_generators/test_unit/templates/tasks/test_unit.rake
79
+ daemon_generators/test_unit/templates/test/test.rb
80
+ daemon_generators/test_unit/templates/test/test_helper.rb
81
+ daemon_generators/test_unit/test_unit_generator.rb
82
+ lib/daemon_kit.rb
83
+ lib/daemon_kit/abstract_logger.rb
84
+ lib/daemon_kit/amqp.rb
85
+ lib/daemon_kit/application.rb
86
+ lib/daemon_kit/arguments.rb
87
+ lib/daemon_kit/commands/console.rb
88
+ lib/daemon_kit/config.rb
89
+ lib/daemon_kit/console_daemon.rb
90
+ lib/daemon_kit/core_ext.rb
91
+ lib/daemon_kit/core_ext/configurable.rb
92
+ lib/daemon_kit/core_ext/string.rb
93
+ lib/daemon_kit/cron.rb
94
+ lib/daemon_kit/cucumber/world.rb
95
+ lib/daemon_kit/deployment/capistrano.rb
96
+ lib/daemon_kit/em.rb
97
+ lib/daemon_kit/error_handlers/base.rb
98
+ lib/daemon_kit/error_handlers/hoptoad.rb
99
+ lib/daemon_kit/error_handlers/mail.rb
100
+ lib/daemon_kit/exceptions.rb
101
+ lib/daemon_kit/initializer.rb
102
+ lib/daemon_kit/jabber.rb
103
+ lib/daemon_kit/nanite.rb
104
+ lib/daemon_kit/nanite/agent.rb
105
+ lib/daemon_kit/pid_file.rb
106
+ lib/daemon_kit/ruote_participants.rb
107
+ lib/daemon_kit/ruote_pseudo_participant.rb
108
+ lib/daemon_kit/ruote_workitem.rb
109
+ lib/daemon_kit/safety.rb
110
+ lib/daemon_kit/tasks.rb
111
+ lib/daemon_kit/tasks/environment.rake
112
+ lib/daemon_kit/tasks/framework.rake
113
+ lib/daemon_kit/tasks/god.rake
114
+ lib/daemon_kit/tasks/log.rake
115
+ lib/daemon_kit/tasks/monit.rake
116
+ script/console
117
+ script/destroy
118
+ script/generate
119
+ script/txt2html
120
+ spec/abstract_logger_spec.rb
121
+ spec/argument_spec.rb
122
+ spec/config_spec.rb
123
+ spec/configurable_spec.rb
124
+ spec/daemon_kit_spec.rb
125
+ spec/error_handlers_spec.rb
126
+ spec/fixtures/env.yml
127
+ spec/fixtures/noenv.yml
128
+ spec/initializer_spec.rb
129
+ spec/spec.opts
130
+ spec/spec_helper.rb
131
+ tasks/rspec.rake
132
+ templates/god/god.erb
133
+ templates/monit/monit.erb
134
+ test/test_amqp_generator.rb
135
+ test/test_cron_generator.rb
136
+ test/test_daemon-kit_generator.rb
137
+ test/test_daemon_kit_config.rb
138
+ test/test_deploy_capistrano_generator.rb
139
+ test/test_generator_helper.rb
140
+ test/test_helper.rb
141
+ test/test_jabber_generator.rb
142
+ test/test_nanite_agent_generator.rb
143
+ test/test_ruote_generator.rb
144
+ test/test_test_unit_generator.rb
145
+ vendor/tmail-1.2.3/tmail.rb
146
+ vendor/tmail-1.2.3/tmail/address.rb
147
+ vendor/tmail-1.2.3/tmail/attachments.rb
148
+ vendor/tmail-1.2.3/tmail/base64.rb
149
+ vendor/tmail-1.2.3/tmail/compat.rb
150
+ vendor/tmail-1.2.3/tmail/config.rb
151
+ vendor/tmail-1.2.3/tmail/core_extensions.rb
152
+ vendor/tmail-1.2.3/tmail/encode.rb
153
+ vendor/tmail-1.2.3/tmail/header.rb
154
+ vendor/tmail-1.2.3/tmail/index.rb
155
+ vendor/tmail-1.2.3/tmail/interface.rb
156
+ vendor/tmail-1.2.3/tmail/loader.rb
157
+ vendor/tmail-1.2.3/tmail/mail.rb
158
+ vendor/tmail-1.2.3/tmail/mailbox.rb
159
+ vendor/tmail-1.2.3/tmail/main.rb
160
+ vendor/tmail-1.2.3/tmail/mbox.rb
161
+ vendor/tmail-1.2.3/tmail/net.rb
162
+ vendor/tmail-1.2.3/tmail/obsolete.rb
163
+ vendor/tmail-1.2.3/tmail/parser.rb
164
+ vendor/tmail-1.2.3/tmail/port.rb
165
+ vendor/tmail-1.2.3/tmail/quoting.rb
166
+ vendor/tmail-1.2.3/tmail/require_arch.rb
167
+ vendor/tmail-1.2.3/tmail/scanner.rb
168
+ vendor/tmail-1.2.3/tmail/scanner_r.rb
169
+ vendor/tmail-1.2.3/tmail/stringio.rb
170
+ vendor/tmail-1.2.3/tmail/utils.rb
171
+ vendor/tmail-1.2.3/tmail/version.rb
172
+ vendor/tmail.rb
@@ -0,0 +1,6 @@
1
+
2
+ For more information on daemon-kit, see http://kit.rubyforge.org/daemon-kit
3
+
4
+ To get started quickly run 'daemon-kit' without any arguments
5
+
6
+
@@ -0,0 +1,126 @@
1
+ = Daemon Kit
2
+
3
+ * http://kit.rubyforge.org/daemon-kit/rdoc/
4
+ * http://kit.rubyforge.org/daemon-kit (coming soon)
5
+ * http://groups.google.com/group/daemon-kit (daemon-kit@googlegroups.com)
6
+ * #daemon-kit on Freenode
7
+
8
+ == Description
9
+
10
+ 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.
11
+
12
+ Using simple built-in generators it is easy to created evented and non-evented daemons that perform a multitude of different tasks.
13
+
14
+ Supported generators:
15
+
16
+ * XMPP bot (non-evented)
17
+ * AMQP consumer (evented)
18
+ * Nanite agent
19
+ * Cron-style daemon
20
+ * ruote remote participants
21
+
22
+ == Features/Problems
23
+
24
+ * Build it
25
+ * Review TODO.txt
26
+
27
+ == Synopsis
28
+
29
+ $ daemon-kit -h
30
+
31
+ Get some help
32
+
33
+ $ daemon-kit [/path/to/your/daemon] [options]
34
+
35
+ The above command generates a skeleton daemon environment for you to adapt.
36
+
37
+ $ daemon-kit [/path/to/your/daemon] -i jabber
38
+
39
+ Use the 'jabber' generator instead of the default one.
40
+
41
+ == Generators
42
+
43
+ Currently six generators exist: default, jabber, amqp, cron, nanite & ruote
44
+
45
+ The default generator creates a simple daemon with an infinite loop inside that you can adapt.
46
+
47
+ === Jabber Generator
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.
50
+
51
+ === Cron Generator
52
+
53
+ The cron generator creates a simple daemon that leverages the rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] gem to create a simple cron-lie daemon. Please be aware that this daemon could never be a replacement for the battle-tested cron[http://www.gentoo.org/doc/en/cron-guide.xml] utility shipped standard with most *nix distributions.
54
+
55
+ === AMQP Consumer Generator
56
+
57
+ The AMQP generator creates a simple daemon that has all the stub code and configuration in place to help you write AMQP consumers quickly and effectively. The generated daemon relies on the presence of the amqp[http://github.com/tmm1/amqp] gem.
58
+
59
+ === Nanite Agent Generator
60
+
61
+ The nanite[http://github.com/ezmobius/nanite] agent generator gets you up and running with nanite agents very quickly.
62
+
63
+ === ruote Remote Participants
64
+
65
+ The ruote[http://openwfe.rubyforge.org] remote participant generator speeds up the development of workflow participants that run outside of the Ruby process that houses the engine. Daemon-kit handles all the communication and delegation logic, allowing you to focus purely on your participant's activities.
66
+
67
+ == Requirements
68
+
69
+ * Ruby 1.8.6
70
+ * eventmachine-0.12.8[http://rubyeventmachine.com]
71
+ * rspec (for writing/running your specs)
72
+
73
+ == Generator Requirements
74
+
75
+ Depending on the generator you choose for your daemon, it might require additional gems to run.
76
+
77
+ * jabber - xmpp4r-simple[http://xmpp4r-simple.rubyforge.org]
78
+ * cron - rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] (at least version 2.0.0)
79
+ * amqp - amqp[http://github.com/tmm1/amqp]
80
+ * nanite - nanite[http://github.com/ezmobius/nanite]
81
+ * ruote - none, although ruote[http://openwfe.rubyforge.org] should probably be running somewhere
82
+
83
+ == Install
84
+
85
+ Currently recommended to stick to the git repo:
86
+
87
+ $ git clone git://github.com/kennethkalmer/daemon-kit.git
88
+ $ rake gem
89
+ $ gem install pkg/daemon-kit-X.X.X.gem
90
+
91
+ Stable versions, when released are available directly from Gemcutter:
92
+
93
+ $ gem install daemon-kit
94
+
95
+ == Further reading
96
+
97
+ * Configuration.txt
98
+ * Deployment.txt
99
+ * Logging.txt
100
+ * RuoteParticipants.txt
101
+ * http://www.opensourcery.co.za/tag/daemon-kit/
102
+
103
+ == License
104
+
105
+ (The MIT License)
106
+
107
+ Copyright (c) 2009 Kenneth Kalmer (Internet Exchange CC, Clear Planet Information Solutions Pty Ltd)
108
+
109
+ Permission is hereby granted, free of charge, to any person obtaining
110
+ a copy of this software and associated documentation files (the
111
+ 'Software'), to deal in the Software without restriction, including
112
+ without limitation the rights to use, copy, modify, merge, publish,
113
+ distribute, sublicense, and/or sell copies of the Software, and to
114
+ permit persons to whom the Software is furnished to do so, subject to
115
+ the following conditions:
116
+
117
+ The above copyright notice and this permission notice shall be
118
+ included in all copies or substantial portions of the Software.
119
+
120
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
121
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
122
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
123
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
124
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
125
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
126
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,29 @@
1
+ Dir['tasks/**/*.rake'].each { |t| load t }
2
+
3
+ require File.dirname(__FILE__) + '/lib/daemon_kit'
4
+
5
+ begin
6
+ require 'jeweler'
7
+ Jeweler::Tasks.new do |gemspec|
8
+ gemspec.name = 'daemon-kit'
9
+ gemspec.version = DaemonKit::VERSION
10
+ gemspec.summary = 'Opinionated framework for Ruby daemons'
11
+ gemspec.description = '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.'
12
+ gemspec.email = 'kenneth.kalmer@gmail.com'
13
+ gemspec.homepage = 'http://github.com/kennethkalmer/daemon-kit'
14
+ gemspec.authors = ['kenneth.kalmer@gmail.com']
15
+ gemspec.post_install_message = IO.read('PostInstall.txt')
16
+ gemspec.extra_rdoc_files.include '*.txt'
17
+
18
+ gemspec.add_dependency 'eventmachine', '>=0.12.8'
19
+ gemspec.add_dependency 'rubigen', '>=1.5.2'
20
+ gemspec.add_development_dependency 'rspec'
21
+ gemspec.add_development_dependency 'cucumber'
22
+ end
23
+ Jeweler::GemcutterTasks.new
24
+ rescue LoadError
25
+ puts "Jeweler not available. Install it with 'gem install jeweler'"
26
+ end
27
+
28
+ # TODO - want other tests/tasks run by default? Add them to the list
29
+ task :default => [:spec] #, :features]
@@ -0,0 +1,113 @@
1
+ = Writing remote ruote participants with daemon-kit
2
+
3
+ daemon-kit is an ideal housing for remote ruote participants, providing a lot
4
+ of convenience in terms of receiving and sending workitems, delegating work to
5
+ pseudo-participant classes, handling configuration of the communication channel
6
+ between ruote and the remote participant, and much more.
7
+
8
+ == What is ruote?
9
+
10
+ Ruote is a Ruby workflow engine. It is a powerful tool for defining, running and
11
+ orchestrating business processes.
12
+
13
+ * http://openwferu.rubyforge.org/
14
+ * http://www.opensourcery.co.za/2009/03/04/ruote-in-20-minutes/
15
+ * http://www.opensourcery.co.za/2009/07/06/driving-business-processes-in-ruby/
16
+
17
+ == What are remote participants?
18
+
19
+ Remote participants are participants that perform their work in a different
20
+ Ruby processes from the one running the engine. This is useful in two cases,
21
+ possibily many more, that involves autonomous participants.
22
+
23
+ * Autonomous participants located on remote servers, driven by identity
24
+ * Clustering autonomous participants to process workitems from a queue
25
+
26
+ To learn more about the differences between local and remote participants
27
+ please see http://openwferu.rubyforge.org/part.html
28
+
29
+ Currently on the AMQP components are in place in daemon-kit, with XMPP coming
30
+ soon.
31
+
32
+ == Creating a remote participant with daemon-kit
33
+
34
+ Generate your daemon using the 'ruote' generator:
35
+
36
+ $ daemon_kit partd -i ruote
37
+
38
+ Make sure you have the JSON gem install, and the AMQP gem as well.
39
+
40
+ == Configuring the daemon
41
+
42
+ You need to review +config/ruote.yml+ to specify the AMQP queues that the daemon
43
+ will subscribe to for receiving workitems. You'll also need to configure the
44
+ AMQP gem be updating +config/amqp.yml+
45
+
46
+ The generated daemon in +libexec/+ already defaults to using AMQP as a transport
47
+ for workitems.
48
+
49
+ == Writing pseudo-participants
50
+
51
+ Pseudo-participants in daemon-kit are pure Ruby classes. Implement your classes
52
+ in +lib/+ and require them from +lib/<daemon_name>.rb+.
53
+
54
+ Register your classes as pseudo-participants by registering them in the daemon
55
+ file in +libexec+, just as the Sample class is registered in the generated
56
+ code. Your class will be instantiated upon registration, and will be re-used
57
+ for every incoming workitem passed to it.
58
+
59
+ All your public methods in the pseudo-participant classes should be accept
60
+ a single parameter, which is a ruote workitem in pure Hash form.
61
+
62
+ == Wiring up the remote participant in ruote
63
+
64
+ See the complete code here: http://gist.github.com/144861
65
+
66
+ A sample process definition might look something like this:
67
+
68
+ class QuoteProcess < OpenWFE::ProcessDefinition
69
+ sequence do
70
+ kit :command => '/sample/quote', :queue => 'work1'
71
+
72
+ console
73
+ end
74
+ end
75
+
76
+ +kit+ in the above process definition is registered with the ruote engine as an
77
+ AMQPParticipant. The AMQPParticipant delivers workitems to the specified AMQP
78
+ queue.
79
+
80
+ Based on the values in +config/ruote.yml+, your daemon will be subscribed to
81
+ those queues.
82
+
83
+ The second part is delegating the workitem inside the daemon to the correct
84
+ pseudo-participant. This is handled by the +:command+ parameter in the process
85
+ definition. DaemonKit::Workitem looks at the command parameter of the incoming
86
+ workitem, and then finds a registered pseudo-participant instance and calls the
87
+ requested method on that class.
88
+
89
+ The +:command+ parameter follows the following convention (stolen shamelessly
90
+ from Nanite):
91
+
92
+ :command => '/class_name/method_name'
93
+
94
+ When classes are registered, the name of the class is downcased and camel-case
95
+ words are separated by underscores. Method names are not changed, but methods
96
+ are required to be public.
97
+
98
+ == Processing workitems and replying to the engine
99
+
100
+ The methods called in the pseudo-participants receive a single parameter, a
101
+ ruote workitem as a hash. The participant is then free to analyze the hash
102
+ and perform the appropriate actions required. The return value of the method
103
+ is discarded, and the workitem is returned back to the engine. If the method
104
+ modified the workitem, these changes will be sent along as well.
105
+
106
+ == Random other notes
107
+
108
+ Apart from configuring the AMPQ client (or XMPP in future) and the ruote.yml
109
+ file, daemon developers don't need to worry about anything related to receiving
110
+ workitems or sending replies.
111
+
112
+ Our aim is to allow you to swap between participants on both sides of the
113
+ transport without changing any of your code.