queso-daemon-kit 0.1.7.10
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.
- data/Configuration.txt +110 -0
- data/Deployment.txt +113 -0
- data/History.txt +97 -0
- data/Logging.txt +92 -0
- data/Manifest.txt +166 -0
- data/PostInstall.txt +6 -0
- data/README.rdoc +130 -0
- data/Rakefile +37 -0
- data/RuoteParticipants.txt +113 -0
- data/TODO.txt +37 -0
- data/app_generators/daemon_kit/USAGE +7 -0
- data/app_generators/daemon_kit/daemon_kit_generator.rb +161 -0
- data/app_generators/daemon_kit/templates/README +48 -0
- data/app_generators/daemon_kit/templates/Rakefile +6 -0
- data/app_generators/daemon_kit/templates/bin/daemon.erb +7 -0
- data/app_generators/daemon_kit/templates/config/arguments.rb +12 -0
- data/app_generators/daemon_kit/templates/config/boot.rb +68 -0
- data/app_generators/daemon_kit/templates/config/environment.rb +23 -0
- data/app_generators/daemon_kit/templates/config/environments/development.rb +2 -0
- data/app_generators/daemon_kit/templates/config/environments/production.rb +2 -0
- data/app_generators/daemon_kit/templates/config/environments/test.rb +2 -0
- data/app_generators/daemon_kit/templates/config/post-daemonize/readme +5 -0
- data/app_generators/daemon_kit/templates/config/pre-daemonize/readme +12 -0
- data/app_generators/daemon_kit/templates/lib/daemon.rb +2 -0
- data/app_generators/daemon_kit/templates/libexec/daemon.erb +18 -0
- data/app_generators/daemon_kit/templates/script/console +3 -0
- data/app_generators/daemon_kit/templates/script/destroy +14 -0
- data/app_generators/daemon_kit/templates/script/generate +14 -0
- data/bin/daemon_kit +18 -0
- data/daemon_generators/amqp/USAGE +5 -0
- data/daemon_generators/amqp/amqp_generator.rb +65 -0
- data/daemon_generators/amqp/templates/config/amqp.yml +28 -0
- data/daemon_generators/amqp/templates/config/initializers/amqp.rb +7 -0
- data/daemon_generators/amqp/templates/libexec/daemon.rb +37 -0
- data/daemon_generators/cron/USAGE +5 -0
- data/daemon_generators/cron/cron_generator.rb +64 -0
- data/daemon_generators/cron/templates/config/initializers/cron.rb +11 -0
- data/daemon_generators/cron/templates/libexec/daemon.rb +43 -0
- data/daemon_generators/cucumber/USAGE +11 -0
- data/daemon_generators/cucumber/cucumber_generator.rb +38 -0
- data/daemon_generators/cucumber/templates/cucumber +8 -0
- data/daemon_generators/cucumber/templates/cucumber.rake +13 -0
- data/daemon_generators/cucumber/templates/cucumber_environment.rb +2 -0
- data/daemon_generators/cucumber/templates/env.rb +7 -0
- data/daemon_generators/deploy_capistrano/deploy_capistrano_generator.rb +35 -0
- data/daemon_generators/deploy_capistrano/templates/Capfile +10 -0
- data/daemon_generators/deploy_capistrano/templates/USAGE +10 -0
- data/daemon_generators/deploy_capistrano/templates/config/deploy.rb +53 -0
- data/daemon_generators/deploy_capistrano/templates/config/deploy/production.rb +6 -0
- data/daemon_generators/deploy_capistrano/templates/config/deploy/staging.rb +6 -0
- data/daemon_generators/deploy_capistrano/templates/config/environments/staging.rb +0 -0
- data/daemon_generators/jabber/USAGE +5 -0
- data/daemon_generators/jabber/jabber_generator.rb +65 -0
- data/daemon_generators/jabber/templates/config/initializers/jabber.rb +7 -0
- data/daemon_generators/jabber/templates/config/jabber.yml +26 -0
- data/daemon_generators/jabber/templates/libexec/daemon.rb +27 -0
- data/daemon_generators/nanite_agent/USAGE +5 -0
- data/daemon_generators/nanite_agent/nanite_agent_generator.rb +68 -0
- data/daemon_generators/nanite_agent/templates/config/initializers/nanite_agent.rb +6 -0
- data/daemon_generators/nanite_agent/templates/config/nanite.yml +35 -0
- data/daemon_generators/nanite_agent/templates/lib/actors/sample.rb +11 -0
- data/daemon_generators/nanite_agent/templates/libexec/daemon.rb +31 -0
- data/daemon_generators/rspec/USAGE +5 -0
- data/daemon_generators/rspec/rspec_generator.rb +55 -0
- data/daemon_generators/rspec/templates/spec.rb +11 -0
- data/daemon_generators/rspec/templates/spec/spec.opts +1 -0
- data/daemon_generators/rspec/templates/spec/spec_helper.rb +21 -0
- data/daemon_generators/rspec/templates/tasks/rspec.rake +21 -0
- data/daemon_generators/ruote/USAGE +5 -0
- data/daemon_generators/ruote/ruote_generator.rb +67 -0
- data/daemon_generators/ruote/templates/config/amqp.yml +30 -0
- data/daemon_generators/ruote/templates/config/initializers/ruote.rb +13 -0
- data/daemon_generators/ruote/templates/config/ruote.yml +23 -0
- data/daemon_generators/ruote/templates/lib/daemon.rb +4 -0
- data/daemon_generators/ruote/templates/lib/sample.rb +26 -0
- data/daemon_generators/ruote/templates/libexec/daemon.rb +33 -0
- data/lib/daemon_kit.rb +62 -0
- data/lib/daemon_kit/abstract_logger.rb +235 -0
- data/lib/daemon_kit/amqp.rb +38 -0
- data/lib/daemon_kit/application.rb +187 -0
- data/lib/daemon_kit/arguments.rb +165 -0
- data/lib/daemon_kit/commands/console.rb +38 -0
- data/lib/daemon_kit/config.rb +108 -0
- data/lib/daemon_kit/console_daemon.rb +2 -0
- data/lib/daemon_kit/core_ext.rb +1 -0
- data/lib/daemon_kit/core_ext/configurable.rb +96 -0
- data/lib/daemon_kit/core_ext/string.rb +22 -0
- data/lib/daemon_kit/cron.rb +48 -0
- data/lib/daemon_kit/cucumber/world.rb +38 -0
- data/lib/daemon_kit/deployment/capistrano.rb +482 -0
- data/lib/daemon_kit/em.rb +43 -0
- data/lib/daemon_kit/error_handlers/base.rb +32 -0
- data/lib/daemon_kit/error_handlers/hoptoad.rb +60 -0
- data/lib/daemon_kit/error_handlers/mail.rb +85 -0
- data/lib/daemon_kit/exceptions.rb +15 -0
- data/lib/daemon_kit/initializer.rb +438 -0
- data/lib/daemon_kit/jabber.rb +170 -0
- data/lib/daemon_kit/nanite.rb +7 -0
- data/lib/daemon_kit/nanite/agent.rb +56 -0
- data/lib/daemon_kit/pid_file.rb +61 -0
- data/lib/daemon_kit/ruote_participants.rb +119 -0
- data/lib/daemon_kit/ruote_pseudo_participant.rb +68 -0
- data/lib/daemon_kit/ruote_workitem.rb +169 -0
- data/lib/daemon_kit/safety.rb +85 -0
- data/lib/daemon_kit/tasks.rb +2 -0
- data/lib/daemon_kit/tasks/environment.rake +10 -0
- data/lib/daemon_kit/tasks/framework.rake +120 -0
- data/lib/daemon_kit/tasks/god.rake +62 -0
- data/lib/daemon_kit/tasks/log.rake +8 -0
- data/lib/daemon_kit/tasks/monit.rake +29 -0
- data/script/console +10 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +71 -0
- data/spec/abstract_logger_spec.rb +126 -0
- data/spec/argument_spec.rb +70 -0
- data/spec/config_spec.rb +79 -0
- data/spec/configurable_spec.rb +56 -0
- data/spec/daemon_kit_spec.rb +7 -0
- data/spec/error_handlers_spec.rb +23 -0
- data/spec/fixtures/env.yml +15 -0
- data/spec/fixtures/noenv.yml +4 -0
- data/spec/initializer_spec.rb +26 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +27 -0
- data/tasks/rspec.rake +21 -0
- data/templates/god/god.erb +69 -0
- data/templates/monit/monit.erb +14 -0
- data/test/test_amqp_generator.rb +48 -0
- data/test/test_cron_generator.rb +45 -0
- data/test/test_daemon-kit_generator.rb +84 -0
- data/test/test_daemon_kit_config.rb +28 -0
- data/test/test_deploy_capistrano_generator.rb +48 -0
- data/test/test_generator_helper.rb +29 -0
- data/test/test_helper.rb +7 -0
- data/test/test_jabber_generator.rb +49 -0
- data/test/test_nanite_agent_generator.rb +49 -0
- data/test/test_ruote_generator.rb +45 -0
- data/vendor/tmail-1.2.3/tmail.rb +5 -0
- data/vendor/tmail-1.2.3/tmail/address.rb +426 -0
- data/vendor/tmail-1.2.3/tmail/attachments.rb +46 -0
- data/vendor/tmail-1.2.3/tmail/base64.rb +46 -0
- data/vendor/tmail-1.2.3/tmail/compat.rb +41 -0
- data/vendor/tmail-1.2.3/tmail/config.rb +67 -0
- data/vendor/tmail-1.2.3/tmail/core_extensions.rb +63 -0
- data/vendor/tmail-1.2.3/tmail/encode.rb +581 -0
- data/vendor/tmail-1.2.3/tmail/header.rb +960 -0
- data/vendor/tmail-1.2.3/tmail/index.rb +9 -0
- data/vendor/tmail-1.2.3/tmail/interface.rb +1130 -0
- data/vendor/tmail-1.2.3/tmail/loader.rb +3 -0
- data/vendor/tmail-1.2.3/tmail/mail.rb +578 -0
- data/vendor/tmail-1.2.3/tmail/mailbox.rb +495 -0
- data/vendor/tmail-1.2.3/tmail/main.rb +6 -0
- data/vendor/tmail-1.2.3/tmail/mbox.rb +3 -0
- data/vendor/tmail-1.2.3/tmail/net.rb +248 -0
- data/vendor/tmail-1.2.3/tmail/obsolete.rb +132 -0
- data/vendor/tmail-1.2.3/tmail/parser.rb +1476 -0
- data/vendor/tmail-1.2.3/tmail/port.rb +379 -0
- data/vendor/tmail-1.2.3/tmail/quoting.rb +118 -0
- data/vendor/tmail-1.2.3/tmail/require_arch.rb +58 -0
- data/vendor/tmail-1.2.3/tmail/scanner.rb +49 -0
- data/vendor/tmail-1.2.3/tmail/scanner_r.rb +261 -0
- data/vendor/tmail-1.2.3/tmail/stringio.rb +280 -0
- data/vendor/tmail-1.2.3/tmail/utils.rb +337 -0
- data/vendor/tmail-1.2.3/tmail/version.rb +39 -0
- data/vendor/tmail.rb +13 -0
- metadata +281 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
class CronGenerator < 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 configs
|
|
28
|
+
m.directory 'config'
|
|
29
|
+
m.directory 'config/initializers'
|
|
30
|
+
m.template 'config/initializers/cron.rb', "config/initializers/#{name}.rb"
|
|
31
|
+
|
|
32
|
+
# Copy over our daemon
|
|
33
|
+
m.directory 'libexec'
|
|
34
|
+
m.template 'libexec/daemon.rb', "libexec/#{name}-daemon.rb"
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
protected
|
|
39
|
+
def banner
|
|
40
|
+
<<-EOS
|
|
41
|
+
Creates a ...
|
|
42
|
+
|
|
43
|
+
USAGE: #{$0} #{spec.name} name
|
|
44
|
+
EOS
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def add_options!(opts)
|
|
48
|
+
# opts.separator ''
|
|
49
|
+
# opts.separator 'Options:'
|
|
50
|
+
# For each option below, place the default
|
|
51
|
+
# at the top of the file next to "default_options"
|
|
52
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
|
53
|
+
# "Some comment about this option",
|
|
54
|
+
# "Default: none") { |o| options[:author] = o }
|
|
55
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
def extract_options
|
|
59
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
60
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
|
61
|
+
# raw instance variable value.
|
|
62
|
+
# @author = options[:author]
|
|
63
|
+
end
|
|
64
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
begin
|
|
2
|
+
require 'rufus/scheduler'
|
|
3
|
+
rescue LoadError => e
|
|
4
|
+
$stderr.puts "Missing rufus-scheduler gem. Please run 'gem install rufus-scheduler'."
|
|
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,43 @@
|
|
|
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
|
+
# log.info "activating security system..."
|
|
35
|
+
# activate_security_system()
|
|
36
|
+
#end
|
|
37
|
+
|
|
38
|
+
DaemonKit::Cron.scheduler.every("1m") do
|
|
39
|
+
DaemonKit.logger.debug "Scheduled task completed at #{Time.now}"
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Run our 'cron' dameon, suspending the current thread
|
|
43
|
+
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,38 @@
|
|
|
1
|
+
require 'rbconfig'
|
|
2
|
+
require 'cucumber/version'
|
|
3
|
+
|
|
4
|
+
# This generator bootstraps a Rails project for use with Cucumber
|
|
5
|
+
class CucumberGenerator < RubiGen::Base
|
|
6
|
+
DEFAULT_SHEBANG = File.join(Config::CONFIG['bindir'],
|
|
7
|
+
Config::CONFIG['ruby_install_name'])
|
|
8
|
+
|
|
9
|
+
def manifest
|
|
10
|
+
record do |m|
|
|
11
|
+
m.directory 'features/step_definitions'
|
|
12
|
+
m.template 'cucumber_environment.rb', 'config/environments/cucumber.rb',
|
|
13
|
+
:assigns => { :cucumber_version => ::Cucumber::VERSION::STRING }
|
|
14
|
+
|
|
15
|
+
m.directory 'features/support'
|
|
16
|
+
|
|
17
|
+
#if options[:spork]
|
|
18
|
+
# m.template 'spork_env.rb', 'features/support/env.rb'
|
|
19
|
+
#else
|
|
20
|
+
m.template 'env.rb', 'features/support/env.rb'
|
|
21
|
+
#end
|
|
22
|
+
|
|
23
|
+
m.directory 'tasks'
|
|
24
|
+
m.template 'cucumber.rake', 'tasks/cucumber.rake'
|
|
25
|
+
|
|
26
|
+
m.file 'cucumber', 'script/cucumber', {
|
|
27
|
+
:chmod => 0755, :shebang => options[:shebang] == DEFAULT_SHEBANG ? nil : options[:shebang]
|
|
28
|
+
}
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
protected
|
|
33
|
+
|
|
34
|
+
def banner
|
|
35
|
+
"Usage: #{$0} cucumber"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
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,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,35 @@
|
|
|
1
|
+
class DeployCapistranoGenerator < RubiGen::Base
|
|
2
|
+
|
|
3
|
+
attr_reader :name
|
|
4
|
+
|
|
5
|
+
def initialize(runtime_args, runtime_options = {})
|
|
6
|
+
super
|
|
7
|
+
usage if args.empty?
|
|
8
|
+
@name = args.shift
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def manifest
|
|
12
|
+
record do |m|
|
|
13
|
+
|
|
14
|
+
m.file "Capfile", "Capfile"
|
|
15
|
+
m.directory "config"
|
|
16
|
+
m.template "config/deploy.rb", "config/deploy.rb"
|
|
17
|
+
m.directory "config/deploy"
|
|
18
|
+
m.template "config/deploy/staging.rb", "config/deploy/staging.rb"
|
|
19
|
+
m.template "config/deploy/production.rb", "config/deploy/production.rb"
|
|
20
|
+
m.directory "config/environments"
|
|
21
|
+
m.file "config/environments/staging.rb", "config/environments/staging.rb", :collision => :skip
|
|
22
|
+
m.readme "USAGE"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
protected
|
|
27
|
+
def banner
|
|
28
|
+
<<-EOS
|
|
29
|
+
Creates the required capistrano configurations for deploying your daemon code
|
|
30
|
+
to remote servers.
|
|
31
|
+
|
|
32
|
+
USAGE: #{$0} #{spec.name} daemon-name
|
|
33
|
+
EOS
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
unless respond_to?(:namespace) # cap2 differentiator
|
|
2
|
+
$stderr.puts "Requires capistrano version 2"
|
|
3
|
+
exit 1
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
require 'config/boot'
|
|
7
|
+
load DaemonKit.framework_root + '/lib/daemon_kit/deployment/capistrano.rb'
|
|
8
|
+
|
|
9
|
+
Dir['config/deploy/recipes/*.rb'].each { |plugin| load(plugin) }
|
|
10
|
+
load 'config/deploy.rb'
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
Capistrano deployment configuration generator completed
|
|
3
|
+
|
|
4
|
+
Usage:
|
|
5
|
+
Review the configuration files in config/deploy.rb and
|
|
6
|
+
config/deploy/*.rb
|
|
7
|
+
|
|
8
|
+
Once you're happy with the configurations, you can review
|
|
9
|
+
a list of available capistrano commands by running `cap -T'
|
|
10
|
+
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# Modified capistrano recipe, based on the standard 'deploy' recipe
|
|
2
|
+
# provided by capistrano but without the Rails-specific dependencies
|
|
3
|
+
|
|
4
|
+
set :stages, %w(staging production)
|
|
5
|
+
set :default_stage, "staging"
|
|
6
|
+
require "capistrano/ext/multistage"
|
|
7
|
+
|
|
8
|
+
# Set some globals
|
|
9
|
+
default_run_options[:pty] = true
|
|
10
|
+
set :application, "<%= name %>"
|
|
11
|
+
|
|
12
|
+
# Deployment
|
|
13
|
+
set :deploy_to, "/svc/#{application}"
|
|
14
|
+
#set :user, 'someone'
|
|
15
|
+
|
|
16
|
+
# Get repo configuration
|
|
17
|
+
set :repository, "git@github.com:yourname/#{application}.git"
|
|
18
|
+
set :scm, "git"
|
|
19
|
+
set :branch, "master"
|
|
20
|
+
set :deploy_via, :remote_cache
|
|
21
|
+
set :git_enable_submodules, 1
|
|
22
|
+
|
|
23
|
+
# No sudo
|
|
24
|
+
set :use_sudo, false
|
|
25
|
+
|
|
26
|
+
# File list in the config_files setting will be copied from the
|
|
27
|
+
# 'deploy_to' directory into config, overwriting files from the repo
|
|
28
|
+
# with the same name
|
|
29
|
+
set :config_files, %w{}
|
|
30
|
+
|
|
31
|
+
# List any work directories here that you need persisted between
|
|
32
|
+
# deployments. They are created in 'deploy_to'/shared and symlinked
|
|
33
|
+
# into the root directory of the deployment.
|
|
34
|
+
set :shared_children, %w{log tmp}
|
|
35
|
+
|
|
36
|
+
# Record our dependencies
|
|
37
|
+
unless File.directory?( "#{DaemonKit.root}/vendor/daemon_kit" )
|
|
38
|
+
depend :remote, :gem, "daemon-kit", ">=#{DaemonKit::VERSION}"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Hook into capistrano's events
|
|
42
|
+
before "deploy:update_code", "deploy:check"
|
|
43
|
+
|
|
44
|
+
# Create some tasks related to deployment
|
|
45
|
+
namespace :deploy do
|
|
46
|
+
|
|
47
|
+
desc "Get the current revision of the deployed code"
|
|
48
|
+
task :get_current_version do
|
|
49
|
+
run "cat #{current_path}/REVISION" do |ch, stream, out|
|
|
50
|
+
puts "Current revision: " + out.chomp
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
File without changes
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
class JabberGenerator < 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 'config'
|
|
29
|
+
m.template 'config/jabber.yml', 'config/jabber.yml'
|
|
30
|
+
m.directory 'config/initializers'
|
|
31
|
+
m.template 'config/initializers/jabber.rb', "config/initializers/#{name}.rb"
|
|
32
|
+
|
|
33
|
+
# Copy over our daemon
|
|
34
|
+
m.directory 'libexec'
|
|
35
|
+
m.template 'libexec/daemon.rb', "libexec/#{name}-daemon.rb"
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
protected
|
|
40
|
+
def banner
|
|
41
|
+
<<-EOS
|
|
42
|
+
Creates a ...
|
|
43
|
+
|
|
44
|
+
USAGE: #{$0} #{spec.name} name
|
|
45
|
+
EOS
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def add_options!(opts)
|
|
49
|
+
# opts.separator ''
|
|
50
|
+
# opts.separator 'Options:'
|
|
51
|
+
# For each option below, place the default
|
|
52
|
+
# at the top of the file next to "default_options"
|
|
53
|
+
# opts.on("-a", "--author=\"Your Name\"", String,
|
|
54
|
+
# "Some comment about this option",
|
|
55
|
+
# "Default: none") { |o| options[:author] = o }
|
|
56
|
+
# opts.on("-v", "--version", "Show the #{File.basename($0)} version number and quit.")
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
def extract_options
|
|
60
|
+
# for each option, extract it into a local variable (and create an "attr_reader :author" at the top)
|
|
61
|
+
# Templates can access these value via the attr_reader-generated methods, but not the
|
|
62
|
+
# raw instance variable value.
|
|
63
|
+
# @author = options[:author]
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# Jabber configuration file
|
|
2
|
+
|
|
3
|
+
# The configuration specifies the following keys:
|
|
4
|
+
# * jabber_id - Identidy (username) of the user
|
|
5
|
+
# * password - Password used to authenticate
|
|
6
|
+
# * resource - Multiple connections can be made with the same credentials and different resources
|
|
7
|
+
# * masters - Array of Jabber ID's whose messages will be processed
|
|
8
|
+
# * supporters - Additional 'buddies' to keep on roster, but messages won't be processed
|
|
9
|
+
|
|
10
|
+
defaults: &defaults
|
|
11
|
+
jabber_id: <%= name %>@gmail.com
|
|
12
|
+
password: secret
|
|
13
|
+
resource: daemon_kit
|
|
14
|
+
masters:
|
|
15
|
+
- you@gmail.com
|
|
16
|
+
supporters:
|
|
17
|
+
- someone@gmail.com
|
|
18
|
+
|
|
19
|
+
development:
|
|
20
|
+
<<: *defaults
|
|
21
|
+
|
|
22
|
+
test:
|
|
23
|
+
<<: *defaults
|
|
24
|
+
|
|
25
|
+
production:
|
|
26
|
+
<<: *defaults
|