daemon-kit 0.1.7 → 0.1.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. data/Configuration.txt +58 -0
  2. data/History.txt +24 -0
  3. data/Manifest.txt +50 -2
  4. data/PostInstall.txt +1 -1
  5. data/README.rdoc +7 -9
  6. data/Rakefile +2 -4
  7. data/TODO.txt +6 -5
  8. data/app_generators/daemon_kit/daemon_kit_generator.rb +5 -0
  9. data/app_generators/daemon_kit/templates/Rakefile +3 -1
  10. data/app_generators/daemon_kit/templates/bin/daemon.erb +1 -1
  11. data/app_generators/daemon_kit/templates/config/arguments.rb +12 -0
  12. data/app_generators/daemon_kit/templates/config/boot.rb +2 -2
  13. data/app_generators/daemon_kit/templates/script/console +3 -0
  14. data/app_generators/daemon_kit/templates/script/destroy +14 -0
  15. data/app_generators/daemon_kit/templates/script/generate +14 -0
  16. data/daemon_generators/amqp/templates/config/amqp.yml +5 -5
  17. data/daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb +4 -23
  18. data/daemon_generators/deploy_capistrano/templates/USAGE +10 -0
  19. data/daemon_generators/deploy_capistrano/templates/config/deploy.rb +3 -1
  20. data/lib/daemon_kit.rb +33 -5
  21. data/lib/daemon_kit/amqp.rb +2 -1
  22. data/lib/daemon_kit/application.rb +136 -11
  23. data/lib/daemon_kit/arguments.rb +151 -0
  24. data/lib/daemon_kit/commands/console.rb +38 -0
  25. data/lib/daemon_kit/config.rb +1 -0
  26. data/lib/daemon_kit/console_daemon.rb +2 -0
  27. data/lib/daemon_kit/core_ext.rb +1 -0
  28. data/lib/daemon_kit/core_ext/string.rb +22 -0
  29. data/lib/daemon_kit/deployment/capistrano.rb +6 -9
  30. data/lib/daemon_kit/error_handlers/mail.rb +52 -15
  31. data/lib/daemon_kit/initializer.rb +95 -41
  32. data/lib/daemon_kit/pid_file.rb +61 -0
  33. data/lib/daemon_kit/tasks/environment.rake +5 -4
  34. data/lib/daemon_kit/tasks/framework.rake +15 -1
  35. data/lib/daemon_kit/tasks/god.rake +62 -0
  36. data/lib/daemon_kit/tasks/log.rake +8 -0
  37. data/lib/daemon_kit/tasks/monit.rake +29 -0
  38. data/spec/argument_spec.rb +51 -0
  39. data/spec/config_spec.rb +77 -0
  40. data/spec/daemon_kit_spec.rb +2 -2
  41. data/spec/error_handlers_spec.rb +23 -0
  42. data/spec/fixtures/env.yml +15 -0
  43. data/spec/fixtures/noenv.yml +4 -0
  44. data/spec/initializer_spec.rb +4 -3
  45. data/spec/spec_helper.rb +8 -11
  46. data/templates/god/god.erb +69 -0
  47. data/templates/monit/monit.erb +14 -0
  48. data/test/test_daemon-kit_generator.rb +6 -1
  49. data/test/test_deploy_capistrano_generator.rb +1 -2
  50. data/vendor/tmail-1.2.3/tmail.rb +5 -0
  51. data/vendor/tmail-1.2.3/tmail/address.rb +426 -0
  52. data/vendor/tmail-1.2.3/tmail/attachments.rb +46 -0
  53. data/vendor/tmail-1.2.3/tmail/base64.rb +46 -0
  54. data/vendor/tmail-1.2.3/tmail/compat.rb +41 -0
  55. data/vendor/tmail-1.2.3/tmail/config.rb +67 -0
  56. data/vendor/tmail-1.2.3/tmail/core_extensions.rb +63 -0
  57. data/vendor/tmail-1.2.3/tmail/encode.rb +581 -0
  58. data/vendor/tmail-1.2.3/tmail/header.rb +960 -0
  59. data/vendor/tmail-1.2.3/tmail/index.rb +9 -0
  60. data/vendor/tmail-1.2.3/tmail/interface.rb +1130 -0
  61. data/vendor/tmail-1.2.3/tmail/loader.rb +3 -0
  62. data/vendor/tmail-1.2.3/tmail/mail.rb +578 -0
  63. data/vendor/tmail-1.2.3/tmail/mailbox.rb +495 -0
  64. data/vendor/tmail-1.2.3/tmail/main.rb +6 -0
  65. data/vendor/tmail-1.2.3/tmail/mbox.rb +3 -0
  66. data/vendor/tmail-1.2.3/tmail/net.rb +248 -0
  67. data/vendor/tmail-1.2.3/tmail/obsolete.rb +132 -0
  68. data/vendor/tmail-1.2.3/tmail/parser.rb +1476 -0
  69. data/vendor/tmail-1.2.3/tmail/port.rb +379 -0
  70. data/vendor/tmail-1.2.3/tmail/quoting.rb +118 -0
  71. data/vendor/tmail-1.2.3/tmail/require_arch.rb +58 -0
  72. data/vendor/tmail-1.2.3/tmail/scanner.rb +49 -0
  73. data/vendor/tmail-1.2.3/tmail/scanner_r.rb +261 -0
  74. data/vendor/tmail-1.2.3/tmail/stringio.rb +280 -0
  75. data/vendor/tmail-1.2.3/tmail/utils.rb +337 -0
  76. data/vendor/tmail-1.2.3/tmail/version.rb +39 -0
  77. data/vendor/tmail.rb +13 -0
  78. metadata +57 -18
  79. data/daemon_generators/deploy_capistrano/USAGE +0 -5
  80. data/lib/daemon_kit/patches/force_kill_wait.rb +0 -120
