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,27 @@
1
+ # Generated jabber daemon
2
+
3
+ # Do your post daemonization configuration here
4
+ # At minimum you need just the first line (without the block), or a lot
5
+ # of strange things might start happening...
6
+ DaemonKit::Application.running! do |config|
7
+ # Trap signals with blocks or procs
8
+ # config.trap( 'INT' ) do
9
+ # # do something clever
10
+ # end
11
+ # config.trap( 'TERM', Proc.new { puts 'Going down' } )
12
+ end
13
+
14
+ # IMPORTANT CONFIGURATION NOTE
15
+ #
16
+ # Please review and update 'config/jabber.yml' accordingly or this
17
+ # daemon won't work as advertised.
18
+
19
+ # This block gets called every time a message has been received from a
20
+ # valid master.
21
+ DaemonKit::Jabber.received_messages do |message|
22
+ # Simple echo service
23
+ DaemonKit::Jabber.deliver( message.from, message.body )
24
+ end
25
+
26
+ # Run our Jabber bot
27
+ DaemonKit::Jabber.run
@@ -0,0 +1,68 @@
1
+ class NaniteAgentGenerator < RubiGen::Base
2
+
3
+ default_options :author => nil
4
+
5
+ attr_reader :name
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ super
9
+ usage if args.empty?
10
+ @name = args.shift
11
+ extract_options
12
+ end
13
+
14
+ def manifest
15
+ record do |m|
16
+ # Ensure appropriate folder(s) exists
17
+ m.directory ''
18
+
19
+ # Create stubs
20
+ # m.template "template.rb.erb", "some_file_after_erb.rb"
21
+ # m.template_copy_each ["template.rb", "template2.rb"]
22
+ # m.template_copy_each ["template.rb", "template2.rb"], "some/path"
23
+ # m.file "file", "some_file_copied"
24
+ # m.file_copy_each ["path/to/file", "path/to/file2"]
25
+ # m.file_copy_each ["path/to/file", "path/to/file2"], "some/path"
26
+
27
+ # Copy over our configs
28
+ m.directory 'lib'
29
+ m.directory 'lib/actors'
30
+ m.file 'lib/actors/sample.rb', 'lib/actors/sample.rb'
31
+ m.directory 'config'
32
+ m.template 'config/nanite.yml', 'config/nanite.yml'
33
+ m.directory 'config/initializers'
34
+ m.template 'config/initializers/nanite_agent.rb', "config/initializers/#{name}.rb"
35
+
36
+ # Copy over our daemon
37
+ m.directory 'libexec'
38
+ m.template 'libexec/daemon.rb', "libexec/#{name}-daemon.rb"
39
+ end
40
+ end
41
+
42
+ protected
43
+ def banner
44
+ <<-EOS
45
+ Creates a ...
46
+
47
+ USAGE: #{$0} #{spec.name} name
48
+ EOS
49
+ end
50
+
51
+ def add_options!(opts)
52
+ # opts.separator ''
53
+ # opts.separator 'Options:'
54
+ # For each option below, place the default
55
+ # at the top of the file next to "default_options"
56
+ # opts.on("-a", "--author=\"Your Name\"", String,
57
+ # "Some comment about this option",
58
+ # "Default: none") { |o| options[:author] = o }
59
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
60
+ end
61
+
62
+ def extract_options
63
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
64
+ # Templates can access these value via the attr_reader-generated methods, but not the
65
+ # raw instance variable value.
66
+ # @author = options[:author]
67
+ end
68
+ end
@@ -0,0 +1,6 @@
1
+ begin
2
+ require 'nanite'
3
+ rescue LoadError
4
+ $stderr.puts "Missing nanite gem. Please run 'gem install nanite'."
5
+ exit 1
6
+ end
@@ -0,0 +1,35 @@
1
+ # Nanite agent configuration file
2
+
3
+ # These values will be used to configure the nanite agent, any values
4
+ # omitted will let the gem use it's own defaults.
5
+
6
+ # The configuration specifies the following keys:
7
+ # * user - Specify the rabbitmq username
8
+ # * pass - Specify the rabbitmq password
9
+ # * host - Specify the rabbitmq hostname
10
+ # * vhost - Specify the rabbitmq vhost
11
+ # * port - Specify the rabbitmq PORT, default 5672
12
+ # * token - Specify the agent identity
13
+ # * security - Use Security features of rabbitmq to restrict nanites to themselves
14
+ # * format - The serialization type to use for transfering data. Can be marshal, json or yaml. Default is marshal
15
+ # * tag - YAML array of tags
16
+ # * ping-time - Specify how often the agents contacts the mapper
17
+ # * actors - Comma separated list of actors to load (all ruby files in actors directory by default)
18
+
19
+ defaults: &defaults
20
+ user: nanite
21
+ pass: testing
22
+ host: localhost
23
+ vhost: /nanite
24
+ # tag:
25
+ # - foo
26
+ # - bar
27
+
28
+ development:
29
+ <<: *defaults
30
+
31
+ test:
32
+ <<: *defaults
33
+
34
+ production:
35
+ <<: *defaults
@@ -0,0 +1,11 @@
1
+ class Sample
2
+ include Nanite::Actor
3
+
4
+ expose :echo
5
+
6
+ # Print to STDOUT and return
7
+ def echo( payload )
8
+ p payload
9
+ payload
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ # Generated nanite agent daemon
2
+
3
+ # Do your post daemonization configuration here
4
+ # At minimum you need just the first line (without the block), or a lot
5
+ # of strange things might start happening...
6
+ DaemonKit::Application.running! do |config|
7
+ # Trap signals with blocks or procs
8
+ # config.trap( 'INT' ) do
9
+ # # do something clever
10
+ # end
11
+ # config.trap( 'TERM', Proc.new { puts 'Going down' } )
12
+ end
13
+
14
+ # IMPORTANT CONFIGURATION NOTE
15
+ #
16
+ # Please review and update 'config/nanite.yml' accordingly or this
17
+ # daemon won't work as advertised.
18
+ #
19
+ # Your actors live in DAEMON_ROOT/lib/actors
20
+
21
+ # Run the agent, and get the running agent.
22
+ DaemonKit::Nanite::Agent.run do |agent|
23
+ # Use the yielded agent instance to register your actors:
24
+ agent.register Sample.new
25
+
26
+ # This block can used to make your agent perform other tasks as
27
+ # well. Remember that you have access to a running EventMachine
28
+ # reactor since the AMQP gem used by nanite uses it. Other than that
29
+ # you can mostly leave this file alone and concentrate on developing
30
+ # your actors in the lib/actors/ directory of the project.
31
+ end
@@ -0,0 +1,55 @@
1
+
2
+ class RspecGenerator < RubiGen::Base
3
+
4
+ attr_reader :gem_name, :module_name
5
+
6
+ def initialize(runtime_args, runtime_options = {})
7
+ super
8
+ @destination_root = File.expand_path(destination_root)
9
+ @gem_name = base_name
10
+ @module_name = @gem_name.camelcase
11
+ extract_options
12
+ end
13
+
14
+ def manifest
15
+ record do |m|
16
+ # Ensure appropriate folder(s) exists
17
+ m.directory 'spec'
18
+ m.directory 'tasks'
19
+
20
+ m.template 'spec.rb', "spec/#{gem_name}_spec.rb"
21
+
22
+ m.template_copy_each %w( spec.opts spec_helper.rb ), 'spec'
23
+ m.file_copy_each %w( rspec.rake ), 'tasks'
24
+ end
25
+ end
26
+
27
+ protected
28
+ def banner
29
+ <<-EOS
30
+ Install rspec BDD testing support.
31
+
32
+ Includes a rake task (tasks/rspec.rake) to be loaded by the root Rakefile,
33
+ which provides a "spec" task.
34
+
35
+ USAGE: #{$0} [options]
36
+ EOS
37
+ end
38
+
39
+ def add_options!(opts)
40
+ # opts.separator ''
41
+ # opts.separator 'Options:'
42
+ # For each option below, place the default
43
+ # at the top of the file next to "default_options"
44
+ # opts.on("-a", "--author=\"Your Name\"", String,
45
+ # "Some comment about this option",
46
+ # "Default: none") { |x| options[:author] = x }
47
+ end
48
+
49
+ def extract_options
50
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
51
+ # Templates can access these value via the attr_reader-generated methods, but not the
52
+ # raw instance variable value.
53
+ # @author = options[:author]
54
+ end
55
+ end
@@ -0,0 +1,11 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ # Time to add your specs!
4
+ # http://rspec.info/
5
+ describe "Place your specs here" do
6
+
7
+ it "find this spec in spec directory" do
8
+ violated "Be sure to write your specs"
9
+ end
10
+
11
+ end
@@ -0,0 +1,23 @@
1
+ DAEMON_ENV = 'test' unless defined?( DAEMON_ENV )
2
+
3
+ begin
4
+ require 'spec'
5
+ rescue LoadError
6
+ require 'rubygems'
7
+ gem 'rspec'
8
+ require 'spec'
9
+ end
10
+
11
+ require File.dirname(__FILE__) + '/../config/environment'
12
+ DaemonKit::Application.running!
13
+
14
+ Spec::Runner.configure do |config|
15
+ # == Mock Framework
16
+ #
17
+ # RSpec uses it's own mocking framework by default. If you prefer to
18
+ # use mocha, flexmock or RR, uncomment the appropriate line:
19
+ #
20
+ # config.mock_with :mocha
21
+ # config.mock_with :flexmock
22
+ # config.mock_with :rr
23
+ end
@@ -0,0 +1,19 @@
1
+ begin
2
+ require 'spec'
3
+ require 'spec/rake/spectask'
4
+ rescue LoadError
5
+ puts <<-EOS
6
+ To use rspec for testing you must install rspec gem:
7
+ gem install rspec
8
+ EOS
9
+ end
10
+
11
+ begin
12
+ desc "Run the specs under spec/"
13
+ Spec::Rake::SpecTask.new do |t|
14
+ t.spec_opts = ['--options', "spec/spec.opts"]
15
+ t.spec_files = FileList['spec/**/*_spec.rb']
16
+ end
17
+ rescue NameError
18
+ # No loss, warning printed already
19
+ end
@@ -0,0 +1,67 @@
1
+ class RuoteGenerator < RubiGen::Base
2
+
3
+ default_options :author => nil
4
+
5
+ attr_reader :name
6
+
7
+ def initialize(runtime_args, runtime_options = {})
8
+ super
9
+ usage if args.empty?
10
+ @name = args.shift
11
+ extract_options
12
+ end
13
+
14
+ def manifest
15
+ record do |m|
16
+ # Ensure appropriate folder(s) exists
17
+ m.directory ''
18
+
19
+ # Create stubs
20
+ # m.template "template.rb.erb", "some_file_after_erb.rb"
21
+ # m.template_copy_each ["template.rb", "template2.rb"]
22
+ # m.template_copy_each ["template.rb", "template2.rb"], "some/path"
23
+ # m.file "file", "some_file_copied"
24
+ # m.file_copy_each ["path/to/file", "path/to/file2"]
25
+ # m.file_copy_each ["path/to/file", "path/to/file2"], "some/path"
26
+
27
+ m.directory 'config'
28
+ m.template 'config/amqp.yml', 'config/amqp.yml'
29
+ m.template 'config/ruote.yml', 'config/ruote.yml'
30
+ m.directory 'config/initializers'
31
+ m.template 'config/initializers/ruote.rb', "config/initializers/#{name}.rb"
32
+
33
+ m.directory 'lib'
34
+ m.template 'lib/daemon.rb', "lib/#{name}.rb"
35
+ m.template 'lib/sample.rb', 'lib/sample.rb'
36
+ m.directory 'libexec'
37
+ m.template 'libexec/daemon.rb', "libexec/#{name}-daemon.rb"
38
+ end
39
+ end
40
+
41
+ protected
42
+ def banner
43
+ <<-EOS
44
+ Creates a ...
45
+
46
+ USAGE: #{$0} #{spec.name} name
47
+ EOS
48
+ end
49
+
50
+ def add_options!(opts)
51
+ # opts.separator ''
52
+ # opts.separator 'Options:'
53
+ # For each option below, place the default
54
+ # at the top of the file next to "default_options"
55
+ # opts.on("-a", "--author=\"Your Name\"", String,
56
+ # "Some comment about this option",
57
+ # "Default: none") { |o| options[:author] = o }
58
+ # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
59
+ end
60
+
61
+ def extract_options
62
+ # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
63
+ # Templates can access these value via the attr_reader-generated methods, but not the
64
+ # raw instance variable value.
65
+ # @author = options[:author]
66
+ end
67
+ end
@@ -0,0 +1,30 @@
1
+ # AMQP client configuration file for ruote remote participants. If you are not
2
+ # planning to use the AMQP participant/listener pair in ruote, you can safely
3
+ # delete this file.
4
+
5
+ # These values will be used to configure the ampq gem, any values
6
+ # omitted will let the gem use it's own defaults.
7
+
8
+ # The configuration specifies the following keys:
9
+ # * user - Username for the broker
10
+ # * pass - Password for the broker
11
+ # * host - Hostname where the broker is running
12
+ # * vhost - Vhost to connect to
13
+ # * port - Port where the broker is running
14
+ # * ssl - Use ssl or not
15
+ # * timeout - Timeout
16
+
17
+ defaults: &defaults
18
+ user: guest
19
+ pass: guest
20
+ host: localhost
21
+ vhost: /
22
+
23
+ development:
24
+ <<: *defaults
25
+
26
+ test:
27
+ <<: *defaults
28
+
29
+ production:
30
+ <<: *defaults
@@ -0,0 +1,13 @@
1
+ begin
2
+ require 'json'
3
+ rescue LoadError
4
+ $stderr.puts "Missing json gem. Please run 'gem install json'"
5
+ exit 1
6
+ end
7
+
8
+ begin
9
+ require 'amqp'
10
+ require 'mq'
11
+ rescue LoadError
12
+ $stderr.puts "Missing amqp gem. Please run 'gem install amqp' if you wish to use the AMQP participant/listener pair in ruote"
13
+ end
@@ -0,0 +1,23 @@
1
+ # Sample configuration file for a remote participant daemon
2
+
3
+ # If your using the AMQP listener/participant pair in ruote, you only
4
+ # need to specify the names of the queues to subscribe to.
5
+
6
+ defaults: &defaults
7
+ amqp:
8
+ queues:
9
+ - work1
10
+ #- work2
11
+ #- work3
12
+
13
+ development:
14
+ <<: *defaults
15
+
16
+ test:
17
+ <<: *defaults
18
+
19
+ staging:
20
+ <<: *defaults
21
+
22
+ production:
23
+ <<: *defaults