amqp-daemon-kit 0.1.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (185) hide show
  1. data/.gitignore +5 -0
  2. data/Configuration.txt +110 -0
  3. data/Deployment.txt +113 -0
  4. data/History.txt +131 -0
  5. data/Logging.txt +96 -0
  6. data/PostInstall.txt +6 -0
  7. data/README.rdoc +132 -0
  8. data/Rakefile +29 -0
  9. data/RuoteParticipants.txt +113 -0
  10. data/TODO.txt +27 -0
  11. data/bin/daemon-kit +18 -0
  12. data/config/website.yml +2 -0
  13. data/daemon-kit.gemspec +265 -0
  14. data/lib/daemon_kit.rb +60 -0
  15. data/lib/daemon_kit/abstract_logger.rb +249 -0
  16. data/lib/daemon_kit/application.rb +230 -0
  17. data/lib/daemon_kit/arguments.rb +165 -0
  18. data/lib/daemon_kit/commands/console.rb +38 -0
  19. data/lib/daemon_kit/commands/destroy.rb +10 -0
  20. data/lib/daemon_kit/commands/generate.rb +10 -0
  21. data/lib/daemon_kit/config.rb +113 -0
  22. data/lib/daemon_kit/console_daemon.rb +2 -0
  23. data/lib/daemon_kit/core_ext.rb +1 -0
  24. data/lib/daemon_kit/core_ext/configurable.rb +96 -0
  25. data/lib/daemon_kit/core_ext/string.rb +22 -0
  26. data/lib/daemon_kit/cron.rb +67 -0
  27. data/lib/daemon_kit/cucumber/world.rb +38 -0
  28. data/lib/daemon_kit/deployment/capistrano.rb +516 -0
  29. data/lib/daemon_kit/dk_amqp.rb +39 -0
  30. data/lib/daemon_kit/em.rb +43 -0
  31. data/lib/daemon_kit/error_handlers/base.rb +32 -0
  32. data/lib/daemon_kit/error_handlers/hoptoad.rb +180 -0
  33. data/lib/daemon_kit/exceptions.rb +15 -0
  34. data/lib/daemon_kit/generators.rb +67 -0
  35. data/lib/daemon_kit/generators/base.rb +60 -0
  36. data/lib/daemon_kit/initializer.rb +449 -0
  37. data/lib/daemon_kit/jabber.rb +171 -0
  38. data/lib/daemon_kit/nanite.rb +7 -0
  39. data/lib/daemon_kit/nanite/agent.rb +77 -0
  40. data/lib/daemon_kit/pid_file.rb +61 -0
  41. data/lib/daemon_kit/ruote_participants.rb +125 -0
  42. data/lib/daemon_kit/ruote_pseudo_participant.rb +68 -0
  43. data/lib/daemon_kit/ruote_workitem.rb +187 -0
  44. data/lib/daemon_kit/safety.rb +84 -0
  45. data/lib/daemon_kit/tasks.rb +2 -0
  46. data/lib/daemon_kit/tasks/environment.rake +11 -0
  47. data/lib/daemon_kit/tasks/framework.rake +123 -0
  48. data/lib/daemon_kit/tasks/god.rake +62 -0
  49. data/lib/daemon_kit/tasks/log.rake +8 -0
  50. data/lib/daemon_kit/tasks/monit.rake +29 -0
  51. data/lib/daemon_kit/vendor/thor-0.13.6/CHANGELOG.rdoc +89 -0
  52. data/lib/daemon_kit/vendor/thor-0.13.6/LICENSE +20 -0
  53. data/lib/daemon_kit/vendor/thor-0.13.6/README.rdoc +297 -0
  54. data/lib/daemon_kit/vendor/thor-0.13.6/Thorfile +69 -0
  55. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor.rb +244 -0
  56. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions.rb +296 -0
  57. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/create_file.rb +103 -0
  58. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/directory.rb +91 -0
  59. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/empty_directory.rb +134 -0
  60. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/file_manipulation.rb +223 -0
  61. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/actions/inject_into_file.rb +104 -0
  62. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/base.rb +540 -0
  63. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/file_binary_read.rb +9 -0
  64. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/hash_with_indifferent_access.rb +75 -0
  65. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/core_ext/ordered_hash.rb +100 -0
  66. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/error.rb +30 -0
  67. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/group.rb +271 -0
  68. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/invocation.rb +180 -0
  69. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser.rb +4 -0
  70. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/argument.rb +67 -0
  71. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/arguments.rb +150 -0
  72. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/option.rb +128 -0
  73. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/parser/options.rb +169 -0
  74. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/rake_compat.rb +66 -0
  75. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/runner.rb +314 -0
  76. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell.rb +83 -0
  77. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell/basic.rb +239 -0
  78. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/shell/color.rb +108 -0
  79. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/task.rb +102 -0
  80. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/util.rb +224 -0
  81. data/lib/daemon_kit/vendor/thor-0.13.6/lib/thor/version.rb +3 -0
  82. data/lib/daemon_kit/xmpp.rb +100 -0
  83. data/lib/generators/daemon_kit/amqp/USAGE +5 -0
  84. data/lib/generators/daemon_kit/amqp/amqp_generator.rb +24 -0
  85. data/lib/generators/daemon_kit/amqp/templates/config/amqp.yml +28 -0
  86. data/lib/generators/daemon_kit/amqp/templates/config/pre-daemonize/amqp.rb +7 -0
  87. data/lib/generators/daemon_kit/amqp/templates/libexec/%app_name%-daemon.rb +37 -0
  88. data/lib/generators/daemon_kit/app/USAGE +7 -0
  89. data/lib/generators/daemon_kit/app/app_generator.rb +140 -0
  90. data/lib/generators/daemon_kit/app/templates/Gemfile +12 -0
  91. data/lib/generators/daemon_kit/app/templates/README.tt +58 -0
  92. data/lib/generators/daemon_kit/app/templates/Rakefile +6 -0
  93. data/lib/generators/daemon_kit/app/templates/bin/daemon.tt +7 -0
  94. data/lib/generators/daemon_kit/app/templates/config/arguments.rb +12 -0
  95. data/lib/generators/daemon_kit/app/templates/config/boot.rb +70 -0
  96. data/lib/generators/daemon_kit/app/templates/config/environment.rb.tt +26 -0
  97. data/lib/generators/daemon_kit/app/templates/config/environments/development.rb +2 -0
  98. data/lib/generators/daemon_kit/app/templates/config/environments/production.rb +5 -0
  99. data/lib/generators/daemon_kit/app/templates/config/environments/test.rb +2 -0
  100. data/lib/generators/daemon_kit/app/templates/config/post-daemonize/readme +5 -0
  101. data/lib/generators/daemon_kit/app/templates/config/pre-daemonize/readme +12 -0
  102. data/lib/generators/daemon_kit/app/templates/lib/%app_name%.rb +2 -0
  103. data/lib/generators/daemon_kit/app/templates/libexec/%app_name%-daemon.rb +18 -0
  104. data/lib/generators/daemon_kit/app/templates/script/console +3 -0
  105. data/lib/generators/daemon_kit/app/templates/script/destroy +3 -0
  106. data/lib/generators/daemon_kit/app/templates/script/generate +3 -0
  107. data/lib/generators/daemon_kit/capistrano/capistrano_generator.rb +26 -0
  108. data/lib/generators/daemon_kit/capistrano/templates/Capfile +10 -0
  109. data/lib/generators/daemon_kit/capistrano/templates/USAGE +10 -0
  110. data/lib/generators/daemon_kit/capistrano/templates/config/deploy.rb.tt +67 -0
  111. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/logrotate.erb +13 -0
  112. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/production.rb.tt +6 -0
  113. data/lib/generators/daemon_kit/capistrano/templates/config/deploy/staging.rb.tt +6 -0
  114. data/lib/generators/daemon_kit/capistrano/templates/config/environments/staging.rb +0 -0
  115. data/lib/generators/daemon_kit/cron/USAGE +5 -0
  116. data/lib/generators/daemon_kit/cron/cron_generator.rb +24 -0
  117. data/lib/generators/daemon_kit/cron/templates/config/pre-daemonize/cron.rb +11 -0
  118. data/lib/generators/daemon_kit/cron/templates/libexec/%app_name%-daemon.rb +48 -0
  119. data/lib/generators/daemon_kit/cucumber/USAGE +11 -0
  120. data/lib/generators/daemon_kit/cucumber/cucumber_generator.rb +45 -0
  121. data/lib/generators/daemon_kit/cucumber/templates/config/environments/cucumber.rb +2 -0
  122. data/lib/generators/daemon_kit/cucumber/templates/features/step_definitions/.empty_directory +0 -0
  123. data/lib/generators/daemon_kit/cucumber/templates/features/support/env.rb +7 -0
  124. data/lib/generators/daemon_kit/cucumber/templates/script/cucumber +7 -0
  125. data/lib/generators/daemon_kit/cucumber/templates/tasks/cucumber.rake +13 -0
  126. data/lib/generators/daemon_kit/nanite_agent/USAGE +5 -0
  127. data/lib/generators/daemon_kit/nanite_agent/nanite_agent_generator.rb +29 -0
  128. data/lib/generators/daemon_kit/nanite_agent/templates/config/nanite.yml +35 -0
  129. data/lib/generators/daemon_kit/nanite_agent/templates/config/pre-daemonize/nanite_agent.rb +6 -0
  130. data/lib/generators/daemon_kit/nanite_agent/templates/lib/actors/sample.rb +11 -0
  131. data/lib/generators/daemon_kit/nanite_agent/templates/libexec/%app_name%-daemon.rb +31 -0
  132. data/lib/generators/daemon_kit/rspec/USAGE +5 -0
  133. data/lib/generators/daemon_kit/rspec/rspec_generator.rb +20 -0
  134. data/lib/generators/daemon_kit/rspec/templates/spec/%app_name%_spec.rb +11 -0
  135. data/lib/generators/daemon_kit/rspec/templates/spec/spec.opts +1 -0
  136. data/lib/generators/daemon_kit/rspec/templates/spec/spec_helper.rb +23 -0
  137. data/lib/generators/daemon_kit/rspec/templates/tasks/rspec.rake +21 -0
  138. data/lib/generators/daemon_kit/ruote/USAGE +5 -0
  139. data/lib/generators/daemon_kit/ruote/ruote_generator.rb +29 -0
  140. data/lib/generators/daemon_kit/ruote/templates/config/amqp.yml +30 -0
  141. data/lib/generators/daemon_kit/ruote/templates/config/pre-daemonize/ruote.rb +13 -0
  142. data/lib/generators/daemon_kit/ruote/templates/config/ruote.yml +23 -0
  143. data/lib/generators/daemon_kit/ruote/templates/lib/%app_name%.rb +4 -0
  144. data/lib/generators/daemon_kit/ruote/templates/lib/sample.rb +26 -0
  145. data/lib/generators/daemon_kit/ruote/templates/libexec/%app_name%-daemon.rb +33 -0
  146. data/lib/generators/daemon_kit/test_unit/USAGE +5 -0
  147. data/lib/generators/daemon_kit/test_unit/templates/tasks/test_unit.rake +7 -0
  148. data/lib/generators/daemon_kit/test_unit/templates/test/%app_name%_test.rb.tt +9 -0
  149. data/lib/generators/daemon_kit/test_unit/templates/test/test_helper.rb +6 -0
  150. data/lib/generators/daemon_kit/test_unit/test_unit_generator.rb +20 -0
  151. data/lib/generators/daemon_kit/xmpp/templates/config/pre-daemonize/xmpp.rb +6 -0
  152. data/lib/generators/daemon_kit/xmpp/templates/config/xmpp.yml +29 -0
  153. data/lib/generators/daemon_kit/xmpp/templates/libexec/%app_name%-daemon.rb +27 -0
  154. data/lib/generators/daemon_kit/xmpp/xmpp_generator.rb +24 -0
  155. data/script/console +10 -0
  156. data/script/destroy +14 -0
  157. data/script/generate +14 -0
  158. data/script/txt2html +71 -0
  159. data/spec/abstract_logger_spec.rb +126 -0
  160. data/spec/argument_spec.rb +70 -0
  161. data/spec/config_spec.rb +83 -0
  162. data/spec/configurable_spec.rb +56 -0
  163. data/spec/daemon_kit_spec.rb +7 -0
  164. data/spec/error_handlers_spec.rb +23 -0
  165. data/spec/fixtures/env.yml +15 -0
  166. data/spec/fixtures/noenv.yml +4 -0
  167. data/spec/initializer_spec.rb +26 -0
  168. data/spec/spec.opts +1 -0
  169. data/spec/spec_helper.rb +27 -0
  170. data/tasks/cucumber.rake +13 -0
  171. data/tasks/rspec.rake +20 -0
  172. data/tasks/tests.rake +6 -0
  173. data/templates/god/god.erb +69 -0
  174. data/templates/monit/monit.erb +14 -0
  175. data/test/test_amqp_generator.rb +48 -0
  176. data/test/test_cron_generator.rb +45 -0
  177. data/test/test_daemon-kit_generator.rb +84 -0
  178. data/test/test_daemon_kit_config.rb +28 -0
  179. data/test/test_deploy_capistrano_generator.rb +48 -0
  180. data/test/test_generator_helper.rb +29 -0
  181. data/test/test_helper.rb +7 -0
  182. data/test/test_nanite_agent_generator.rb +49 -0
  183. data/test/test_ruote_generator.rb +51 -0
  184. data/test/test_test_unit_generator.rb +46 -0
  185. metadata +302 -0
