commit aabe1674a2ae1b5e0c47b1df1b50bdb897c7a57f
Author: Marc Dequènes (Duck) <Duck@DuckCorp.org>
Date:   Thu Apr 8 04:03:15 2010 +0200

    [doc] Postman workflow (closes #28)

diff --git a/.gitignore b/.gitignore
index 0e1ad87..8962723 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,10 @@
 .config
 lib/cyborghood/base/config_setup.rb
 data/locale
+# doc generation
+doc/*.aux
+doc/*.log
+doc/*.pdf
 #
 conf
 var
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..ddcbd45
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,20 @@
+
+SOURCES := $(wildcard *.tex)
+
+all: pdf
+
+clean:
+	rm -f *.aux *.dvi *.out *.log *.glo *.idx *.ind *.ilg *.lot *.lof *.toc *.fo *.tmp *.cb* *.log
+
+dist-clean: clean
+	rm -f *.xhtml *.pdf *.ps *.txt
+
+%.pdf: %.tex
+	pdflatex $< $@
+
+pdf: $(patsubst %.tex,%.pdf,$(SOURCES))
+
+plop:
+	@echo $(SOURCES)
+	@echo $(patsubst %.tex,%.pdf,$(SOURCES))
+
diff --git a/doc/postman_workflow.tex b/doc/postman_workflow.tex
new file mode 100644
index 0000000..8fb0e24
--- /dev/null
+++ b/doc/postman_workflow.tex
@@ -0,0 +1,88 @@
+\documentclass{article}
+
+\usepackage[utf8]{inputenc}
+\usepackage{vmargin}
+\usepackage{bookman}
+\usepackage[T1]{fontenc}
+\usepackage{tikz}
+\usetikzlibrary{shapes,arrows}
+
+
+%% Paramètres de mise en page
+\setpapersize{A4}
+\setmarginsrb   {10mm} % left margin
+                {10mm} % top margin
+                {10mm} % right margin
+                {10mm} % bottom margin
+                {10mm} % head height
+                {5mm} % head sep
+                {0pt} % foot height
+                {24pt} % foot skip
+\parskip 6pt
+
+
+\begin{document}
+\pagestyle{empty}
+
+\begin{center}
+  \normalfont
+  {\LARGE Postman Workflow\par}%
+\end{center}%
+\vfill
+
+% Define block styles
+\tikzstyle{decision} = [diamond, draw, fill=green!20,
+    text width=4.5em, text badly centered, inner sep=0pt]
+\tikzstyle{decision answer}=[color=black]
+\tikzstyle{block} = [rectangle, draw, fill=blue!20,
+    text width=5em, text centered, rounded corners, minimum height=4em]
+\tikzstyle{line} = [draw, very thick, color=black!50, -latex']
+\tikzstyle{cloud} = [draw, ellipse,fill=red!20,
+    minimum height=2em, text width=7em, text centered]
+
+\begin{center}
+\begin{tikzpicture}[scale=2, node distance = 2.5cm, auto]
+    % Place nodes
+    \node [cloud] (imap) {IMAP};
+    \node [block, right of=imap, node distance = 3.5cm] (imap-fetch) {IMAP fetch};
+    \node [cloud, right of=imap-fetch, node distance = 3.5cm] (imap-message) {IMAPMessage};
+    \node [block, right of=imap-message, node distance = 3.5cm] (mail-parsing) {mail parsing};
+    \node [cloud, right of=mail-parsing, node distance = 3.5cm] (mail) {Mail};
+    \node [block, below of=mail] (mail-processing) {mail processing};
+    \node [cloud, below of=mail-processing] (mail-report) {MailReport};
+    \node [decision, left of=mail-report, node distance = 3.5cm] (is-mail-report-ok) {ok?};
+    \node [block, below of=is-mail-report-ok] (command-parsing) {command parsing};
+    \node [cloud, left of=command-parsing, node distance = 3.5cm] (mail-order) {MailOrder};
+    \node [decision, left of=mail-order, node distance = 3.5cm] (is-mail-order-valid) {valid?};
+    \node [block, below of=is-mail-order-valid] (command-run) {run (via CommandRunner)};
+    \node [cloud, below of=command-run] (result-list) {result list (array of OpenStruct)};
+    \node [block, below of=result-list] (gen-result-mail) {generate result mail};
+    \node [block, left of=gen-result-mail, node distance = 3.5cm] (gen-error-mail) {generate error mail};
+    \node [cloud, below of=gen-result-mail] (mail-reply) {Mail};
+    \node [block, below of=mail-reply] (mail-send) {send};
+    \node [cloud, below of=mail-send] (smtp) {Net::SMTP};
+
+    % Draw edges
+    \path [line] (imap) -- (imap-fetch);
+    \path [line] (imap-fetch) -- (imap-message);
+    \path [line] (imap-message) -- (mail-parsing);
+    \path [line] (mail-parsing) -- (mail);
+    \path [line] (mail) -- (mail-processing);
+    \path [line] (mail-processing) -- (mail-report);
+    \path [line] (mail-report) -- (is-mail-report-ok);
+    \path [line] (is-mail-report-ok) -| node[decision answer, near start] {no} (gen-error-mail);
+    \path [line] (is-mail-report-ok) -- node[decision answer] {yes} (command-parsing);
+    \path [line] (command-parsing) -- (mail-order);
+    \path [line] (mail-order) -- (is-mail-order-valid);
+    \path [line] (is-mail-order-valid) -| node[decision answer, near start] {no} (gen-error-mail);
+    \path [line] (is-mail-order-valid) -- node[decision answer] {yes}(command-run);
+    \path [line] (command-run) -- (result-list);
+    \path [line] (result-list) -- (gen-result-mail);
+    \path [line] (gen-result-mail) -- (mail-reply);
+    \path [line] (gen-error-mail) -- (mail-reply);
+    \path [line] (mail-reply) -- (mail-send);
+    \path [line] (mail-send) -- (smtp);
+\end{tikzpicture}
+\end{center}%
+
+\end{document}
