Secretary Workflow
The next step of automating the workflow of the Apache Software Foundation secretarial task went operational today. The current flow now looks like this:
- Person prints and signs a document
- Said document is scanned, photographed, faxed, or sent via postal mail to the ASF. In all but the latter case, this results in an email to both myself and to Craig Russell. In the case of postal mail, it eventually arrives at my house, where I simply scan the document, and proceed to Step 5.
- All such email is archived in mbox format on minotaur.apache.org.
- I have a cron job which detaches the documents and stores them in svn for processing. Additionally, the name, email address, message id, and subject are stored in Subversion properties for later use. The act of committing this also causes an email to go out to those at the ASF that watch for such things.
- I have a ruby based CGI application that makes use of frames and even a small amount of AJAX. Within the browser, either Craig or I can select a document that is in the received folder, view it in a second frame, transform it using ImageMagic or pdftk, and file it. The act of committing the document and associated files we use to track the document causes more email messages. Additionally - and this is new as of this week - Mikel Lindsaar’s mail gem is used to send out emails to the person mentioned in the document (copying the original sender, should that person be different).
- A script originally written by me and now maintained by Jim Jagielski, analyzes the files we use to track documents, and publishes a list for all to see.
More details on the mail merge described in step 5. It starts with a configuration file. Here’s mine:
require 'rubygems' require 'mail' Mail.defaults do smtp do host 'smtp-server.nc.rr.com' helo 'intertwingly.net' end @from = 'Sam Ruby <secretary@apache.org>' @sig = %{ -- Sam Ruby Secretary, Apache Software Foundation } end
Plus an ERB template file:
to: <%= pubname.inspect %> <<%= email %>> from: <%= from %> cc: secretary@apache.org bcc: <%= bcc %> subject: Your ICLA sent to Apache Secretary Dear <%= pubname %>, This message acknowledges receipt of your ICLA, which has been filed in the Apache Software Foundation records. <%= sig %>
And ultimately, it is processed thus (where vars is an OpenStruct, initially populated with data from HTML forms input and svn properties):
# extract fields from the Mail defaults Mail.defaults do vars.sig = instance_eval {@sig.gsub(/^ +/,'').strip} vars.from = instance_eval {@from} vars.bcc = instance_eval {@bcc} end # expand template message = ERB.new(open(template).read).result(vars.send(:binding)) headers = message.slice!(/\A(\w+: .*\r?\n)*(\r?\n)*/) mail = Mail.new do # apply headers headers.scan(/(\w+):[ \t]*(.*)/).each do |name, value| send name, value unless value.empty? end body message # is this a reply? if vars.email_id in_reply_to vars.email_id references vars.email_id # override subject? if vars.email_subject and !vars.email_subject.empty? subject 're: ' + vars.email_subject end end end # add additional cc if email:addr != email if vars.email_addr and vars.email_addr != vars.email if vars.email_name cc = "#{vars.email_name.inspect} <#{vars.email_addr}>" else cc = vars.email_addr end mail.cc = (mail.cc + [cc]).join(', ') end # ship it! mail.deliver!