The method below is a sample showing the main steps for processing an
emeritus request.
It needs some work.
def to_emeritus(id, env, _)
user = ASF::Person[id]
unless user
raise ArgumentError.new("Person record not found for #{id}")
end
# is there already an emeritus file?
emfile = ASF::EmeritusFiles.find(user)
if emfile
raise ArgumentError.new("Emeritus file is already present for
#{id}: #{emfile}")
end
# find the request file name for the id
file = ASF::EmeritusRequestFiles.find(user)
unless file
raise ArgumentError.new("Emeritus request file not found for #{id}")
end
# this is the file we want to update
members = File.join(ASF::SVN.svnurl('foundation'),'members.txt')
msg = "to_emeritus_#{id}"
begin
ASF::SVN.multiUpdate(members,msg,env,_) do |text|
text += "\n#{msg}\n" # TODO update members.txt properly
src = File.join(ASF::SVN.svnurl('emeritus-requests-received'),file)
dst = File.join(ASF::SVN.svnurl('emeritus'),file)
[text,[['mv', src, dst]]]
end
rescue => e
p e
# TODO add recovery. In theory, should not fail because cannot
have request where
end
end