author | Mahlon E. Smith <mahlon@martini.nu> |
Thu, 03 Oct 2019 11:46:05 -0700 | |
changeset 29 | 5e07ff7d5601 |
parent 28 | 99fdbf4a5f37 |
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 |
29
5e07ff7d5601
Remove accidently expanded Id tag.
Mahlon E. Smith <mahlon@martini.nu>
parents:
28
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 |
28
99fdbf4a5f37
Be explicit with sticky removal, so two simultaneous processes don't create a race where sticky is left enabled.
Mahlon E. Smith <mahlon@martini.nu>
parents:
25
diff
changeset
|
17 |
VERSION = '1.1.2' |
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| |
25
81cc7d47f68f
Oop, the 'mailinglist' file was leftover from older ezmlm. Not created by ezmlm-make anymore.
Mahlon E. Smith <mahlon@martini.nu>
parents:
24
diff
changeset
|
38 |
entry.directory? && ( entry + 'ezmlmrc' ).exist? |
6 | 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 |