data/Configuration.txt ADDED
@@ -0,0 +1,58 @@
1
+ = Configuring your daemon
2
+
3
+ daemon-kit provides a multitude of ways to configure your daemon, this document
4
+ will outline the different options available to you.
5
+
6
+ == Configuration files and #DaemonKit::Config
7
+
8
+ #DaemonKit::Config gives you easy access to any YAML configuration
9
+ files you have in your <em>config</em> directory.
10
+
11
+ You can access the configuration files like this:
12
+
13
+ config = DaemonKit::Config.load('sample')
14
+
15
+ The above snippet relies on the presence of a <em>config/sample.yml</em> file.
16
+
17
+ #DaemonKit::Config is environment aware, so configuration files are
18
+ parsed for a top-level key that is the same as the value of
19
+ <em>DAEMON_ENV</em>, and if present is loaded into the object as the
20
+ configuration data. If the key is not present, the whole YAML
21
+ document is exposed as configuration data.
22
+
23
+ == Command line arguments
24
+
25
+ The most flexible way to configure your daemon is through command line
26
+ arguments, or switches.
27
+
28
+ DaemonKit includes a couple of its own arguments that can be used:
29
+
30
+ -e ENV (or --env ENV) to set the daemon environment
31
+ --pid /path/to/pidfile to set the path to a pidfile
32
+ -v shows the DaemonKit version
33
+ -h shows a useful help message
34
+
35
+ === Custom arguments
36
+
37
+ It is possible for you to specify your own arguments as well, by
38
+ updating the <em>config/arguments.rb</em> file. This file is eval'd
39
+ inside #DaemonKit::Arguments and gives you access to the following two
40
+ variables:
41
+
42
+ * opts - Instance of OptionParser[http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html]
43
+ * @options - A standard Ruby hash that you can populate and access later
44
+
45
+ Your custom arguments can be accessed like this:
46
+
47
+ DaemonKit.arguments.options
48
+
49
+ === Advanced Configuration
50
+
51
+ All the writable attributes of the default #DaemonKit::Configuration
52
+ instance call also be modified from the command line using the special
53
+ <em>--config</em> arguments:
54
+
55
+ --config force_kill_wait=30
56
+
57
+ This happens after <em>config/environment.rb</em> is processed, so all
58
+ command line arguments will overwrite those values.
data/History.txt CHANGED
@@ -1,3 +1,27 @@
1
+ == 0.1.7.4 (Not released)
2
+
3
+ * Enhanced deploy.rb template to check for current dk gem verion,
4
+ unless vendored
5
+ * Fix bug in capistrano recipe for restarting daemons
6
+ * Added log:truncate rake task
7
+ * Error mails now handled by TMail
8
+
9
+ == 0.1.7.3 2009-05-31
10
+
11
+ * Removed dependency on daemons gem, now handled in house
12
+ * New argument management
13
+ * Some more docs
14
+
15
+ == 0.1.7.1 2009-05-28
16
+
17
+ * Fixed some minor issue with Capistrano support
18
+ * Added support for generating dog/monit configuration files via rake
19
+ * Initial implementation of ./script/* utilities
20
+
21
+ == 0.1.7 2009-05-26
22
+
23
+ * Capistrano deployment support
24
+
1
25
  == 0.1.6 2009-05-13
2
26
 
3
27
  * DaemonKit::Safety class to handle the trapping and logging of
data/Manifest.txt CHANGED
@@ -1,3 +1,4 @@
1
+ Configuration.txt
1
2
  History.txt
2
3
  Manifest.txt
3
4
  PostInstall.txt
@@ -9,6 +10,7 @@ app_generators/daemon_kit/daemon_kit_generator.rb
9
10
  app_generators/daemon_kit/templates/README
10
11
  app_generators/daemon_kit/templates/Rakefile
11
12
  app_generators/daemon_kit/templates/bin/daemon.erb
13
+ app_generators/daemon_kit/templates/config/arguments.rb
12
14
  app_generators/daemon_kit/templates/config/boot.rb
13
15
  app_generators/daemon_kit/templates/config/environment.rb
14
16
  app_generators/daemon_kit/templates/config/environments/development.rb
@@ -18,6 +20,9 @@ app_generators/daemon_kit/templates/config/post-daemonize/readme
18
20
  app_generators/daemon_kit/templates/config/pre-daemonize/readme
19
21
  app_generators/daemon_kit/templates/lib/daemon.rb
20
22
  app_generators/daemon_kit/templates/libexec/daemon.erb
23
+ app_generators/daemon_kit/templates/script/console
24
+ app_generators/daemon_kit/templates/script/destroy
25
+ app_generators/daemon_kit/templates/script/generate
21
26
  bin/daemon_kit
22
27
  daemon_generators/amqp/USAGE
23
28
  daemon_generators/amqp/amqp_generator.rb
@@ -28,9 +33,9 @@ daemon_generators/cron/USAGE
28
33
  daemon_generators/cron/cron_generator.rb
29
34
  daemon_generators/cron/templates/config/initializers/cron.rb
30
35
  daemon_generators/cron/templates/libexec/daemon.rb
31
- daemon_generators/deploy_capistrano/USAGE
32
36
  daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb
33
37
  daemon_generators/deploy_capistrano/templates/Capfile
38
+ daemon_generators/deploy_capistrano/templates/USAGE
34
39
  daemon_generators/deploy_capistrano/templates/config/deploy.rb
35
40
  daemon_generators/deploy_capistrano/templates/config/deploy/production.rb
36
41
  daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb
@@ -49,7 +54,12 @@ daemon_generators/nanite_agent/templates/libexec/daemon.rb
49
54
  lib/daemon_kit.rb
50
55
  lib/daemon_kit/amqp.rb
51
56
  lib/daemon_kit/application.rb
57
+ lib/daemon_kit/arguments.rb
58
+ lib/daemon_kit/commands/console.rb
52
59
  lib/daemon_kit/config.rb
60
+ lib/daemon_kit/console_daemon.rb
61
+ lib/daemon_kit/core_ext.rb
62
+ lib/daemon_kit/core_ext/string.rb
53
63
  lib/daemon_kit/cron.rb
54
64
  lib/daemon_kit/deployment/capistrano.rb
55
65
  lib/daemon_kit/error_handlers/base.rb
@@ -59,11 +69,14 @@ lib/daemon_kit/initializer.rb
59
69
  lib/daemon_kit/jabber.rb
60
70
  lib/daemon_kit/nanite.rb
61
71
  lib/daemon_kit/nanite/agent.rb
62
- lib/daemon_kit/patches/force_kill_wait.rb
72
+ lib/daemon_kit/pid_file.rb
63
73
  lib/daemon_kit/safety.rb
64
74
  lib/daemon_kit/tasks.rb
65
75
  lib/daemon_kit/tasks/environment.rake
66
76
  lib/daemon_kit/tasks/framework.rake
77
+ lib/daemon_kit/tasks/god.rake
78
+ lib/daemon_kit/tasks/log.rake
79
+ lib/daemon_kit/tasks/monit.rake
67
80
  rubygems_generators/install_rspec/USAGE
68
81
  rubygems_generators/install_rspec/install_rspec_generator.rb
69
82
  rubygems_generators/install_rspec/templates/spec.rb
@@ -74,11 +87,18 @@ script/console
74
87
  script/destroy
75
88
  script/generate
76
89
  script/txt2html
90
+ spec/argument_spec.rb
91
+ spec/config_spec.rb
77
92
  spec/daemon_kit_spec.rb
93
+ spec/error_handlers_spec.rb
94
+ spec/fixtures/env.yml
95
+ spec/fixtures/noenv.yml
78
96
  spec/initializer_spec.rb
79
97
  spec/spec.opts
80
98
  spec/spec_helper.rb
81
99
  tasks/rspec.rake
100
+ templates/god/god.erb
101
+ templates/monit/monit.erb
82
102
  test/test_amqp_generator.rb
83
103
  test/test_cron_generator.rb
84
104
  test/test_daemon-kit_generator.rb
@@ -88,3 +108,31 @@ test/test_generator_helper.rb
88
108
  test/test_helper.rb
89
109
  test/test_jabber_generator.rb
90
110
  test/test_nanite_agent_generator.rb
111
+ vendor/tmail-1.2.3/tmail.rb
112
+ vendor/tmail-1.2.3/tmail/address.rb
113
+ vendor/tmail-1.2.3/tmail/attachments.rb
114
+ vendor/tmail-1.2.3/tmail/base64.rb
115
+ vendor/tmail-1.2.3/tmail/compat.rb
116
+ vendor/tmail-1.2.3/tmail/config.rb
117
+ vendor/tmail-1.2.3/tmail/core_extensions.rb
118
+ vendor/tmail-1.2.3/tmail/encode.rb
119
+ vendor/tmail-1.2.3/tmail/header.rb
120
+ vendor/tmail-1.2.3/tmail/index.rb
121
+ vendor/tmail-1.2.3/tmail/interface.rb
122
+ vendor/tmail-1.2.3/tmail/loader.rb
123
+ vendor/tmail-1.2.3/tmail/mail.rb
124
+ vendor/tmail-1.2.3/tmail/mailbox.rb
125
+ vendor/tmail-1.2.3/tmail/main.rb
126
+ vendor/tmail-1.2.3/tmail/mbox.rb
127
+ vendor/tmail-1.2.3/tmail/net.rb
128
+ vendor/tmail-1.2.3/tmail/obsolete.rb
129
+ vendor/tmail-1.2.3/tmail/parser.rb
130
+ vendor/tmail-1.2.3/tmail/port.rb
131
+ vendor/tmail-1.2.3/tmail/quoting.rb
132
+ vendor/tmail-1.2.3/tmail/require_arch.rb
133
+ vendor/tmail-1.2.3/tmail/scanner.rb
134
+ vendor/tmail-1.2.3/tmail/scanner_r.rb
135
+ vendor/tmail-1.2.3/tmail/stringio.rb
136
+ vendor/tmail-1.2.3/tmail/utils.rb
137
+ vendor/tmail-1.2.3/tmail/version.rb
138
+ vendor/tmail.rb
data/PostInstall.txt CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- For more information on daemon-kit, see http://daemon-kit.rubyforge.org
2
+ For more information on daemon-kit, see http://kit.rubyforge.org/daemon-kit
3
3
 
4
4
  To get started quickly run 'daemon_kit' without any arguments
5
5
 
data/README.rdoc CHANGED
@@ -1,6 +1,7 @@
1
1
  = Daemon Kit
2
2
 
3
- * http://kit.rubyforge.org/daemon (coming soon)
3
+ * http://kit.rubyforge.org/daemon-kit/rdoc/
4
+ * http://kit.rubyforge.org/daemon-kit (coming soon)
4
5
  * http://groups.google.com/group/daemon-kit (daemon-kit@googlegroups.com)
5
6
  * #daemon-kit on Freenode
6
7
 
@@ -20,6 +21,7 @@ Supported generators:
20
21
 
21
22
  * Build it
22
23
  * Review TODO.txt
24
+ * Review Configuration.txt
23
25
 
24
26
  == Synopsis
25
27
 
@@ -52,19 +54,15 @@ The AMQP generator creates a simple daemon that has all the stub code and config
52
54
  == Requirements
53
55
 
54
56
  * Ruby 1.8.6
55
- * daemons 1.0.10
56
- * rspec 1.1.11 (for writing/running your specs)
57
+ * rspec (for writing/running your specs)
57
58
 
58
59
  == Generator Requirements
59
60
 
60
61
  Depending on the generator you choose for your daemon, it might require additional gems to run.
61
62
 
62
- <table>
63
- <tr><th>Generator</th><th>\&nbsp;</th><th>Dependencies</th></tr>
64
- <tr><td>jabber</td><td>\&nbsp;</td><td> xmpp4r-simple[http://xmpp4r-simple.rubyforge.org] </td></tr>
65
- <tr><td>cron</td><td>\&nbsp;</td><td> rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] </td></tr>
66
- <tr><td>amqp</td><td>\&nbsp;</td><td> amqp[http://github.com/tmm1/amqp] </td></tr>
67
- </table>
63
+ * jabber - xmpp4r-simple[http://xmpp4r-simple.rubyforge.org]
64
+ * cron - rufus-scheduler[http://github.com/jmettraux/rufus-scheduler]
65
+ * amqp - amqp[http://github.com/tmm1/amqp]
68
66
 
69
67
  == Install
70
68
 
data/Rakefile CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  %w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
3
2
  require File.dirname(__FILE__) + '/lib/daemon_kit'
4
3
 
@@ -9,15 +8,14 @@ $hoe = Hoe.new('daemon-kit', DaemonKit::VERSION) do |p|
9
8
  p.developer('Kenneth Kalmer', 'kenneth.kalmer@gmail.com')
10
9
  p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
11
10
  p.post_install_message = IO.read( 'PostInstall.txt' ) # TODO remove if post-install message not required
12
- p.rubyforge_name = p.name # TODO this is default value
11
+ p.rubyforge_name = 'kit' # TODO this is default value
13
12
  p.extra_deps = [
14
- ['daemons','>= 1.0.10'],
15
13
  ['rubigen', '>= 1.5.2']
16
14
  ]
17
15
  p.extra_dev_deps = [
18
16
  ['newgem', ">= #{::Newgem::VERSION}"]
19
17
  ]
20
-
18
+
21
19
  p.clean_globs |= %w[**/.DS_Store tmp *.log]
