intertwingly

It’s just data

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:

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!

Think Different

Tim Bray For creative people, this device is nothing.  Tim also is quite concerned about losing access to emacs.

Imagine a 2.66GHz Intel computer with five USB 2.0 ports, one FireWire 800 port, a mini-DVI port, and a DVD burner.  Comes with a wireless keyboard and a 9.7 inch wireless display.  The display is fully touch enabled, and can even support a virtual keyboard.  Yes, this system runs EMACs.  It also can run J2EE, Ruby on Rails, and Django.  The display connects to the base station via 802.11, and supports both canvas and AJAX.  Comes with OS/X, but you can also install Windows 7 and/or Linux alongside it if that is your preference.

...