lib/ezmlm.rb
changeset 12 3cc813140c80
parent 6 66beb495a861
child 14 cba9fb39bcdb
equal deleted inserted replaced
11:7fc2d1713795 12:3cc813140c80
     1 #!/usr/bin/ruby
     1 #!/usr/bin/ruby
       
     2 # vim: set nosta noet ts=4 sw=4:
     2 #
     3 #
     3 # A Ruby programmatic interface to the ezmlm-idx mailing list system
     4 # A Ruby programmatic interface to the ezmlm-idx mailing list system
     4 #
     5 #
     5 # == Version
     6 # == Version
     6 #
     7 #
     7 #  $Id$
     8 #  $Id$
     8 #
     9 #
     9 # == Authors
       
    10 #
       
    11 # * Michael Granger <mgranger@laika.com>
       
    12 # * Jeremiah Jordan <jjordan@laika.com>
       
    13 #
       
    14 # :include: LICENSE
       
    15 # 
       
    16 #---
    10 #---
    17 #
    11 #
    18 # Please see the file LICENSE in the base directory for licensing details.
    12 # Please see the file LICENSE in the base directory for licensing details.
    19 #
    13 #
    20 
    14 
    22 
    16 
    23 
    17 
    24 ### Toplevel namespace module
    18 ### Toplevel namespace module
    25 module Ezmlm
    19 module Ezmlm
    26 
    20 
    27 	# SVN Revision
       
    28 	SVNRev = %q$Rev$
       
    29 
       
    30 	# SVN Id
       
    31 	SVNId = %q$Id$
       
    32 
       
    33 	# Package version
    21 	# Package version
    34 	VERSION = '0.0.1'
    22 	VERSION = '0.1.0'
    35 
       
    36 
    23 
    37 	require 'ezmlm/list'
    24 	require 'ezmlm/list'
    38 	require 'ezmlm/listdaemon'
       
    39 	
       
    40 
    25 
    41 	###############
    26 	###############
    42 	module_function
    27 	module_function
    43 	###############
    28 	###############
    44 
    29 
    45 	### Find all directories that look like an Ezmlm list directory under the specified +listsdir+
    30 	### Find all directories that look like an Ezmlm list directory under the specified +listsdir+
    46 	### and return Pathname objects for each.
    31 	### and return Pathname objects for each.
       
    32 	###
    47 	def find_directories( listsdir )
    33 	def find_directories( listsdir )
    48 		listsdir = Pathname.new( listsdir )
    34 		listsdir = Pathname.new( listsdir )
    49 		return Pathname.glob( listsdir + '*' ).select do |entry|
    35 		return Pathname.glob( listsdir + '*' ).select do |entry|
    50 			entry.directory? && ( entry + 'mailinglist' ).exist?
    36 			entry.directory? && ( entry + 'mailinglist' ).exist?
    51 		end
    37 		end
    52 	end
    38 	end
    53 	
    39 
    54 
    40 
    55 	### Iterate over each directory that looks like an Ezmlm list in the specified +listsdir+ and
    41 	### Iterate over each directory that looks like an Ezmlm list in the specified +listsdir+ and
    56 	### yield it as an Ezmlm::List object.
    42 	### yield it as an Ezmlm::List object.
       
    43 	###
    57 	def each_list( listsdir )
    44 	def each_list( listsdir )
    58 		find_directories( listsdir ).each do |entry|
    45 		find_directories( listsdir ).each do |entry|
    59 			yield( Ezmlm::List.new(entry) )
    46 			yield( Ezmlm::List.new(entry) )
    60 		end
    47 		end
    61 	end
    48 	end
    62 	
       
    63 
    49 
    64 end # module Ezmlm
    50 end # module Ezmlm
    65 
    51 
    66 # vim: set nosta noet ts=4 sw=4: