* Added rdoc-generation to the cruise task and the artifacts that get saved

* Added Darkfish external and fixed up the RDoc generation task to use it
 * Factored out the config-file reading from #owner into a generic config reader, and then added some
   methods to access config values
 * Fixed the message-file sort block
 * Added a DRb service daemon: Ezmlm::ListDaemon
This commit is contained in:
Michael Granger 2008-05-10 01:52:42 +00:00
parent 8ff689e698
commit cf10ef2d7b
5 changed files with 126 additions and 61 deletions

View file

@ -31,6 +31,9 @@ class Ezmlm::List
def initialize( listdir )
listdir = Pathname.new( listdir ) if !listdir.is_a?( Pathname )
@listdir = listdir
# Cached lookups
@config = nil
end
@ -42,6 +45,25 @@ class Ezmlm::List
attr_reader :listdir
### Return the configured name of the list (without the host)
def name
return self.config[ 'L' ]
end
### Return the configured host of the list
def host
return self.config[ 'H' ]
end
### Return the configured address of the list (in list@host form)
def address
return "%s@%s" % [ self.name, self.host ]
end
alias_method :fullname, :address
### Return the number of messages in the list archive
def message_count
numfile = self.listdir + 'num'
@ -62,16 +84,28 @@ class Ezmlm::List
mail = self.last_post or return nil
return mail.from
end
### Return the list config as a Hash
def config
unless @config
configfile = self.listdir + 'config'
raise "List config file %p does not exist" % [ configfile ] unless configfile.exist?
@config = configfile.read.scan( /^(\S):([^\n]*)$/m ).inject({}) do |h,pair|
key,val = *pair
h[key] = val
h
end
end
return @config
end
### Return the email address of the list's owner.
def owner
config = self.listdir + 'config'
if config.read =~ /^5:([^\n]+)$/m
return $1
else
return nil
end
self.config['5']
end
@ -148,7 +182,7 @@ class Ezmlm::List
# Find the last numbered file under the last numbered directory we found
# above.
last_post_path = Pathname.glob( last_archdir + '[0-9]*' ).
sort_by {|pn| Integer(pn.basename.to_s) }.last
sort_by {|pn| pn.basename.to_s }.last
raise RuntimeError, "unexpectedly empty archive directory '%s'" % [ last_archdir ] \
unless last_post_path