author | Mahlon E. Smith <mahlon@laika.com> |
Wed, 24 May 2017 15:42:39 -0700 | |
changeset 24 | f8873b391f3d |
parent 22 | d1b9dd767e3a |
child 25 | 81cc7d47f68f |
permissions | -rw-r--r-- |
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
1 |
# vim: set nosta noet ts=4 sw=4: |
17 | 2 |
|
20
9d59d30685cb
Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents:
18
diff
changeset
|
3 |
require 'pathname' |
17 | 4 |
|
5 |
# A Ruby interface to the ezmlm-idx mailing list system. |
|
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
6 |
# |
17 | 7 |
# Ezmlm.find_directories( '/lists' ) #=> [ Ezmlm::List, Ezmlm::List ] |
8 |
# |
|
9 |
# Ezmlm.each_list( '/lists' ) do |list| |
|
10 |
# puts "\"%s\" <%s>" % [ list.name, list.address ] |
|
11 |
# end |
|
12 |
# |
|
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
13 |
module Ezmlm |
20
9d59d30685cb
Fixes for documentation and test directories that didn't make it into the repo.
Mahlon E. Smith <mahlon@laika.com>
parents:
18
diff
changeset
|
14 |
# $Id$ |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
15 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
16 |
# Package version |
24
f8873b391f3d
Add a "last activity" method to quickly determine when a list was last used. Bump version.
Mahlon E. Smith <mahlon@laika.com>
parents:
22
diff
changeset
|
17 |
VERSION = '1.1.0' |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
18 |
|
15 | 19 |
# Suck in the components. |
20 |
# |
|
16
e135ccae6783
Migrate hashing functions to C.
Mahlon E. Smith <mahlon@laika.com>
parents:
15
diff
changeset
|
21 |
require 'ezmlm/hash' |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
22 |
require 'ezmlm/list' |
15 | 23 |
require 'ezmlm/list/author' |
24 |
require 'ezmlm/list/message' |
|
25 |
require 'ezmlm/list/thread' |
|
26 |
||
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
27 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
28 |
############### |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
29 |
module_function |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
30 |
############### |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
31 |
|
14 | 32 |
### Find all directories that look like an Ezmlm list directory under |
33 |
### the specified +listsdir+ and return Pathname objects for each. |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
34 |
### |
6 | 35 |
def find_directories( listsdir ) |
36 |
listsdir = Pathname.new( listsdir ) |
|
14 | 37 |
return Pathname.glob( listsdir + '*' ).sort.select do |entry| |
6 | 38 |
entry.directory? && ( entry + 'mailinglist' ).exist? |
39 |
end |
|
40 |
end |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
41 |
|
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
42 |
|
14 | 43 |
### Iterate over each directory that looks like an Ezmlm list in the |
44 |
### specified +listsdir+ and yield it as an Ezmlm::List object. |
|
12
3cc813140c80
First round of modernizing after a long absence.
Mahlon E. Smith <mahlon@martini.nu>
parents:
6
diff
changeset
|
45 |
### |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
46 |
def each_list( listsdir ) |
6 | 47 |
find_directories( listsdir ).each do |entry| |
1
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
48 |
yield( Ezmlm::List.new(entry) ) |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
49 |
end |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
50 |
end |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
51 |
|
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
52 |
end # module Ezmlm |
1d3cfd4837a8
Filled out the project, added Ezmlm module + spec.
Michael Granger <mgranger@laika.com>
parents:
diff
changeset
|
53 |