publish_subcommand hook + default plugins mechanism, used for publish heroku/now (#349)

This change introduces a new plugin hook, publish_subcommand, which can be
used to implement new subcommands for the "datasette publish" command family.

I've used this new hook to refactor out the "publish now" and "publish heroku"
implementations into separate modules. I've also added unit tests for these
two publishers, mocking the subprocess.call and subprocess.check_output
functions.

As part of this, I introduced a mechanism for loading default plugins. These
are defined in the new "default_plugins" list inside datasette/app.py

Closes #217 (Plugin support for datasette publish)
Closes #348 (Unit tests for "datasette publish")
Refs #14, #59, #102, #103, #146, #236, #347
This commit is contained in:
Simon Willison 2018-07-25 22:15:59 -07:00 committed by GitHub
commit dbbe707841
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 360 additions and 256 deletions

View file

@ -36,6 +36,8 @@ You can use ``anything-you-like.now.sh``, provided no one else has already regis
You can also use custom domains, if you `first register them with Zeit Now <https://zeit.co/docs/features/aliases>`_.
.. literalinclude:: datasette-publish-now-help.txt
Publishing to Heroku
--------------------
@ -51,6 +53,8 @@ This will output some details about the new deployment, including a URL like thi
You can specify a custom app name by passing ``-n my-app-name`` to the publish command. This will also allow you to overwrite an existing app.
.. literalinclude:: datasette-publish-heroku-help.txt
Custom metadata and plugins
---------------------------
@ -71,9 +75,6 @@ You can also specify plugins you would like to install. For example, if you want
datasette publish now mydatabase.db --install=datasette-vega
A full list of options can be seen by running ``datasette publish --help``:
.. literalinclude:: datasette-publish-help.txt
datasette package
=================