From f2e8450f1a8695d597d759928122281533b988b4 Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Mon, 6 Apr 2020 22:15:16 -0700 Subject: [PATCH] Implemented --debug, updated README Closes #8, Closes #7 --- README.md | 56 +++++++++++++++++++++++++++++++ datasette_publish_now/__init__.py | 6 ++++ 2 files changed, 62 insertions(+) diff --git a/README.md b/README.md index 30e32a8..c7331a1 100644 --- a/README.md +++ b/README.md @@ -23,3 +23,59 @@ Now you can use `datasette publish now` to publish your data: datasette publish now2 my-database.db --project=my-database The `--project` argument is required - it specifies the project name that should be used for your deployment. This will be used as part of the deployment's URL. + +### Other options + +* `--no-prod` deploys to the project without updating the "production" URL alias to point to that new deployment. Without that option all deploys go directly to production. +* `--debug` enables the Now CLI debug output +* `--token` allows you to pass a Now authentication token, rather than needing to first run `now login' to configure the tool + +### Full help + +**Warning:** Some of these options are not yet implemented in the alpha version of this plugin. In particular, the following do not yet work: + +* `--extra-options` +* `--static` +* `--plugin-secret` +* `--version_note` + +``` +$ datasette publish now2 --help +Usage: datasette publish now2 [OPTIONS] [FILES]... + +Options: + -m, --metadata FILENAME Path to JSON/YAML file containing metadata + to publish + + --extra-options TEXT Extra options to pass to datasette serve + --branch TEXT Install datasette from a GitHub branch e.g. + master + + --template-dir DIRECTORY Path to directory containing custom + templates + + --plugins-dir DIRECTORY Path to directory containing custom plugins + --static MOUNT:DIRECTORY Serve static files from this directory at + /MOUNT/... + + --install TEXT Additional packages (e.g. plugins) to + install + + --plugin-secret ... + Secrets to pass to plugins, e.g. --plugin- + secret datasette-auth-github client_id xxx + + --version-note TEXT Additional note to show on /-/versions + --title TEXT Title for metadata + --license TEXT License label for metadata + --license_url TEXT License URL for metadata + --source TEXT Source label for metadata + --source_url TEXT Source URL for metadata + --about TEXT About label for metadata + --about_url TEXT About URL for metadata + --token TEXT Auth token to use for deploy + --project PROJECT Zeit Now project name to use [required] + --no-prod Don't deploy directly to production + --debug Enable Now CLI debug output + --help Show this message and exit. +``` diff --git a/datasette_publish_now/__init__.py b/datasette_publish_now/__init__.py index a4e6481..a33044d 100644 --- a/datasette_publish_now/__init__.py +++ b/datasette_publish_now/__init__.py @@ -52,6 +52,9 @@ def publish_subcommand(publish): @click.option( "--no-prod", is_flag=True, help="Don't deploy directly to production", ) + @click.option( + "--debug", is_flag=True, help="Enable Now CLI debug output", + ) def now2( files, metadata, @@ -73,6 +76,7 @@ def now2( token, project, no_prod, + debug, ): fail_if_publish_binary_not_installed( "now", "Zeit Now", "https://zeit.co/download" @@ -136,6 +140,8 @@ def now2( "\n".join([datasette_install] + list(install)) ) cmd = ["now", "--confirm", "--no-clipboard"] + if debug: + cmd.append("--debug") if not no_prod: cmd.append("--prod") run(cmd)