It’s that time again – Cypht release forthcoming

Oh Yeah! It’s that time again! Time for another Cypht update! Calm down everybody, I know you are excited. Shit I am too! Let’s dance! OK. Seriously, I’m happy to report we have updates worth reporting.

The big news is preliminary EXPERIMENTAL probably buggy PGP support. This module set provides the ability to sign/encrypt outbound mail (plain text only), and decrypt (some) PGP message parts. We are using openpgpjs on the client, and the Gnugpg PECL extension on the server. Private keys never leave your machine and passphrases must be re-entered anytime you want to use a private key. Nobody ever said PGP was user-friendly. This module set does not change that fact. However it does make it possible to use PGP from a webmail client – which is a dicey proposition no matter how you slice it.

Another neat new feature is the ability to compose messages in Markdown format. We are not using a WYSIWYG editor for this, but instead a very cool Markdown editor that has the ability to do a quick preview and some handy buttons for inserting common formatting options. Kids love Markdown don’t ya know. Since Markdown is not a commonly supported MIME format, we are converting the outbound message to HTML (sadface!) to preserve the formatting before sending it on its way.

Probably the best integration test for a webmail client is to have it send a message, await its arrival, then open it. It would be really great to have this happen every time changes are pushed to the repo, and even better with multiple versions of PHP. Well the future is now because we are doing this thanks to Travis CI, Browserstack, and a crap-ton of work to prep a VM with a functional (albeit local) web-server and mail system.

One of the great things about this release is the much improved testing infrastructure. We now have Travis/Browserstack/Scrutinizer/Coveralls running and analyzing PHPUnit test, Selenium tests, and static code on pushes to the repo. Unit testing used to be limited to the framework, a crucial but small amount of the code base. We now have 100% coverage for the core module set as well, and the second most important set, IMAP, is at about 70% coverage (though some tests are lacking proper assertions). There is still a LOT of code un-unit tested, but we are making progress.

Currently Cypht is on a 1.6 year release cycle – this is not good. I just started working on candidates for a long overdue 1.1.0 release. Git is telling me there have been about 600 commits since 1.0.0 was let loose. Unencumbered by facts that is 60% testing updates, 30% bug fixes, 10% new features, and 100% awesome. I’m really excited to get this release out the door because doing releases is a pain and I’m lazy. With some luck I will increase release frequency and thus be forced to automate away my laziness (UPDATE: I already started).

Lets conclude with some fun stats:

First commit:

jason [ ~/cypht ]$ git log | tail -5

commit 04952b3121e162e072712149126253f0adcf08b8
Author: jasonmunro 
Date:   Fri Feb 14 08:45:00 2014 -0800

 Initial commit

Total commits to master:

jason [ ~/cypht ]$ git rev-list --count master

4007

Total lines of PHP (not including third party stuff):

jason [ ~/cypht ]$ find . -name "*.php" -print | \
    grep -v asset | \
    grep -v third_party | \
    grep -v site | \
    xargs wc -l | \
    tail -1

46915 total

Total lines of JavaScript (not including third party stuff):

jason [ ~/cypht ]$ find . -name "site.js" -print | \
    xargs wc -l | \
    tail -1

4892 total

Total lines of CSS (same):

jason [ ~/cypht ]$ find . -name "site.css" -print | \
    xargs wc -l | \
    tail -1

616 total

Total unit tests:

jason [ ~/cypht ]$ find tests/phpunit/ -name "*.php" | \
    xargs grep 'function test_' | \
    wc -l

407

Total UI tests

jason [ ~/cypht ]$ find tests/selenium/ -name "*.py" | \
    egrep -v 'base|creds|runner' | \
    xargs grep 'def ' | \
    grep -v __init__ | \
    wc -l

84

Total lines of Travis CI configuration:

jason [ ~/cypht ]$ find .travis/ .travis.yml -type f -print | \
    xargs wc -l | \
    tail -1

1606 total

Average memory use in KB of a Cypht request using DEBUG mode for 250K logged requests:

jason [ ~/cypht ]$ grep 'Peak Memory' php_errors.log | \
    cut -f 2 -d ':' | \
    awk '{ SUM += $1; n++ } END { print SUM/n }'

2882.96

Leave a comment