22
20
  path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
23
21
  p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
data/TODO.txt CHANGED
@@ -3,22 +3,18 @@ DaemonKit TODO List
3
3
 
4
4
  This is purely a drop in the bucket of what has to come...
5
5
 
6
- * [DONE] Easy way to trap signals
7
6
  * [IN PROGRESS] Error handling to the degree Rails does
8
7
  * Easy configuration of an ORM of choice, including patching it if needed (ActiveRecord *cough*)
9
8
  * Improved generators for creating skeleton daemons:
10
- * [DONE] Jabber bot
11
9
  * Evented jabber bot
12
10
  * Empty periodic event loop
13
11
  * Empty periodic loop (non-evented)
14
12
  * Queue (SQS, AMQP, etc) pollers
15
13
  * Rake tasks for generating:
16
- * god configs
17
14
  * Sys-V style init scripts
18
- * Pre-built capistrano configs for easy deployment
19
15
  * Support for dropping privileges
20
16
  * Support for chroot'ing
21
- * Improved and cleaned up logging
17
+ * Improved and cleaned up logging, support logrotating (via HUP)
22
18
  * Plenty of docs, seriously a lot of docs
23
19
  * Specs & features, tons of them too
24
20
  * Integration tests for the specific daemons
@@ -29,4 +25,9 @@ This is purely a drop in the bucket of what has to come...
29
25
  * Some activesupport-esque functions until activesupport 3.0 hits the streets
