~samwhited/blogsync

.builds: verify DCO

Signed-off-by: Sam Whited <sam@samwhited.com>
blogsync: fix name of convert command flagset

This appears to have been copy/pasted from the publish command, so the
name was wrong. It's not used anywhere so it doesn't matter, but fix it
for sanitys sake.
blogsync: remove uses of the global logger
blogsync: only republish changed posts

Previously any time a post changed while we were previewing the site
every single post would be regenerated. This change allows only the post
that was changed to be removed or re-created as necessary.
blogsync: return compiled template after publish

The compiled template will be required for updating blog posts in the
future in the preview command. Instead of having to compile it twice,
return all dependencies for updating a post after the initial publishing
of posts so that they can be reused.
blogsync: factor out individual post publishing

Further breaking this up into a function to search for posts and publish
them all and a function for publishing an individual post once found
will allow us to call publish once before previewing, then update
individual posts when we detect file changes without republishing
everything.
blogsync: add naive filesystem watching

This implementation currently deletes all posts and re-uploads them any
time a source file changes. This is naive, slow, and requires a *lot* of
API requests, but for now it works to show the concept.
The next step will be to figure out the event type and the old and new
slugs and only change the files and posts that need to be tweaked.

Fixes #4
blogsync: remove duplicate WF runner code

Previously there were two versions of the code that shells out to
writefreely. One version was for the long running process that serves
the files, the other was for shorter lived commands like generating
keys. The difference was that the latter bracketed their output, but
this is not strictly necessary and nothing is running concurrently right
now that would interrupt that output anyways, so use a single function
for this.
blogsync: factor out publish function body

This change will make it easier to call publish with different options
from preview in the future without having to do something jank like pass
command line flags as strings. Good separation of concerns means the Run
function should only exist to handle converting command line flags to
actual function arguments (or an options struct in this case).
blogsync: add path.Join function to templates
blogsync: support more list types and footnotes

Adds support for more markdown list types, including footnotes and
footnote lists, enumerated lists, and definition lists.
blogsync: render lists and blockquotes correctly

Previously the space around them wasn't enough for write.as' markdown
parser, which has odd rules that don't comply with Common Mark or the
original markdown spec.
blogsync: launch browser after publishing preview

This required some extra work into how waiting on writefreely works
because when opening a browser tab we may get a SIGCHLD back as soon as
the process we spawned to open the tab exists (if it decides that the
tab should be opened in an existing, non-child process, for instance and
then terminates itself).
We are now waiting on the writefreely process to exit in a blocked
Goroutine instead of waiting on the signall but this is fine and
probably how I should have done things in the first place as it makes
everything much less error prone.
internal/browser: add browser launching package

This package was copied from the main Go distribution and is licensed
under their BSD style license. See the LICENSE and README files for
details.
blogsync: wait less time for writefreely to start

Previously we would always wait 3 seconds, which may or may not be long
enough. Now we wait 5, but check every 1 second to see if we can listen
on the port. This still isn't an ideal way to do this, but it's easy and
probably "good enough".
blogsync: create collections when previewing

Previously posts in collections other than the main site would fail to
publish to the preview instance because the collection didn't exist.
This patch allows creating collectinos that don't exist during
publishing (but only if we're in preview mode, we don't want every typo
to a collection name resulting in a new collection in production).
blogsync: fix a Println with formatting directives
blogsync: exit preview if writefreely dies
blogsync: add preview command

The preview command shells out to writefreely and spins up a server
with a custom config before calling publish and uploading all documents
to the new server.
blogsync: fix formatting directives
Next