Permalink
Browse files

Docs and docs

  • Loading branch information...
1 parent 7eff725 commit f139b3e43baa072a8de7641488d25db5cf1f0d31 @kennethkalmer committed May 31, 2009
View
@@ -1,3 +1,4 @@
*#*
pkg/
tmp/
+doc/
View
@@ -0,0 +1,58 @@
+= Configuring your daemon
+
+daemon-kit provides a multitude of ways to configure your daemon, this document
+will outline the different options available to you.
+
+== Configuration files and #DaemonKit::Config
+
+#DaemonKit::Config gives you easy access to any YAML configuration
+files you have in your <em>config</em> directory.
+
+You can access the configuration files like this:
+
+ config = DaemonKit::Config.load('sample')
+
+The above snippet relies on the presence of a <em>config/sample.yml</em> file.
+
+#DaemonKit::Config is environment aware, so configuration files are
+parsed for a top-level key that is the same as the value of
+<em>DAEMON_ENV</em>, and if present is loaded into the object as the
+configuration data. If the key is not present, the whole YAML
+document is exposed as configuration data.
+
+== Command line arguments
+
+The most flexible way to configure your daemon is through command line
+arguments, or switches.
+
+DaemonKit includes a couple of its own arguments that can be used:
+
+ -e ENV (or --env ENV) to set the daemon environment
+ --pid /path/to/pidfile to set the path to a pidfile
+ -v shows the DaemonKit version
+ -h shows a useful help message
+
+=== Custom arguments
+
+It is possible for you to specify your own arguments as well, by
+updating the <em>config/arguments.rb</em> file. This file is eval'd
+inside #DaemonKit::Arguments and gives you access to the following two
+variables:
+
+* opts - Instance of OptionParser[http://www.ruby-doc.org/stdlib/libdoc/optparse/rdoc/classes/OptionParser.html]
+* @options - A standard Ruby hash that you can populate and access later
+
+Your custom arguments can be accessed like this:
+
+ DaemonKit.arguments.options
+
+=== Advanced Configuration
+
+All the writable attributes of the default #DaemonKit::Configuration
+instance call also be modified from the command line using the special
+<em>--config</em> arguments:
+
+ --config force_kill_wait=30
+
+This happens after <em>config/environment.rb</em> is processed, so all
+command line arguments will overwrite those values.
View
@@ -1,3 +1,19 @@
+== 0.1.7.2 2009-05-31
+
+* Removed dependency on daemons gem, now handled in house
+* New argument management
+* Some more docs
+
+== 0.1.7.1 2009-05-28
+
+* Fixed some minor issue with Capistrano support
+* Added support for generating dog/monit configuration files via rake
+* Initial implementation of ./script/* utilities
+
+== 0.1.7 2009-05-26
+
+* Capistrano deployment support
+
== 0.1.6 2009-05-13
* DaemonKit::Safety class to handle the trapping and logging of
View
@@ -1,3 +1,4 @@
+Configuration.txt
History.txt
Manifest.txt
PostInstall.txt
@@ -9,6 +10,7 @@ app_generators/daemon_kit/daemon_kit_generator.rb
app_generators/daemon_kit/templates/README
app_generators/daemon_kit/templates/Rakefile
app_generators/daemon_kit/templates/bin/daemon.erb
+app_generators/daemon_kit/templates/config/arguments.rb
app_generators/daemon_kit/templates/config/boot.rb
app_generators/daemon_kit/templates/config/environment.rb
app_generators/daemon_kit/templates/config/environments/development.rb
@@ -52,9 +54,12 @@ daemon_generators/nanite_agent/templates/libexec/daemon.rb
lib/daemon_kit.rb
lib/daemon_kit/amqp.rb
lib/daemon_kit/application.rb
+lib/daemon_kit/arguments.rb
lib/daemon_kit/commands/console.rb
lib/daemon_kit/config.rb
lib/daemon_kit/console_daemon.rb
+lib/daemon_kit/core_ext.rb
+lib/daemon_kit/core_ext/string.rb
lib/daemon_kit/cron.rb
lib/daemon_kit/deployment/capistrano.rb
lib/daemon_kit/error_handlers/base.rb
@@ -64,7 +69,7 @@ lib/daemon_kit/initializer.rb
lib/daemon_kit/jabber.rb
lib/daemon_kit/nanite.rb
lib/daemon_kit/nanite/agent.rb
-lib/daemon_kit/patches/force_kill_wait.rb
+lib/daemon_kit/pid_file.rb
lib/daemon_kit/safety.rb
lib/daemon_kit/tasks.rb
lib/daemon_kit/tasks/environment.rake
@@ -81,7 +86,11 @@ script/console
script/destroy
script/generate
script/txt2html
+spec/argument_spec.rb
+spec/config_spec.rb
spec/daemon_kit_spec.rb
+spec/fixtures/env.yml
+spec/fixtures/noenv.yml
spec/initializer_spec.rb
spec/spec.opts
spec/spec_helper.rb
View
@@ -1,5 +1,5 @@
-For more information on daemon-kit, see http://daemon-kit.rubyforge.org
+For more information on daemon-kit, see http://kit.rubyforge.org/daemon-kit
To get started quickly run 'daemon_kit' without any arguments
View
@@ -1,6 +1,7 @@
= Daemon Kit
-* http://kit.rubyforge.org/daemon (coming soon)
+* http://kit.rubyforge.org/daemon-kit/rdoc/
+* http://kit.rubyforge.org/daemon-kit (coming soon)
* http://groups.google.com/group/daemon-kit (daemon-kit@googlegroups.com)
* #daemon-kit on Freenode
@@ -20,6 +21,7 @@ Supported generators:
* Build it
* Review TODO.txt
+* Review Configuration.txt
== Synopsis
@@ -52,19 +54,15 @@ The AMQP generator creates a simple daemon that has all the stub code and config
== Requirements
* Ruby 1.8.6
-* daemons 1.0.10
-* rspec 1.1.11 (for writing/running your specs)
+* rspec (for writing/running your specs)
== Generator Requirements
Depending on the generator you choose for your daemon, it might require additional gems to run.
-<table>
-<tr><th>Generator</th><th>\&nbsp;</th><th>Dependencies</th></tr>
-<tr><td>jabber</td><td>\&nbsp;</td><td> xmpp4r-simple[http://xmpp4r-simple.rubyforge.org] </td></tr>
-<tr><td>cron</td><td>\&nbsp;</td><td> rufus-scheduler[http://github.com/jmettraux/rufus-scheduler] </td></tr>
-<tr><td>amqp</td><td>\&nbsp;</td><td> amqp[http://github.com/tmm1/amqp] </td></tr>
-</table>
+* jabber - xmpp4r-simple[http://xmpp4r-simple.rubyforge.org]
+* cron - rufus-scheduler[http://github.com/jmettraux/rufus-scheduler]
+* amqp - amqp[http://github.com/tmm1/amqp]
== Install
View
@@ -1,4 +1,3 @@
-
%w[rubygems rake rake/clean fileutils newgem rubigen].each { |f| require f }
require File.dirname(__FILE__) + '/lib/daemon_kit'
@@ -9,15 +8,14 @@ $hoe = Hoe.new('daemon-kit', DaemonKit::VERSION) do |p|
p.developer('Kenneth Kalmer', 'kenneth.kalmer@gmail.com')
p.changes = p.paragraphs_of("History.txt", 0..1).join("\n\n")
p.post_install_message = IO.read( 'PostInstall.txt' ) # TODO remove if post-install message not required
- p.rubyforge_name = p.name # TODO this is default value
+ p.rubyforge_name = 'kit' # TODO this is default value
p.extra_deps = [
- ['daemons','>= 1.0.10'],
['rubigen', '>= 1.5.2']
]
p.extra_dev_deps = [
['newgem', ">= #{::Newgem::VERSION}"]
]
-
+
p.clean_globs |= %w[**/.DS_Store tmp *.log]
path = (p.rubyforge_name == p.name) ? p.rubyforge_name : "\#{p.rubyforge_name}/\#{p.name}"
p.remote_rdoc_dir = File.join(path.gsub(/^#{p.rubyforge_name}\/?/,''), 'rdoc')
@@ -65,6 +65,7 @@ def manifest
# Config/Environment
m.directory "config"
+ m.file "config/arguments.rb", "config/arguments.rb"
m.file "config/boot.rb", "config/boot.rb"
m.template "config/environment.rb", "config/environment.rb"
m.directory "config/environments"
@@ -0,0 +1,12 @@
+# Argument handling for your daemon is configured here.
+#
+# You have access to two variables when this file is
+# parsed. The first is +opts+, which is the object yielded from
+# +OptionParser.new+, the second is +@options+ which is a standard
+# Ruby hash that is later accessible through
+# DaemonKit.arguments.options and can be used in your daemon process.
+
+# Here is an example:
+# opts.on('-f', '--foo FOO', 'Set foo') do |foo|
+# @options[:foo] = foo
+# end
View
@@ -0,0 +1,2 @@
+host: kennethkalmer@rubyforge.org
+remote_dir: /var/www/gforge-projects/kit/daemon-kit/
View
@@ -2,21 +2,21 @@
Gem::Specification.new do |s|
s.name = %q{daemon-kit}
- s.version = "0.1.7.1"
+ s.version = "0.1.7.2"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Kenneth Kalmer"]
- s.date = %q{2009-05-28}
+ s.date = %q{2009-05-31}
s.default_executable = %q{daemon_kit}
s.description = %q{Daemon Kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code. Using simple built-in generators it is easy to created evented and non-evented daemons that perform a multitude of different tasks. Supported generators: * Evented and non-evented Jabber Bot (coming next) * Evented and non-evented loops (coming soon) * Queue poller (SQS, AMQP, etc) (coming soon)}
s.email = ["kenneth.kalmer@gmail.com"]
s.executables = ["daemon_kit"]
- s.extra_rdoc_files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "TODO.txt"]
- s.files = ["History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "TODO.txt", "app_generators/daemon_kit/USAGE", "app_generators/daemon_kit/daemon_kit_generator.rb", "app_generators/daemon_kit/templates/README", "app_generators/daemon_kit/templates/Rakefile", "app_generators/daemon_kit/templates/bin/daemon.erb", "app_generators/daemon_kit/templates/config/boot.rb", "app_generators/daemon_kit/templates/config/environment.rb", "app_generators/daemon_kit/templates/config/environments/development.rb", "app_generators/daemon_kit/templates/config/environments/production.rb", "app_generators/daemon_kit/templates/config/environments/test.rb", "app_generators/daemon_kit/templates/config/post-daemonize/readme", "app_generators/daemon_kit/templates/config/pre-daemonize/readme", "app_generators/daemon_kit/templates/lib/daemon.rb", "app_generators/daemon_kit/templates/libexec/daemon.erb", "app_generators/daemon_kit/templates/script/console", "app_generators/daemon_kit/templates/script/destroy", "app_generators/daemon_kit/templates/script/generate", "bin/daemon_kit", "daemon_generators/amqp/USAGE", "daemon_generators/amqp/amqp_generator.rb", "daemon_generators/amqp/templates/config/amqp.yml", "daemon_generators/amqp/templates/config/initializers/amqp.rb", "daemon_generators/amqp/templates/libexec/daemon.rb", "daemon_generators/cron/USAGE", "daemon_generators/cron/cron_generator.rb", "daemon_generators/cron/templates/config/initializers/cron.rb", "daemon_generators/cron/templates/libexec/daemon.rb", "daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb", "daemon_generators/deploy_capistrano/templates/Capfile", "daemon_generators/deploy_capistrano/templates/USAGE", "daemon_generators/deploy_capistrano/templates/config/deploy.rb", "daemon_generators/deploy_capistrano/templates/config/deploy/production.rb", "daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb", "daemon_generators/deploy_capistrano/templates/config/environments/staging.rb", "daemon_generators/jabber/USAGE", "daemon_generators/jabber/jabber_generator.rb", "daemon_generators/jabber/templates/config/initializers/jabber.rb", "daemon_generators/jabber/templates/config/jabber.yml", "daemon_generators/jabber/templates/libexec/daemon.rb", "daemon_generators/nanite_agent/USAGE", "daemon_generators/nanite_agent/nanite_agent_generator.rb", "daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb", "daemon_generators/nanite_agent/templates/config/nanite.yml", "daemon_generators/nanite_agent/templates/lib/actors/sample.rb", "daemon_generators/nanite_agent/templates/libexec/daemon.rb", "lib/daemon_kit.rb", "lib/daemon_kit/amqp.rb", "lib/daemon_kit/application.rb", "lib/daemon_kit/commands/console.rb", "lib/daemon_kit/config.rb", "lib/daemon_kit/console_daemon.rb", "lib/daemon_kit/cron.rb", "lib/daemon_kit/deployment/capistrano.rb", "lib/daemon_kit/error_handlers/base.rb", "lib/daemon_kit/error_handlers/hoptoad.rb", "lib/daemon_kit/error_handlers/mail.rb", "lib/daemon_kit/initializer.rb", "lib/daemon_kit/jabber.rb", "lib/daemon_kit/nanite.rb", "lib/daemon_kit/nanite/agent.rb", "lib/daemon_kit/patches/force_kill_wait.rb", "lib/daemon_kit/safety.rb", "lib/daemon_kit/tasks.rb", "lib/daemon_kit/tasks/environment.rake", "lib/daemon_kit/tasks/framework.rake", "lib/daemon_kit/tasks/god.rake", "lib/daemon_kit/tasks/monit.rake", "rubygems_generators/install_rspec/USAGE", "rubygems_generators/install_rspec/install_rspec_generator.rb", "rubygems_generators/install_rspec/templates/spec.rb", "rubygems_generators/install_rspec/templates/spec/spec.opts", "rubygems_generators/install_rspec/templates/spec/spec_helper.rb", "rubygems_generators/install_rspec/templates/tasks/rspec.rake", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/daemon_kit_spec.rb", "spec/initializer_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake", "templates/god/god.erb", "templates/monit/monit.erb", "test/test_amqp_generator.rb", "test/test_cron_generator.rb", "test/test_daemon-kit_generator.rb", "test/test_daemon_kit_config.rb", "test/test_deploy_capistrano_generator.rb", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_jabber_generator.rb", "test/test_nanite_agent_generator.rb"]
+ s.extra_rdoc_files = ["Configuration.txt", "History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "TODO.txt"]
+ s.files = ["Configuration.txt", "History.txt", "Manifest.txt", "PostInstall.txt", "README.rdoc", "Rakefile", "TODO.txt", "app_generators/daemon_kit/USAGE", "app_generators/daemon_kit/daemon_kit_generator.rb", "app_generators/daemon_kit/templates/README", "app_generators/daemon_kit/templates/Rakefile", "app_generators/daemon_kit/templates/bin/daemon.erb", "app_generators/daemon_kit/templates/config/boot.rb", "app_generators/daemon_kit/templates/config/environment.rb", "app_generators/daemon_kit/templates/config/environments/development.rb", "app_generators/daemon_kit/templates/config/environments/production.rb", "app_generators/daemon_kit/templates/config/environments/test.rb", "app_generators/daemon_kit/templates/config/post-daemonize/readme", "app_generators/daemon_kit/templates/config/pre-daemonize/readme", "app_generators/daemon_kit/templates/lib/daemon.rb", "app_generators/daemon_kit/templates/libexec/daemon.erb", "app_generators/daemon_kit/templates/script/console", "app_generators/daemon_kit/templates/script/destroy", "app_generators/daemon_kit/templates/script/generate", "bin/daemon_kit", "daemon_generators/amqp/USAGE", "daemon_generators/amqp/amqp_generator.rb", "daemon_generators/amqp/templates/config/amqp.yml", "daemon_generators/amqp/templates/config/initializers/amqp.rb", "daemon_generators/amqp/templates/libexec/daemon.rb", "daemon_generators/cron/USAGE", "daemon_generators/cron/cron_generator.rb", "daemon_generators/cron/templates/config/initializers/cron.rb", "daemon_generators/cron/templates/libexec/daemon.rb", "daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb", "daemon_generators/deploy_capistrano/templates/Capfile", "daemon_generators/deploy_capistrano/templates/USAGE", "daemon_generators/deploy_capistrano/templates/config/deploy.rb", "daemon_generators/deploy_capistrano/templates/config/deploy/production.rb", "daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb", "daemon_generators/deploy_capistrano/templates/config/environments/staging.rb", "daemon_generators/jabber/USAGE", "daemon_generators/jabber/jabber_generator.rb", "daemon_generators/jabber/templates/config/initializers/jabber.rb", "daemon_generators/jabber/templates/config/jabber.yml", "daemon_generators/jabber/templates/libexec/daemon.rb", "daemon_generators/nanite_agent/USAGE", "daemon_generators/nanite_agent/nanite_agent_generator.rb", "daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb", "daemon_generators/nanite_agent/templates/config/nanite.yml", "daemon_generators/nanite_agent/templates/lib/actors/sample.rb", "daemon_generators/nanite_agent/templates/libexec/daemon.rb", "lib/daemon_kit.rb", "lib/daemon_kit/amqp.rb", "lib/daemon_kit/application.rb", "lib/daemon_kit/commands/console.rb", "lib/daemon_kit/config.rb", "lib/daemon_kit/console_daemon.rb", "lib/daemon_kit/cron.rb", "lib/daemon_kit/deployment/capistrano.rb", "lib/daemon_kit/error_handlers/base.rb", "lib/daemon_kit/error_handlers/hoptoad.rb", "lib/daemon_kit/error_handlers/mail.rb", "lib/daemon_kit/initializer.rb", "lib/daemon_kit/jabber.rb", "lib/daemon_kit/nanite.rb", "lib/daemon_kit/nanite/agent.rb", "lib/daemon_kit/patches/force_kill_wait.rb", "lib/daemon_kit/safety.rb", "lib/daemon_kit/tasks.rb", "lib/daemon_kit/tasks/environment.rake", "lib/daemon_kit/tasks/framework.rake", "lib/daemon_kit/tasks/god.rake", "lib/daemon_kit/tasks/monit.rake", "rubygems_generators/install_rspec/USAGE", "rubygems_generators/install_rspec/install_rspec_generator.rb", "rubygems_generators/install_rspec/templates/spec.rb", "rubygems_generators/install_rspec/templates/spec/spec.opts", "rubygems_generators/install_rspec/templates/spec/spec_helper.rb", "rubygems_generators/install_rspec/templates/tasks/rspec.rake", "script/console", "script/destroy", "script/generate", "script/txt2html", "spec/daemon_kit_spec.rb", "spec/initializer_spec.rb", "spec/spec.opts", "spec/spec_helper.rb", "tasks/rspec.rake", "templates/god/god.erb", "templates/monit/monit.erb", "test/test_amqp_generator.rb", "test/test_cron_generator.rb", "test/test_daemon-kit_generator.rb", "test/test_daemon_kit_config.rb", "test/test_deploy_capistrano_generator.rb", "test/test_generator_helper.rb", "test/test_helper.rb", "test/test_jabber_generator.rb", "test/test_nanite_agent_generator.rb"]
s.has_rdoc = true
s.homepage = %q{http://kit.rubyforge.org/daemon (coming soon)}
s.post_install_message = %q{
-For more information on daemon-kit, see http://daemon-kit.rubyforge.org
+For more information on daemon-kit, see http://kit.rubyforge.org/daemons
To get started quickly run 'daemon_kit' without any arguments
@@ -27,27 +27,24 @@ To get started quickly run 'daemon_kit' without any arguments
s.rubyforge_project = %q{daemon-kit}
s.rubygems_version = %q{1.3.1}
s.summary = %q{Daemon Kit aims to simplify creating Ruby daemons by providing a sound application skeleton (through a generator), task specific generators (jabber bot, etc) and robust environment management code.}
- s.test_files = ["test/test_generator_helper.rb", "test/test_jabber_generator.rb", "test/test_cron_generator.rb", "test/test_amqp_generator.rb", "test/test_nanite_agent_generator.rb", "test/test_daemon_kit_config.rb", "test/test_helper.rb", "test/test_daemon-kit_generator.rb", "test/test_deploy_capistrano_generator.rb"]
+ s.test_files = ["test/test_generator_helper.rb", "test/test_jabber_generator.rb", "test/test_cron_generator.rb", "test/test_amqp_generator.rb", "test/test_nanite_agent_generator.rb", "test/test_daemon_kit_config.rb", "test/test_helper.rb", "test/test_deploy_capistrano_generator.rb", "test/test_daemon-kit_generator.rb"]
if s.respond_to? :specification_version then
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
s.specification_version = 2
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
- s.add_runtime_dependency(%q<daemons>, [">= 1.0.10"])
s.add_runtime_dependency(%q<rubigen>, [">= 1.5.2"])
- s.add_development_dependency(%q<newgem>, [">= 1.3.0"])
+ s.add_development_dependency(%q<newgem>, [">= 1.4.1"])
s.add_development_dependency(%q<hoe>, [">= 1.8.0"])
else
- s.add_dependency(%q<daemons>, [">= 1.0.10"])
s.add_dependency(%q<rubigen>, [">= 1.5.2"])
- s.add_dependency(%q<newgem>, [">= 1.3.0"])
+ s.add_dependency(%q<newgem>, [">= 1.4.1"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
else
- s.add_dependency(%q<daemons>, [">= 1.0.10"])
s.add_dependency(%q<rubigen>, [">= 1.5.2"])
- s.add_dependency(%q<newgem>, [">= 1.3.0"])
+ s.add_dependency(%q<newgem>, [">= 1.4.1"])
s.add_dependency(%q<hoe>, [">= 1.8.0"])
end
end
Oops, something went wrong.

0 comments on commit f139b3e

Please sign in to comment.