30
26
  * DRY up the following:
31
27
  * Loading configuration files for the daemons
28
+ * Altering process names (fully and temporary appending)
29
+ * bleak_house support
30
+ * Support for tweaking REE environment variables prior to launch (bash wrapper)
31
+ * Clustering support (run multiple workers out of same project)
32
+
32
33
  * DON'T FORGET 1.9 SUPPORT
@@ -65,6 +65,7 @@ class DaemonKitGenerator < RubiGen::Base
65
65
 
66
66
  # Config/Environment
67
67
  m.directory "config"
68
+ m.file "config/arguments.rb", "config/arguments.rb"
68
69
  m.file "config/boot.rb", "config/boot.rb"
69
70
  m.template "config/environment.rb", "config/environment.rb"
70
71
  m.directory "config/environments"
@@ -73,6 +74,10 @@ class DaemonKitGenerator < RubiGen::Base
73
74
  m.file "config/pre-daemonize/readme", "config/pre-daemonize/readme"
74
75
  m.directory "config/post-daemonize"
75
76
  m.file "config/post-daemonize/readme", "config/post-daemonize/readme"
77
+ m.directory "script"
78
+ m.file "script/destroy", "script/destroy"
79
+ m.file "script/console", "script/console"
80
+ m.file "script/generate", "script/generate"
76
81
 
