mailmanager 1.0.13 → 1.0.14
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/Changelog +5 -1
- data/README.rdoc +61 -1
- data/lib/mailmanager/lib.rb +1 -1
- data/lib/mailmanager/version.rb +1 -1
- metadata +3 -3
data/Changelog
CHANGED
@@ -1,4 +1,8 @@
|
|
1
|
-
Current version is 1.0.
|
1
|
+
Current version is 1.0.14
|
2
|
+
|
3
|
+
changes since 1.0.13
|
4
|
+
- more detailed error report when creating a new list fails
|
5
|
+
- make it a MailmanExecuteError when creating a new list fails
|
2
6
|
|
3
7
|
changes since 1.0.12
|
4
8
|
- added list description= setter method to List class
|
data/README.rdoc
CHANGED
@@ -23,6 +23,66 @@ check your Python version before using this.
|
|
23
23
|
new_list.add_member('bar@baz.com')
|
24
24
|
new_list.members (returns ['foo@baz.com'])
|
25
25
|
|
26
|
+
== Hacking
|
27
|
+
|
28
|
+
Here are the basic steps for adding new features to this gem, if you're a programmer
|
29
|
+
type who likes to write code so you can code while you code... sorry.
|
30
|
+
|
31
|
+
MailManager's API currently consists of a handful of methods at the top-level
|
32
|
+
MailManager::Base class. This is where you'll find create_list and get_list. These
|
33
|
+
both return instances of MailManager::List, which is really where the action is.
|
34
|
+
|
35
|
+
MailManager::List contains the public Ruby API for interacting with Mailman's lists.
|
36
|
+
It exposes the methods and attributes of Mailman's MailList.py class, but makes
|
37
|
+
them a bit more Ruby-ish where appropriate. Not every method / attribute is
|
38
|
+
exposed, but this is where you come in, dear contributor.
|
39
|
+
|
40
|
+
The code that actually talks to Mailman is in lib/mailmanager/lib.rb.
|
41
|
+
It runs scripts in Mailman's bin directory. Anything that interacts with an
|
42
|
+
existing list uses Mailman's "withlist" script and the listproxy.py file in this
|
43
|
+
gem. If you read the docs on withlist that come with Mailman, it should be pretty
|
44
|
+
obvious what's going on there. But you don't need to understand all that to expose
|
45
|
+
new methods & attributes of MailList.py to MailManager.
|
46
|
+
|
47
|
+
Exposing new list properties works something like this:
|
48
|
+
- Look at Mailman's code in Mailman/MailList.py and see if the thing you want to
|
49
|
+
expose is a method or an attribute. You'll need to know a little Python, but not
|
50
|
+
much. Basically, a method is a callable thing and an attribute is a simple
|
51
|
+
property of the object. "AddMember" is a method, for example, while "description"
|
52
|
+
is an attribute.
|
53
|
+
- If it's a method, just write a simple method in lib/mailmanager/list.rb that
|
54
|
+
calls a method in lib.rb (just like the others do). Then go write the method
|
55
|
+
that you call in lib/mailmanager/lib.rb, using list_address or add_member as an
|
56
|
+
example (depending on whether you're writing a getter or a setter, respectively).
|
57
|
+
- All methods that interact with MailList.py instances (i.e. mailing lists) use the
|
58
|
+
withlist command, so just copy that stuff from an existing method.
|
59
|
+
- If you're exposing an attribute, then use the moderator methods as a guide.
|
60
|
+
For example, they do their own dupe checking since the MailList.py class will
|
61
|
+
let you set the attribute to whatever you want. Dangerous!
|
62
|
+
- If you're writing a setter, you have one more chore to make it work. You need the
|
63
|
+
listproxy.py code to lock the list and then save it after making your requested
|
64
|
+
change. It will do this for you if you do the following:
|
65
|
+
- For a method: Add the name of the MailList.py method to the needs_save dict and
|
66
|
+
have it return True. It should be obvious when you look at the others in there.
|
67
|
+
- For an attribute: Add the name of the attribute to the needs_save_with_arg dict.
|
68
|
+
This one is a bit different because the attr name is the same for gets and sets,
|
69
|
+
but we need to lock and save when it's a set, and we can guess that it's a set
|
70
|
+
when there is an argument passed, and a get when there is no argument. S-M-R-T
|
71
|
+
- For a chain of attrs/methods: Huh? Look at lib.rb#add_moderator for an
|
72
|
+
example. "moderator" is an array attribute of MailList.py, and we want to
|
73
|
+
append a new string to it. So our "command" to listproxy.py is
|
74
|
+
"moderator.append" with the new moderator string as the argument. listproxy is
|
75
|
+
smart enough to untangle that and get the moderator attribute and then call the
|
76
|
+
append method on it with your argument. But, in order to tell it to lock and
|
77
|
+
save the list for us, we must replace that dot in the name with an
|
78
|
+
underscore in the needs_save key. That's why we have "moderator_append=True"
|
79
|
+
in the needs_save dict in listproxy.py. So if you have a chain of attributes
|
80
|
+
and methods to get at the thing you're exposing, just replace the dots with
|
81
|
+
underscores in the needs_save dict key and you'll be all set.
|
82
|
+
|
83
|
+
That should get you started hacking on the gem. If you get stuck or are trying to
|
84
|
+
do anything more complex, please feel free to e-mail me: cap10morgan@gmail.com.
|
85
|
+
|
26
86
|
== Contributing
|
27
87
|
|
28
88
|
- Fork on GitHub
|
@@ -33,7 +93,7 @@ check your Python version before using this.
|
|
33
93
|
|
34
94
|
== Author
|
35
95
|
|
36
|
-
- Wes Morgan (cap10morgan on GitHub)
|
96
|
+
- Wes Morgan (cap10morgan on GitHub) <cap10morgan@gmail.com>
|
37
97
|
|
38
98
|
Copyright 2011 Democratic National Committee,
|
39
99
|
All Rights Reserved.
|
data/lib/mailmanager/lib.rb
CHANGED
@@ -209,7 +209,7 @@ module MailManager
|
|
209
209
|
list_name = match[1]
|
210
210
|
end
|
211
211
|
end
|
212
|
-
raise "Error getting name of newly created list" if list_name.nil?
|
212
|
+
raise MailmanExecuteError, "Error getting name of newly created list. Mailman sent:\n#{output}" if list_name.nil?
|
213
213
|
return_obj = MailManager::List.new(list_name)
|
214
214
|
when :list_lists
|
215
215
|
lists = []
|
data/lib/mailmanager/version.rb
CHANGED
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 1
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: 1.0.
|
8
|
+
- 14
|
9
|
+
version: 1.0.14
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Wes Morgan
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-01-
|
17
|
+
date: 2011-01-31 00:00:00 -05:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|