foreman-export-daemontools 0.0.1
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.tar.gz.sig +0 -0
- data/.env +5 -0
- data/.foreman +2 -0
- data/.gemtest +0 -0
- data/ChangeLog +0 -0
- data/History.rdoc +4 -0
- data/Manifest.txt +16 -0
- data/Procfile +2 -0
- data/README.rdoc +88 -0
- data/Rakefile +35 -0
- data/data/foreman-export-daemontools/templates/log-run.erb +8 -0
- data/data/foreman-export-daemontools/templates/run.erb +5 -0
- data/lib/foreman/export/daemontools.rb +180 -0
- data/spec/data/.env +2 -0
- data/spec/data/.foreman +2 -0
- data/spec/data/Procfile +4 -0
- data/spec/foreman/export/daemontools_spec.rb +88 -0
- data/spec/helpers.rb +99 -0
- metadata +169 -0
- metadata.gz.sig +0 -0
data.tar.gz.sig
ADDED
Binary file
|
data/.env
ADDED
@@ -0,0 +1,5 @@
|
|
1
|
+
MONGREL2=/Users/mgranger/source/C/mongrel2/bin/mongrel2
|
2
|
+
STRELKA_DATADIR=/Users/mgranger/source/ruby/Strelka/data
|
3
|
+
FANCYERRORS_DATADIR=/Users/mgranger/source/ruby/Strelka-FancyErrors/data/strelka-fancyerrors
|
4
|
+
RUNMODE=development
|
5
|
+
RUBYOPT=-I/Users/mgranger/source/ruby/Strelka-FancyErrors/lib:/Users/mgranger/source/ruby/Strelka/lib
|
data/.foreman
ADDED
data/.gemtest
ADDED
File without changes
|
data/ChangeLog
ADDED
File without changes
|
data/History.rdoc
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
.env
|
2
|
+
.foreman
|
3
|
+
ChangeLog
|
4
|
+
History.rdoc
|
5
|
+
Manifest.txt
|
6
|
+
Procfile
|
7
|
+
README.rdoc
|
8
|
+
Rakefile
|
9
|
+
data/foreman-export-daemontools/templates/log-run.erb
|
10
|
+
data/foreman-export-daemontools/templates/run.erb
|
11
|
+
lib/foreman/export/daemontools.rb
|
12
|
+
spec/data/.env
|
13
|
+
spec/data/.foreman
|
14
|
+
spec/data/Procfile
|
15
|
+
spec/foreman/export/daemontools_spec.rb
|
16
|
+
spec/helpers.rb
|
data/Procfile
ADDED
data/README.rdoc
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
= foreman-export-daemontools
|
2
|
+
|
3
|
+
home :: https://bitbucket.org/ged/foreman-export-daemontools
|
4
|
+
github :: https://github.com/ged/foreman-export-daemontools
|
5
|
+
docs :: http://deveiate.org/code/foreman-export-daemontools
|
6
|
+
|
7
|
+
|
8
|
+
== Description
|
9
|
+
|
10
|
+
An exporter for David Dollar's Foreman[https://github.com/ddollar/foreman] that
|
11
|
+
outputs service directories that can be managed by 'supervise' from DJB's
|
12
|
+
daemontools[http://cr.yp.to/daemontools.html].
|
13
|
+
|
14
|
+
|
15
|
+
== Prerequisites
|
16
|
+
|
17
|
+
* Ruby 1.9.3 or better
|
18
|
+
* Foreman
|
19
|
+
|
20
|
+
|
21
|
+
== Installation
|
22
|
+
|
23
|
+
$ gem install foreman-export-daemontools
|
24
|
+
|
25
|
+
|
26
|
+
== Usage
|
27
|
+
|
28
|
+
To export your Procfile to the standard +/service+ directory:
|
29
|
+
|
30
|
+
$ foreman export daemontools /service
|
31
|
+
|
32
|
+
This will create a <tt>/service/<app>-<proc></tt> directory for each +Procfile+
|
33
|
+
process. If you have the concurrency set to something > 1 for any of them it
|
34
|
+
will create an individual numbered service directory for each one in the
|
35
|
+
format: <tt>/service/<app>-<proc>-<num></tt>
|
36
|
+
|
37
|
+
Each directory will be generated with a +down+ file, which will prevent
|
38
|
+
supervise from automatically starting it before you have a chance to look it over.
|
39
|
+
After you confirm that everything looks okay, you can start them up just by
|
40
|
+
removing +down+.
|
41
|
+
|
42
|
+
|
43
|
+
== Contributing
|
44
|
+
|
45
|
+
You can check out the current development source with Mercurial from its
|
46
|
+
{main repository}[https://bitbucket.org/ged/foreman-export-daemontools]. Or
|
47
|
+
if you prefer Git, via its
|
48
|
+
{Github mirror}[https://github.com/ged/foreman-export-daemontools].
|
49
|
+
|
50
|
+
After checking out the source, run:
|
51
|
+
|
52
|
+
$ rake newb
|
53
|
+
|
54
|
+
This task will install any missing dependencies, run the tests/specs,
|
55
|
+
and generate the API documentation.
|
56
|
+
|
57
|
+
|
58
|
+
== License
|
59
|
+
|
60
|
+
Copyright (c) 2012, Michael Granger
|
61
|
+
All rights reserved.
|
62
|
+
|
63
|
+
Redistribution and use in source and binary forms, with or without
|
64
|
+
modification, are permitted provided that the following conditions are met:
|
65
|
+
|
66
|
+
* Redistributions of source code must retain the above copyright notice,
|
67
|
+
this list of conditions and the following disclaimer.
|
68
|
+
|
69
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
70
|
+
this list of conditions and the following disclaimer in the documentation
|
71
|
+
and/or other materials provided with the distribution.
|
72
|
+
|
73
|
+
* Neither the name of the author/s, nor the names of the project's
|
74
|
+
contributors may be used to endorse or promote products derived from this
|
75
|
+
software without specific prior written permission.
|
76
|
+
|
77
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
78
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
79
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
80
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
|
81
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
82
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
83
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
84
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
85
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
86
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
87
|
+
|
88
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
|
6
|
+
Hoe.plugin :signing
|
7
|
+
Hoe.plugin :deveiate
|
8
|
+
Hoe.plugin :mercurial
|
9
|
+
|
10
|
+
Hoe.plugins.delete :rubyforge
|
11
|
+
|
12
|
+
hoespec = Hoe.spec( 'foreman-export-daemontools' ) do
|
13
|
+
self.readme_file = 'README.rdoc'
|
14
|
+
self.history_file = 'History.rdoc'
|
15
|
+
self.extra_rdoc_files = FileList[ '*.rdoc' ]
|
16
|
+
|
17
|
+
self.developer 'Michael Granger', 'ged@FaerieMUD.org'
|
18
|
+
|
19
|
+
self.dependency 'foreman', '~> 0.45'
|
20
|
+
self.dependency 'hoe-deveiate', '~> 0.1', :developer
|
21
|
+
|
22
|
+
self.spec_extras[:licenses] = ["BSD"]
|
23
|
+
self.spec_extras[:rdoc_options] = ['-f', 'fivefish', '-t', 'Foreman Daemontools Exporter']
|
24
|
+
self.require_ruby_version( '>=1.9.2' )
|
25
|
+
self.hg_sign_tags = true if self.respond_to?( :hg_sign_tags= )
|
26
|
+
self.check_history_on_release = true if self.respond_to?( :check_history_on_release= )
|
27
|
+
|
28
|
+
self.rdoc_locations << "deveiate:/usr/local/www/public/code/#{remote_rdoc_dir}"
|
29
|
+
end
|
30
|
+
|
31
|
+
ENV['VERSION'] ||= hoespec.spec.version.to_s
|
32
|
+
|
33
|
+
# Ensure the specs pass before checking in
|
34
|
+
task 'hg:precheckin' => [ :check_history, :check_manifest, :spec ]
|
35
|
+
|
@@ -0,0 +1,180 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# vim: set nosta noet ts=4 sw=4:
|
3
|
+
#encoding: utf-8
|
4
|
+
|
5
|
+
require 'erb'
|
6
|
+
require 'logger'
|
7
|
+
require 'pathname'
|
8
|
+
require 'foreman/export'
|
9
|
+
require 'foreman/cli'
|
10
|
+
|
11
|
+
|
12
|
+
# A Foreman exporter for daemontools[http://cr.yp.to/daemontools.html]. This exports
|
13
|
+
# processes from the Procfile as a hierarchy of directories intended to be run under
|
14
|
+
# 'supervise'
|
15
|
+
#
|
16
|
+
# Some of this code was borrowed from the 'runit' exporter.
|
17
|
+
class Foreman::Export::Daemontools < Foreman::Export::Base
|
18
|
+
|
19
|
+
# Library version constant
|
20
|
+
VERSION = '0.0.1'
|
21
|
+
|
22
|
+
# Version-control revision constant
|
23
|
+
REVISION = %q$Revision: 7e1c6eafef91 $
|
24
|
+
|
25
|
+
# The data directory in the project if that exists, otherwise the gem datadir
|
26
|
+
DEFAULT_DATADIR = if ENV['FOREMAN_EXPORT_DATADIR']
|
27
|
+
Pathname( ENV['FOREMAN_EXPORT_DATADIR'] )
|
28
|
+
elsif File.directory?( 'data/foreman-export-daemontools' )
|
29
|
+
Pathname( 'data/foreman-export-daemontools' )
|
30
|
+
elsif path = Gem.datadir( 'foreman-export-daemontools' )
|
31
|
+
Pathname( path )
|
32
|
+
else
|
33
|
+
raise ScriptError, "can't find the data directory!"
|
34
|
+
end
|
35
|
+
|
36
|
+
# Directory to look in for personal templates
|
37
|
+
HOME_TEMPLATEDIR = Pathname( "~/.foreman/templates" ).expand_path
|
38
|
+
|
39
|
+
# Pattern used to extract inline env variables from the command
|
40
|
+
ENV_VARIABLE_REGEX = /([a-zA-Z_]+[a-zA-Z0-9_]*)=(\S+)/
|
41
|
+
|
42
|
+
|
43
|
+
##
|
44
|
+
# The data directory for the gem
|
45
|
+
class << self; attr_accessor :datadir; end
|
46
|
+
@datadir = DEFAULT_DATADIR
|
47
|
+
|
48
|
+
|
49
|
+
### Set up the template root
|
50
|
+
def initialize( location, engine, options={} ) # :notnew:
|
51
|
+
super
|
52
|
+
@logger = Logger.new( $stderr )
|
53
|
+
@template_search_path = [ HOME_TEMPLATEDIR, DEFAULT_DATADIR + 'templates' ]
|
54
|
+
@template_search_path.unshift( Pathname(options[:template]) ) if options.key?( :template )
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
######
|
59
|
+
public
|
60
|
+
######
|
61
|
+
|
62
|
+
##
|
63
|
+
# The list of directories to search in for templates
|
64
|
+
attr_accessor :template_search_path
|
65
|
+
|
66
|
+
##
|
67
|
+
# The Logger object that gets exporter output
|
68
|
+
attr_accessor :logger
|
69
|
+
|
70
|
+
|
71
|
+
### Main API method -- export the loaded Procfile as supervise service directories
|
72
|
+
def export
|
73
|
+
servicedir = self.location or
|
74
|
+
raise Foreman::Export::Exception, "No service directory specified."
|
75
|
+
servicedir = Pathname( servicedir )
|
76
|
+
app = self.app || File.basename( self.engine.directory )
|
77
|
+
user = self.user || app
|
78
|
+
|
79
|
+
unless servicedir.exist?
|
80
|
+
say "Creating #{servicedir}..."
|
81
|
+
servicedir.mkpath
|
82
|
+
end
|
83
|
+
|
84
|
+
engine.procfile.entries.each do |process|
|
85
|
+
say "Setting up %s-%s service directories..." % [ app, process.name ]
|
86
|
+
count = self.concurrency[ process.name ]
|
87
|
+
say " concurrency = #{count}"
|
88
|
+
procdir = servicedir + "%s-%s" % [ app, process.name ]
|
89
|
+
|
90
|
+
# Create a numbered service dir for each instance if there are
|
91
|
+
# more than one
|
92
|
+
if count != 1
|
93
|
+
1.upto( count ) do |i|
|
94
|
+
self.write_servicedir( process, Pathname(procdir.to_s + "-#{i}"), user, i )
|
95
|
+
end
|
96
|
+
else
|
97
|
+
self.write_servicedir( process, procdir, user )
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
|
103
|
+
### Write a supervise directory to +targetdir+
|
104
|
+
def write_servicedir( process, procdir, user, num=1 )
|
105
|
+
say "Making directory %s..." % [ procdir ]
|
106
|
+
procdir.mkpath
|
107
|
+
|
108
|
+
# Write the down file to keep the service from spinning up before the user has
|
109
|
+
# a chance to look things over
|
110
|
+
write_file( procdir + 'down', '' )
|
111
|
+
|
112
|
+
# Set up logging
|
113
|
+
say " setting up logging..."
|
114
|
+
logdir = procdir + 'log'
|
115
|
+
logdir.mkpath
|
116
|
+
logruntmpl = self.load_template( 'log-run' )
|
117
|
+
runfile = logdir + 'run'
|
118
|
+
write_file( runfile, logruntmpl.result(binding()) )
|
119
|
+
runfile.chmod( 0755 )
|
120
|
+
|
121
|
+
# Set up the envdir
|
122
|
+
say " setting up environment variables..."
|
123
|
+
envdir = procdir + 'env'
|
124
|
+
envdir.mkpath
|
125
|
+
port = engine.port_for( process, num, self.port )
|
126
|
+
environment_variables = { 'PORT' => port }.
|
127
|
+
merge( engine.environment ).
|
128
|
+
merge( inline_variables(process.command) )
|
129
|
+
environment_variables.each_pair do |var, env|
|
130
|
+
write_file( envdir + var, env )
|
131
|
+
end
|
132
|
+
|
133
|
+
# Set up the runfile
|
134
|
+
runtmpl = self.load_template( 'run' )
|
135
|
+
runfile = procdir + 'run'
|
136
|
+
write_file( runfile, runtmpl.result(binding()) )
|
137
|
+
runfile.chmod( 0755 )
|
138
|
+
|
139
|
+
end
|
140
|
+
|
141
|
+
|
142
|
+
### Load the daemontools template for the file named +name+, and return it
|
143
|
+
### as an ERB object.
|
144
|
+
def load_template( name )
|
145
|
+
template_name = "#{name}.erb"
|
146
|
+
template = self.template_search_path.
|
147
|
+
map {|dir| dir + template_name }.
|
148
|
+
find {|tmpl| tmpl.exist? }
|
149
|
+
|
150
|
+
template or raise Foreman::Export::Exception,
|
151
|
+
"Can't find the %p template in any of: %p" %
|
152
|
+
[ name, self.template_search_path.map(&:to_s) ]
|
153
|
+
|
154
|
+
erbtmpl = ERB.new( template.read, nil, '<%>' )
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
#########
|
159
|
+
protected
|
160
|
+
#########
|
161
|
+
|
162
|
+
### Override to output to the logger instead of STDERR.
|
163
|
+
def say( message )
|
164
|
+
@logger.info( '[foreman export]' ) { message }
|
165
|
+
end
|
166
|
+
|
167
|
+
|
168
|
+
#######
|
169
|
+
private
|
170
|
+
#######
|
171
|
+
|
172
|
+
### Extract the inline environment variables from +command+ and return them as
|
173
|
+
### a Hash.
|
174
|
+
def inline_variables( command )
|
175
|
+
pairs = command.scan( ENV_VARIABLE_REGEX )
|
176
|
+
return Hash[ *pairs.flatten ]
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
end # Foreman::Export::Daemontools
|
data/spec/data/.env
ADDED
data/spec/data/.foreman
ADDED
data/spec/data/Procfile
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# vim: set nosta noet ts=4 sw=4:
|
3
|
+
# encoding: utf-8
|
4
|
+
|
5
|
+
BEGIN {
|
6
|
+
require 'pathname'
|
7
|
+
basedir = Pathname.new( __FILE__ ).dirname.parent.parent.parent
|
8
|
+
$LOAD_PATH.unshift( basedir ) unless $LOAD_PATH.include?( basedir )
|
9
|
+
}
|
10
|
+
|
11
|
+
require 'helpers'
|
12
|
+
|
13
|
+
require 'pathname'
|
14
|
+
require 'rspec'
|
15
|
+
require 'tmpdir'
|
16
|
+
|
17
|
+
require 'foreman/engine'
|
18
|
+
require 'foreman/export/daemontools'
|
19
|
+
|
20
|
+
|
21
|
+
#####################################################################
|
22
|
+
### C O N T E X T S
|
23
|
+
#####################################################################
|
24
|
+
RSpec.configure do |config|
|
25
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
26
|
+
config.order = 'rand'
|
27
|
+
config.mock_with( :rspec )
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
describe Foreman::Export::Daemontools do
|
32
|
+
|
33
|
+
let( :servicedir ) { Pathname(Dir.tmpdir) + 'service' }
|
34
|
+
let( :datadir ) { Pathname(__FILE__).dirname.parent.parent + 'data' }
|
35
|
+
let( :procfile ) { datadir + 'Procfile' }
|
36
|
+
let( :engine ) { Foreman::Engine.new(procfile) }
|
37
|
+
let( :options ) {{
|
38
|
+
:app_root => datadir,
|
39
|
+
:app => 'test',
|
40
|
+
:env => datadir + '.env',
|
41
|
+
:concurrency => 'cms=2,api=0,mongrel2=1',
|
42
|
+
:user => 'www',
|
43
|
+
}}
|
44
|
+
|
45
|
+
subject { described_class.new(servicedir, engine, options) }
|
46
|
+
|
47
|
+
before( :each ) do
|
48
|
+
logdevice = ArrayLogger.new
|
49
|
+
subject.logger = Logger.new( logdevice )
|
50
|
+
subject.logger.formatter = HtmlFormatter.new( subject.logger )
|
51
|
+
if ENV['HTML_LOGGING'] || (ENV['TM_FILENAME'] && ENV['TM_FILENAME'] =~ /_spec\.rb/)
|
52
|
+
Thread.current['logger-output'] = logdevice.array
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
after( :all ) do
|
57
|
+
servicedir.rmtree
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
it "exports to the filesystem" do
|
62
|
+
subject.export
|
63
|
+
servicedir.should exist()
|
64
|
+
|
65
|
+
%w[ test-cms-1 test-cms-2 test-mongrel2 ].each do |procname|
|
66
|
+
procdir = servicedir + procname
|
67
|
+
|
68
|
+
runfile = procdir + 'run'
|
69
|
+
runfile.should exist()
|
70
|
+
runfile.should be_executable()
|
71
|
+
runfile.read.should =~ %r{exec setuidgid www envdir \./env}
|
72
|
+
|
73
|
+
logdir = procdir + 'log'
|
74
|
+
logdir.should be_directory()
|
75
|
+
logrun = logdir + 'run'
|
76
|
+
logrun.should be_executable()
|
77
|
+
logrun.read.should =~ /exec setuidgid www multilog t/
|
78
|
+
|
79
|
+
envdir = procdir + 'env'
|
80
|
+
envdir.should be_directory()
|
81
|
+
( envdir + 'HOMEDIR' ).read.should == "/Users/ged\n"
|
82
|
+
( envdir + 'MONGREL2_HOME' ).read.should == "/var/run/mongrel2\n"
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
end
|
88
|
+
|
data/spec/helpers.rb
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
# vim: set nosta noet ts=4 sw=4:
|
3
|
+
#encoding: utf-8
|
4
|
+
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
# An alternate formatter for Logger instances that outputs +div+ HTML
|
8
|
+
# fragments.
|
9
|
+
class HtmlFormatter < Logger::Formatter
|
10
|
+
|
11
|
+
# The default HTML fragment that'll be used as the template for each log message.
|
12
|
+
HTML_LOG_FORMAT = %q{
|
13
|
+
<div class="log-message %5$s">
|
14
|
+
<span class="log-time">%1$s.%2$06d</span>
|
15
|
+
[
|
16
|
+
<span class="log-pid">%3$d</span>
|
17
|
+
/
|
18
|
+
<span class="log-tid">%4$s</span>
|
19
|
+
]
|
20
|
+
<span class="log-level">%5$s</span>
|
21
|
+
:
|
22
|
+
<span class="log-name">%6$s</span>
|
23
|
+
<span class="log-message-text">%7$s</span>
|
24
|
+
</div>
|
25
|
+
}
|
26
|
+
|
27
|
+
### Override the logging formats with ones that generate HTML fragments
|
28
|
+
def initialize( logger, format=HTML_LOG_FORMAT ) # :notnew:
|
29
|
+
@logger = logger
|
30
|
+
@format = format
|
31
|
+
super()
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
######
|
36
|
+
public
|
37
|
+
######
|
38
|
+
|
39
|
+
# The HTML fragment that will be used as a format() string for the log
|
40
|
+
attr_accessor :format
|
41
|
+
|
42
|
+
|
43
|
+
### Return a log message composed out of the arguments formatted using the
|
44
|
+
### formatter's format string
|
45
|
+
def call( severity, time, progname, msg )
|
46
|
+
args = [
|
47
|
+
time.strftime( '%Y-%m-%d %H:%M:%S' ), # %1$s
|
48
|
+
time.usec, # %2$d
|
49
|
+
Process.pid, # %3$d
|
50
|
+
Thread.current == Thread.main ? 'main' : Thread.object_id, # %4$s
|
51
|
+
severity.downcase, # %5$s
|
52
|
+
progname, # %6$s
|
53
|
+
escape_html( msg ).gsub(/\n/, '<br />') # %7$s
|
54
|
+
]
|
55
|
+
|
56
|
+
return self.format % args
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
#######
|
61
|
+
private
|
62
|
+
#######
|
63
|
+
|
64
|
+
### Escape any HTML special characters in +string+.
|
65
|
+
def escape_html( string )
|
66
|
+
return string.
|
67
|
+
gsub( '&', '&' ).
|
68
|
+
gsub( '<', '<' ).
|
69
|
+
gsub( '>', '>' )
|
70
|
+
end
|
71
|
+
|
72
|
+
end # class HtmlFormatter
|
73
|
+
|
74
|
+
|
75
|
+
# A logger outputter that logs to an Array.
|
76
|
+
class ArrayLogger
|
77
|
+
### Create a new ArrayLogger that will append content to +array+.
|
78
|
+
def initialize( array=[] )
|
79
|
+
@array = array
|
80
|
+
end
|
81
|
+
|
82
|
+
######
|
83
|
+
public
|
84
|
+
######
|
85
|
+
|
86
|
+
##
|
87
|
+
# The array of logger output
|
88
|
+
attr_reader :array
|
89
|
+
|
90
|
+
### Write the specified +message+ to the array.
|
91
|
+
def write( message )
|
92
|
+
@array << message
|
93
|
+
end
|
94
|
+
|
95
|
+
### No-op -- this is here just so Logger doesn't complain
|
96
|
+
def close; end
|
97
|
+
|
98
|
+
end # class ArrayLogger
|
99
|
+
|
metadata
ADDED
@@ -0,0 +1,169 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman-export-daemontools
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Michael Granger
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain:
|
12
|
+
- !binary |-
|
13
|
+
LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURMRENDQWhTZ0F3SUJB
|
14
|
+
Z0lCQURBTkJna3Foa2lHOXcwQkFRVUZBREE4TVF3d0NnWURWUVFEREFOblpX
|
15
|
+
UXgKRnpBVkJnb0praWFKay9Jc1pBRVpGZ2RmWVdWeWFXVmZNUk13RVFZS0Na
|
16
|
+
SW1pWlB5TEdRQkdSWURiM0puTUI0WApEVEV3TURreE5qRTBORGcxTVZvWERU
|
17
|
+
RXhNRGt4TmpFME5EZzFNVm93UERFTU1Bb0dBMVVFQXd3RFoyVmtNUmN3CkZR
|
18
|
+
WUtDWkltaVpQeUxHUUJHUllIWDJGbGNtbGxYekVUTUJFR0NnbVNKb21UOGl4
|
19
|
+
a0FSa1dBMjl5WnpDQ0FTSXcKRFFZSktvWklodmNOQVFFQkJRQURnZ0VQQURD
|
20
|
+
Q0FRb0NnZ0VCQUx5Ly9CRnhDMWYvY1BTbnd0SkJXb0ZpRnJpcgpoN1JpY0kr
|
21
|
+
am9xL29jVlhRcUk0VERXUHlGLzh0cWt2dCtyRDk5WDlxczJZZVI4Q1UvWWlJ
|
22
|
+
cExXclFPWVNUNzBKCnZEbjdVdmhiMm11RlZxcTYrdm9iZVRrSUxCRU82cGlv
|
23
|
+
bldERzhqU2JvM3FLbTFSaktKRHdnOXA0d05LaFB1dTgKS0d1ZS9CRmI2N0tm
|
24
|
+
bHF5QXBQbVBlYjNWZGQ5Y2xzcHpxZUZxcDdjVUJNRXBGUzZMV3h5NEdrK3F2
|
25
|
+
RkZKQkpMQgpCVUhFL0xaVkpNVnpmcEM1VXErUW1ZN0IrRkgvUXFObmRuM3RP
|
26
|
+
SGdzUGFkTFROaW11QjFzQ3VMMWE0ejNQZXBkClRlTEJFRm1FYW81RGszSy9R
|
27
|
+
OG84dmxiSUIvakJEVFV4NkRqYmd4dzc3OTA5eDZnSTlkb1U0TEQ1WE1jQ0F3
|
28
|
+
RUEKQWFNNU1EY3dDUVlEVlIwVEJBSXdBREFMQmdOVkhROEVCQU1DQkxBd0hR
|
29
|
+
WURWUjBPQkJZRUZKZW9Ha09yOWw0Qgorc2FNa1cvWlhUNFVlU3ZWTUEwR0NT
|
30
|
+
cUdTSWIzRFFFQkJRVUFBNElCQVFCRzJLT2J2WUkyZUh5eUJVSlNKM2pOCnZF
|
31
|
+
blUzZDYwem5BWGJyU2QycWIzcjFsWTFFUEREM2JjeTBNZ2dDZkdkZzNYdTU0
|
32
|
+
ejIxb3F5SWRrOHVHdFdCUEwKSElhOUVnZkZHU1VFZ3ZjSXZhWXFpTjRqVFV0
|
33
|
+
aWRmRUZ3K0x0anM4QVA5Z1dnU0lZUzZHcjM4VjBXR0ZGTnpJSAphT0Qyd211
|
34
|
+
OW9vL1JmZlc0aFMvOEd1dmZNemN3N0NRMzU1d0ZSNEtCL255emUrRXNaMVk1
|
35
|
+
RGVyQ0FhZ01WdURRClUwQkxtV0RGelBHR1dsUGVRQ3JZSENyK0FjSnorTlJu
|
36
|
+
YUhDS0xaZFNLai9SSHVUT3QrZ2JsUmV4OEZBaDhOZUEKY21saFhlNDZwWk5K
|
37
|
+
Z1dLYnhaYWg4NWpJang5NWhSOHZPSStOQU01aUg5a09xSzEzRHJ4YWNUS1Bo
|
38
|
+
cWo1UGp3RgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
|
39
|
+
date: 2012-05-02 00:00:00.000000000 Z
|
40
|
+
dependencies:
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: foreman
|
43
|
+
requirement: &70130722360800 !ruby/object:Gem::Requirement
|
44
|
+
none: false
|
45
|
+
requirements:
|
46
|
+
- - ~>
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0.45'
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: *70130722360800
|
52
|
+
- !ruby/object:Gem::Dependency
|
53
|
+
name: hoe-mercurial
|
54
|
+
requirement: &70130722359620 !ruby/object:Gem::Requirement
|
55
|
+
none: false
|
56
|
+
requirements:
|
57
|
+
- - ~>
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 1.4.0
|
60
|
+
type: :development
|
61
|
+
prerelease: false
|
62
|
+
version_requirements: *70130722359620
|
63
|
+
- !ruby/object:Gem::Dependency
|
64
|
+
name: hoe-highline
|
65
|
+
requirement: &70130722357580 !ruby/object:Gem::Requirement
|
66
|
+
none: false
|
67
|
+
requirements:
|
68
|
+
- - ~>
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 0.1.0
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: *70130722357580
|
74
|
+
- !ruby/object:Gem::Dependency
|
75
|
+
name: rdoc
|
76
|
+
requirement: &70130722377660 !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ~>
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '3.10'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: *70130722377660
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: hoe-deveiate
|
87
|
+
requirement: &70130722371520 !ruby/object:Gem::Requirement
|
88
|
+
none: false
|
89
|
+
requirements:
|
90
|
+
- - ~>
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0.1'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: *70130722371520
|
96
|
+
- !ruby/object:Gem::Dependency
|
97
|
+
name: hoe
|
98
|
+
requirement: &70130722405460 !ruby/object:Gem::Requirement
|
99
|
+
none: false
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '3.0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: *70130722405460
|
107
|
+
description: ! 'An exporter for David Dollar''s Foreman[https://github.com/ddollar/foreman]
|
108
|
+
that
|
109
|
+
|
110
|
+
outputs service directories that can be managed by ''supervise'' from DJB''s
|
111
|
+
|
112
|
+
daemontools[http://cr.yp.to/daemontools.html].'
|
113
|
+
email:
|
114
|
+
- ged@FaerieMUD.org
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files:
|
118
|
+
- History.rdoc
|
119
|
+
- Manifest.txt
|
120
|
+
- README.rdoc
|
121
|
+
files:
|
122
|
+
- .env
|
123
|
+
- .foreman
|
124
|
+
- ChangeLog
|
125
|
+
- History.rdoc
|
126
|
+
- Manifest.txt
|
127
|
+
- Procfile
|
128
|
+
- README.rdoc
|
129
|
+
- Rakefile
|
130
|
+
- data/foreman-export-daemontools/templates/log-run.erb
|
131
|
+
- data/foreman-export-daemontools/templates/run.erb
|
132
|
+
- lib/foreman/export/daemontools.rb
|
133
|
+
- spec/data/.env
|
134
|
+
- spec/data/.foreman
|
135
|
+
- spec/data/Procfile
|
136
|
+
- spec/foreman/export/daemontools_spec.rb
|
137
|
+
- spec/helpers.rb
|
138
|
+
- .gemtest
|
139
|
+
homepage: https://bitbucket.org/ged/foreman-export-daemontools
|
140
|
+
licenses:
|
141
|
+
- BSD
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options:
|
144
|
+
- -f
|
145
|
+
- fivefish
|
146
|
+
- -t
|
147
|
+
- Foreman Daemontools Exporter
|
148
|
+
require_paths:
|
149
|
+
- lib
|
150
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
151
|
+
none: false
|
152
|
+
requirements:
|
153
|
+
- - ! '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: 1.9.2
|
156
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
157
|
+
none: false
|
158
|
+
requirements:
|
159
|
+
- - ! '>='
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
version: '0'
|
162
|
+
requirements: []
|
163
|
+
rubyforge_project: foreman-export-daemontools
|
164
|
+
rubygems_version: 1.8.16
|
165
|
+
signing_key:
|
166
|
+
specification_version: 3
|
167
|
+
summary: An exporter for David Dollar's Foreman[https://github.com/ddollar/foreman]
|
168
|
+
that outputs service directories that can be managed by 'supervise' from DJB's daemontools[http://cr.yp.to/daemontools.html].
|
169
|
+
test_files: []
|
metadata.gz.sig
ADDED
Binary file
|