77
82
  # Libraries
78
83
  m.directory "lib"
@@ -1,4 +1,6 @@
1
- require 'rubygems'
1
+ require File.dirname(__FILE__) + '/config/boot'
2
+
3
+ require 'rake'
2
4
  require 'daemon_kit/tasks'
3
5
 
4
6
  Dir[File.join(File.dirname(__FILE__), 'tasks/*.rake')].each { |rake| load rake }
@@ -4,4 +4,4 @@
4
4
 
5
5
  require File.dirname(__FILE__) + '/../config/environment'
6
6
 
7
- DaemonKit::Application.run( DAEMON_ROOT + '/libexec/<%= daemon_name %>-daemon.rb' )
7
+ DaemonKit::Application.exec( DAEMON_ROOT + '/libexec/<%= daemon_name %>-daemon.rb' )
@@ -0,0 +1,12 @@
1
+ # Argument handling for your daemon is configured here.
2
+ #
3
+ # You have access to two variables when this file is
4
+ # parsed. The first is +opts+, which is the object yielded from
5
+ # +OptionParser.new+, the second is +@options+ which is a standard
6
+ # Ruby hash that is later accessible through
7
+ # DaemonKit.arguments.options and can be used in your daemon process.
8
+
9
+ # Here is an example:
10
+ # opts.on('-f', '--foo FOO', 'Set foo') do |foo|
11
+ # @options[:foo] = foo
12
+ # end
@@ -1,7 +1,7 @@
1
1
  # Don't change this file!
