Running

Pages 10

Clone this wiki locally

The focus of flashbake is generating automatic commit messages so you don’t have to provide any information when your changes are committed to git. I will be exploring other ways of using this main capability of flashbake, such as commit hooks to git itself or perhaps as part of an editor plugin.

Right now, the simplest way to run flashbake is with a scheduler, like cron. There is also a usage section that details running flashbake manually.

Using Cron

When run under cron the optional quiet period starts to make sense. For example, say you have a project in ~/my_novel/ that you want to track. Add a cron job like:

*/15 * * * * flashbake ~/my_novel 5 > /dev/null

Cron will then run flashbake every fifteen minutes and commit any changes to hot files in the project that have not been changed in the last 5 minutes. If there have been recent changes, flashbake will pick them up next time cron runs it, assuming the files haven’t been edited within five minutes of that invocation. You can tweak that quiet interval argument to make flashbake more greedy, committing more often, or more cautious, waiting until edits have stopped for a considerable duration. I encourage some experimentation to find what suits you.

You can also completely disable the quiet period behavior by using the value 0 or, as of version 0.19, completely omitting the quiet period argument. Disabling the quiet period means that when cron runs flashbake, all outstanding changes to hot files in a project will be committed.

If you are running on Mac OSX, be advised that the path/shell in the default cron is anemic. You should add a PATH= line in your crontab file with at least the path to the flashbake directory. Add the below line to the beginning of your crontab assuming flashbake is in the default path. You can use the which command to find flashbake if you are unsure.

PATH=/usr/local/bin/

flashbake may also have problems finding git. As of version 0.24, it will report clearly if it cannot find git. In that same version, there is also a new option, git_path:, which can be used to tell flashbake exactly where git can be located, if needed.

If cron fails, it will send an email to the root account on your local system by default. This is not always terribly useful. You can add an alternate address for it to email. You must have a local mail transfer agent installed, like postfix or exim, for cron to be able to reach a remote address. If you have such an MTA installed, you can add a line like:

MAILTO=foo@noreply.org

to your crontab and any failure messages will get sent to that address.

Usage

If you run

flashbake -c ~/my_novel

flashbake will not commit any changes, rather it will show you the commit message it would generate if run normal. This is useful for checking that you’ve entered the options in the control file correctly and checking the commit message contents. As I work on the plugin system, this will also be useful for plugin authors to check their output.

If you run

flashbake -d ~/my_novel

flashbake will perform a dry run, doing everything but updating git. With the -v/--verbose flag this is helpful for diagnosing problems. The -d/--dryrun switch is available as of 0.20.

The verbose switch simply increases what flashbake reports to the console. I mention it in case you give flashbake a try and want to contact me for help. Capturing that verbose output and including it in help requests will ensure a quicker response and hopefully a faster fix.

I will document new options, here, as they become available and try to note in which version they were added.