@@ -0,0 +1,11 @@
1
+ begin
2
+ require 'rufus/scheduler'
3
+ rescue LoadError => e
4
+ $stderr.puts "Missing rufus-scheduler gem. Please run 'bundle install'."
5
+ exit 1
6
+ end
7
+
8
+ if Rufus::Scheduler::VERSION < "2.0.0"
9
+ $stderr.puts "Requires rufus-scheduler-2.0.0 or later"
10
+ exit 1
11
+ end
@@ -0,0 +1,48 @@
1
+ # Generated cron 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
+ # Configuration documentation available at http://rufus.rubyforge.org/rufus-scheduler/
15
+ # An instance of the scheduler is available through
16
+ # DaemonKit::Cron.scheduler
17
+
18
+ # To make use of the EventMachine-powered scheduler, uncomment the
19
+ # line below *before* adding any schedules.
20
+ # DaemonKit::EM.run
21
+
22
+ # Some samples to get you going:
23
+
24
+ # Will call #regenerate_monthly_report in 3 days from starting up
25
+ #DaemonKit::Cron.scheduler.in("3d") do
26
+ # regenerate_monthly_report()
27
+ #end
28
+ #
29
+ #DaemonKit::Cron.scheduler.every "10m10s" do
30
+ # check_score(favourite_team) # every 10 minutes and 10 seconds
31
+ #end
32
+ #
33
+ #DaemonKit::Cron.scheduler.cron "0 22 * * 1-5" do
34
+ # DaemonKit.logger.info "activating security system..."
35
+ # activate_security_system()
36
+ #end
37
+ #
38
+ # Example error handling (NOTE: all exceptions in scheduled tasks are logged)
39
+ #DaemonKit::Cron.handle_exception do |job, exception|
40
+ # DaemonKit.logger.error "Caught exception in job #{job.job_id}: '#{exception}'"
41
+ #end
42
+
43
+ DaemonKit::Cron.scheduler.every("1m") do
44
+ DaemonKit.logger.debug "Scheduled task completed at #{Time.now}"
45
+ end
46
+
47
+ # Run our 'cron' dameon, suspending the current thread
48
+ DaemonKit::Cron.run
@@ -0,0 +1,11 @@
1
+ Description:
2
+ Sets up Cucumber in your daemon-kit project. After running this generator you will
3
+ get a new rake task called features.
4
+
5
+ This also generates the necessary files in the features directory.
6
+
7
+ Also see the feature generator, which you can use to generate skeletons
8
+ for new features.
9
+
10
+ Examples:
11
+ `./script/generate cucumber`
@@ -0,0 +1,45 @@
1
+ require 'cucumber'
2
+
3
+ module DaemonKit
4
+ module Generators
5
+ class CucumberGenerator < Base
6
+ include Thor::Actions
7
+
8
+ add_shebang_option!
9
+
10
+ def create_features
11
+ directory 'features'
12
+ end
13
+
14
+ def create_environment
15
+ template 'config/environments/cucumber.rb'
16
+ end
17
+
18
+ def create_tasks
19
+ copy_file 'tasks/cucumber.rake'
20
+ end
21
+
22
+ def create_script
23
+ copy_file 'script/cucumber' do |content|
24
+ "#{shebang}\n" + content
25
+ end
26
+ chmod 'script', 0755, :verbose => false
27
+ end
28
+
29
+ no_tasks {
30
+
31
+ def cucumber_version
32
+ ::Cucumber::VERSION
33
+ end
34
+
35
+ }
36
+
37
+ protected
38
+
39
+ def self.source_root
40
+ File.expand_path( File.join( File.dirname(__FILE__), 'templates') )
41
+ end
42
+
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,2 @@
1
+ gem "cucumber", ">=<%= cucumber_version %>"
2
+ gem "rspec", ">=1.2.6"
@@ -0,0 +1,7 @@
1
+ # Sets up the DaemonKit environment for Cucumber
2
+ ENV["DAEMON_ENV"] ||= "cucumber"
3
+ require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
4
+ require 'daemon_kit/cucumber/world'
5
+
6
+ # Comment out the next line if you don't want Cucumber Unicode support
7
+ require 'cucumber/formatter/unicode'
@@ -0,0 +1,7 @@
1
+ begin
2
+ load File.expand_path(File.dirname(__FILE__) + "/../vendor/plugins/cucumber/bin/cucumber")
3
+ rescue LoadError => e
4
+ raise unless e.to_s =~ /cucumber/
5
+ require "rubygems"
6
+ load File.join(Gem.bindir, "cucumber")
7
+ end
@@ -0,0 +1,13 @@
1
+ begin
2
+ require 'cucumber/rake/task'
3
+
4
+ Cucumber::Rake::Task.new(:features) do |t|
5
+ t.fork = true
6
+ t.cucumber_opts = ['--format', (ENV['CUCUMBER_FORMAT'] || 'pretty')]
7
+ end
8
+ rescue LoadError
9
+ desc 'Cucumber rake task not available'
10
+ task :features do
11
+ abort 'Cucumber rake task is not available. Be sure to install cucumber as a gem or plugin'
12
+ end
13
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,29 @@
1
+ module DaemonKit
2
+ module Generators
3
+ class NaniteAgentGenerator < Base
4
+
5
+ def update_gemfile
6
+ append_file 'Gemfile', "gem 'nanite'\n"
7
+ end
8
+
9
+ def create_config
10
+ directory 'config'
11
+ end
12
+
13
+ def create_actors
14
+ directory 'lib'
15
+ end
16
+
17
+ def create_libexec
18
+ directory 'libexec'
19
+ end
20
+
21
+ protected
22
+
23
+ def self.source_root
24
+ File.expand_path( File.join( File.dirname(__FILE__), 'templates') )
25
+ end
26
+
27
+ end
28
+ end
29
+ 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,6 @@
1
+ begin
2
+ require 'nanite'
3
+ rescue LoadError
4
+ $stderr.puts "Missing nanite gem. Please run 'bundle install'."
5
+ exit 1
6
+ end
@@ -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,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,20 @@
1
+ module DaemonKit
2
+ module Generators
3
+ class SpecGenerator < Base
4
+
5
+ def create_specs
6
+ directory 'spec'
7
+ end
8
+
9
+ def create_task
10
+ directory 'tasks'
11
+ end
12
+
13
+ protected
14
+
15
+ def self.source_root
16
+ File.expand_path( File.join( File.dirname(__FILE__), 'templates') )
17
+ end
18
+ end
19
+ end
20
+ 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,21 @@
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
+ require 'spec/rake/spectask'
13
+
14
+ desc "Run the specs under spec/"
15
+ Spec::Rake::SpecTask.new do |t|
16
+ t.spec_opts = ['--options', "spec/spec.opts"]
17
+ t.spec_files = FileList['spec/**/*_spec.rb']
18
+ end
19
+ rescue NameError, LoadError
20
+ # No loss, warning printed already
21
+ end
@@ -0,0 +1,5 @@
1
+ Description:
2
+
3
+
4
+ Usage:
5
+
@@ -0,0 +1,29 @@
1
+ module DaemonKit
2
+ module Generators
3
+ class RuoteGenerator < Base
4
+
5
+ def update_gemfile
6
+ append_file 'Gemfile', "gem 'amqp' # Only needed if running the AMQP participant/listener pair\n"
7
+ append_file 'Gemfile', "gem 'json' # Can be replaced with json_pure\n"
8
+ end
9
+
10
+ def create_configs
11
+ directory 'config'
12
+ end
13
+
14
+ def create_lib
15
+ directory 'lib', nil, :force => true
16
+ end
17
+
18
+ def create_daemon
19
+ directory 'libexec'
20
+ end
21
+
22
+ protected
23
+
24
+ def self.source_root
25
+ File.expand_path( File.join( File.dirname(__FILE__), 'templates') )
26
+ end
27
+ end
28
+ end
29
+ 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