2
2
  # Configure your daemon in config/environment.rb
3
3
 
4
- DAEMON_ROOT = "#{File.dirname(__FILE__)}/.." unless defined?( DAEMON_ROOT )
4
+ DAEMON_ROOT = "#{File.expand_path(File.dirname(__FILE__))}/.." unless defined?( DAEMON_ROOT )
5
5
 
6
6
  module DaemonKit
7
7
  class << self
@@ -36,7 +36,7 @@ module DaemonKit
36
36
  require "#{DAEMON_ROOT}/vendor/daemon_kit/lib/daemon_kit/initializer"
37
37
  end
38
38
  end
39
-
39
+
40
40
  class GemBoot < Boot
41
41
  def load_initializer
42
42
  begin
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require File.dirname(__FILE__) + '/../config/boot'
3
+ require 'daemon_kit/commands/console'
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/destroy'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:daemon, :test_unit]
14
+ RubiGen::Scripts::Destroy.new.run(ARGV)
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+ APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
3
+
4
+ begin
5
+ require 'rubigen'
6
+ rescue LoadError
7
+ require 'rubygems'
8
+ require 'rubigen'
9
+ end
10
+ require 'rubigen/scripts/generate'
11
+
12
+ ARGV.shift if ['--help', '-h'].include?(ARGV[0])
13
+ RubiGen::Base.use_component_sources! [:daemon, :test_unit]
14
+ RubiGen::Scripts::Generate.new.run(ARGV)
@@ -4,8 +4,8 @@
4
4
  # omitted will let the gem use it's own defaults.
