diff options
author | dakkar <dakkar@thenautilus.net> | 2017-02-22 16:05:17 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2017-02-22 16:05:17 +0000 |
commit | 7ebcd29044492b365b180c8caeba253af5b59255 (patch) | |
tree | c628364894792da22813d0f4e2abccfabb624bab | |
parent | new role: ManualSubscription (diff) | |
download | Sietima-7ebcd29044492b365b180c8caeba253af5b59255.tar.gz Sietima-7ebcd29044492b365b180c8caeba253af5b59255.tar.bz2 Sietima-7ebcd29044492b365b180c8caeba253af5b59255.zip |
presentation
-rw-r--r-- | .gitmodules | 6 | ||||
l--------- | docs/presentation/css | 1 | ||||
l--------- | docs/presentation/css2 | 1 | ||||
m--------- | docs/presentation/highlight.js | 0 | ||||
l--------- | docs/presentation/js | 1 | ||||
l--------- | docs/presentation/lib | 1 | ||||
l--------- | docs/presentation/plugin | 1 | ||||
m--------- | docs/presentation/reveal.js | 0 | ||||
-rw-r--r-- | docs/presentation/sietima.html | 221 |
9 files changed, 232 insertions, 0 deletions
diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..7020267 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,6 @@ +[submodule "docs/presentation/reveal.js"] + path = docs/presentation/reveal.js + url = git@github.com:hakimel/reveal.js.git +[submodule "docs/presentation/highlight.js"] + path = docs/presentation/highlight.js + url = git@github.com:isagalaev/highlight.js.git diff --git a/docs/presentation/css b/docs/presentation/css new file mode 120000 index 0000000..e95a0e7 --- /dev/null +++ b/docs/presentation/css @@ -0,0 +1 @@ +reveal.js/css
\ No newline at end of file diff --git a/docs/presentation/css2 b/docs/presentation/css2 new file mode 120000 index 0000000..0ca84e4 --- /dev/null +++ b/docs/presentation/css2 @@ -0,0 +1 @@ +highlight.js/src/styles
\ No newline at end of file diff --git a/docs/presentation/highlight.js b/docs/presentation/highlight.js new file mode 160000 +Subproject ac3f2db5e434f6344d226d57d7e49290201696c diff --git a/docs/presentation/js b/docs/presentation/js new file mode 120000 index 0000000..ebce293 --- /dev/null +++ b/docs/presentation/js @@ -0,0 +1 @@ +reveal.js/js
\ No newline at end of file diff --git a/docs/presentation/lib b/docs/presentation/lib new file mode 120000 index 0000000..892bcc7 --- /dev/null +++ b/docs/presentation/lib @@ -0,0 +1 @@ +reveal.js/lib
\ No newline at end of file diff --git a/docs/presentation/plugin b/docs/presentation/plugin new file mode 120000 index 0000000..426257b --- /dev/null +++ b/docs/presentation/plugin @@ -0,0 +1 @@ +reveal.js/plugin
\ No newline at end of file diff --git a/docs/presentation/reveal.js b/docs/presentation/reveal.js new file mode 160000 +Subproject a349ff43c58c23f9c837b8ea9b5fc7d4761b8de diff --git a/docs/presentation/sietima.html b/docs/presentation/sietima.html new file mode 100644 index 0000000..6b82e72 --- /dev/null +++ b/docs/presentation/sietima.html @@ -0,0 +1,221 @@ +<html> + <head> + <link rel="stylesheet" href="css/reveal.css"> + <link rel="stylesheet" href="css/theme/white.css" id="theme"> + <link rel="stylesheet" href="css2/github-gist.css"> + <meta http-equiv="content-type" content="text/html; charset=utf-8"> + <title>Sietima — a minimalist MLM</title> + </head> + <body> + <div class="reveal"> + <div class="slides"> + <section> + <h1>Sietima — a minimalist MLM</h1> + <p>Author: dakkar <<a href="mailto:dakkar@thenautilus.net">dakkar@thenautilus.net</a>></p> + <p>Date: 2016-08-08</p> + </section> + <section> + <h2>A bit of history</h2> + <section> + <h3>Siesta</h3> + <aside class="notes"> + <p>Yes, I ran Siesta. It works!</p> + <p>I ran 3 lists, with 10-30 people on each</p> + </aside> + </section> + <section> + <p>written in 2003</p> + </section> + <section> + <p>14 years ago</p> + </section> + <section> + <p><code>Class::DBI</code></p> + <p class="fragment">no <code>Moo</code></p> + <p class="fragment">Perl 5.8</p> + <aside class="notes"> + <p>Surely things have got better!</p> + <p>Can I rewrite it better?</p> + </aside> + </section> + </section> + <section> + <h2>Plugin style</h2> + <section> + <p>simple base class</p> + <pre><code class="perl"> +sub handle_mail($self,$incoming_mail) { + my (@outgoing_messages) = $self->munge_mail($incoming_mail); + for my $outgoing_message (@outgoing_messages) { + $self->send_message($outgoing_message); + } + return; +} + </code></pre> + </section> + <section> + <p>provide all the needed extensions points</p> + <pre><code class="perl"> +sub munge_mail($self,$incoming_mail) { + return Sietima::Message->new({ + mail => $incoming_mail, + from => $self->return_path, + to => $self->subscribers_to_send_to($incoming_mail), + }); +} + </code></pre> + </section> + <section> + <p>but no more than that</p> + </section> + <section> + <p>traits / roles</p> + <ul class="fragment"> + <li><code>AvoidDups</code></li> + <li><code>Debounce</code></li> + <li><code>Headers</code></li> + <li><code>ManualSubscription</code></li> + <li><code>NoMail</code></li> + <li><code>ReplyTo</code></li> + <li><code>SubjectTag</code></li> + <li><code>SubscriberOnly::Drop</code></li> + <li><code>SubscriberOnly::Moderate</code></li> + </ul> + </section> + <section> + <p>try to avoid cross-trait dependencies</p> + <p class="fragment">«<code>ReplyTo</code> needs <code>WithPostAddress</code>» is fine</p> + <p class="fragment">but «<code>SubscriberOnly::Moderate</code> should be added after <code>Debounce</code>» is not</p> + <p class="fragment">sadly I couldn't avoid it, suggestions welcome</p> + </section> + </section> + <section> + <h2>Driver</h2> + <section> + <p><code>App::Spec</code></p> + </section> + <section> + <p>minimal spec in base class</p> + <pre><code class="perl"> +sub command_line_spec($self) { + return { + name => 'sietima', + title => 'a simple mailing list manager', + subcommands => { + send => { + op => 'handle_mail_from_stdin', + summary => 'send email from STDIN', + }, + }, + }; +} + </code></pre> + </section> + <section> + <p>enriched by plugins</p> + <pre><code class="perl"> +around command_line_spec => sub ($orig,$self) { + my $spec = $self->$orig(); + + my $list_mail_ids = sub ($self,$runner,$args) { + $self->mail_store->retrieve_ids_by_tags('moderation'); + }; + + my $with_mail_id = sub($cmd) { return ( + summary => "$cmd the given mail, currently held for moderation", + parameters => [ { + name => 'mail-id', required => 1, + summary => "id of the mail to $cmd", + completion => { op => $list_mail_ids }, + } ], + ) }; + + $spec->{subcommands}{'list-held'} = { + op => 'list_mails_in_moderation_queue', + summary => 'list all mails currently held for moderation', + }; + $spec->{subcommands}{'show-held'} = { + op => 'show_mail_from_moderation_queue', + $with_mail_id->('show'), + }; + $spec->{subcommands}{'resume-held'} = { + op => sub ($self,$runner,$args) { + $self->resume($runner->parameters->{'mail-id'}); + }, + $with_mail_id->('resume'), + }; + $spec->{subcommands}{'drop-held'} = { + op => sub ($self,$runner,$args) { + $self->drop($runner->parameters->{'mail-id'}); + }, + $with_mail_id->('drop'), + }; + + return $spec; +}; + </code></pre> + </section> + <section> + <pre><code class="shell" data-noescape> +$ sietima-test <span style="color:blue"><TAB></span> +drop-held -- drop the given mail, currently held for moderation +help -- Show command help +list-held -- list all mails currently held for moderation +resume-held -- resume the given mail, currently held for moderation +send -- send email from STDIN +show-held -- show the given mail, currently held for moderation + </code></pre> + </section> + <section> + <pre><code class="shell" data-noescape> +$ sietima-test resume-held <span style="color:blue"><TAB></span> +0f0571203ef5ee2f786b7f7f2832093ed4c34fe8 +4d43ee7a2a17457606c07475b14054839fad9b7e + </code></pre> + </section> + </section> + <section> + <h2>Production ready!</h2> + <section> + <p>all my lists now run with Sietima</p> + </section> + <section> + <p>coming soon to a CPAN near you</p> + </section> + </section> + <section> + <h2>CPAN is awesome</h2> + <section> + <p><code>Email::*</code>, RJBS</p> + </section> + <section> + <p><code>Moo</code>, MST + HAARG</p> + <p><code>Type::Tiny</code>, TOBYINK</p> + </section> + <section> + <p><code>App::Spec</code>, TINITA</p> + </section> + <section> + <p><code>Test2</code>, EXODIST</p> + </section> + </section> + <section> + <h2>Thank you</h2> + </section> + </div> + </div> + <script src="lib/js/head.min.js"></script> + <script src="js/reveal.js"></script> + <script> + Reveal.initialize({ + dependencies: [ + { src: 'plugin/highlight/highlight.js', + async: true, + callback: function() { hljs.initHighlightingOnLoad(); } + }, + { src: 'plugin/notes/notes.js', async: true } + ], + }); + </script> + </body> +</html> |