5
5
 
6
6
  # The configuration specifies the following keys:
7
- # * username - Username for the broker
8
- # * password - Password for the broker
7
+ # * user - Username for the broker
8
+ # * pass - Password for the broker
9
9
  # * host - Hostname where the broker is running
10
10
  # * vhost - Vhost to connect to
11
11
  # * port - Port where the broker is running
@@ -13,8 +13,8 @@
13
13
  # * timeout - Timeout
14
14
 
15
15
  defaults: &defaults
16
- username: guest
17
- password: guest
16
+ user: guest
17
+ pass: guest
18
18
  host: localhost
19
19
  vhost: /
20
20
 
@@ -25,4 +25,4 @@ test:
25
25
  <<: *defaults
26
26
 
27
27
  production:
28
- <<: *defaults
28
+ <<: *defaults
@@ -1,14 +1,11 @@
1
1
  class DeployCapistranoGenerator < RubiGen::Base
2
2
 
3
- default_options :author => nil
4
-
5
3
  attr_reader :name
6
4
 
7
5
  def initialize(runtime_args, runtime_options = {})
8
6
  super
9
7
  usage if args.empty?
10
8
  @name = args.shift
11
- extract_options
12
9
  end
13
10
 
14
11
  def manifest
@@ -22,33 +19,17 @@ class DeployCapistranoGenerator < RubiGen::Base
22
19
  m.template "config/deploy/production.rb", "config/deploy/production.rb"
23
20
  m.directory "config/environments"
24
21
  m.file "config/environments/staging.rb", "config/environments/staging.rb", :collision => :skip
22
+ m.readme "USAGE"
25
23
  end
26
24
  end
27
25
 
28
26
  protected
29
27
  def banner
30
28
  <<-EOS
31
- Creates a ...
29
+ Creates the required capistrano configurations for deploying your daemon code
30
+ to remote servers.
32
31
 
33
- USAGE: #{$0} #{spec.name} name
32
+ USAGE: #{$0} #{spec.name} daemon-name
34
33
  EOS
35
34
  end
36
-
37
- def add_options!(opts)
38
- # opts.separator ''
39
- # opts.separator 'Options:'
40
- # For each option below, place the default
41
- # at the top of the file next to "default_options"
42
- # opts.on("-a", "--author=\"Your Name\"", String,
43
- # "Some comment about this option",
44
- # "Default: none") { |o| options[:author] = o }
45
- # opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
46
- end
47
-
48
- def extract_options
49
- # for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
50
- # Templates can access these value via the attr_reader-generated methods, but not the
51
- # raw instance variable value.
52
- # @author = options[:author]
53
- end
54
35
  end