mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
datasette publish heroku --tar option, closes #969
This commit is contained in:
parent
107d0887a6
commit
e4554c37b7
3 changed files with 27 additions and 4 deletions
|
|
@ -24,6 +24,10 @@ def publish_subcommand(publish):
|
||||||
default="datasette",
|
default="datasette",
|
||||||
help="Application name to use when deploying",
|
help="Application name to use when deploying",
|
||||||
)
|
)
|
||||||
|
@click.option(
|
||||||
|
"--tar",
|
||||||
|
help="--tar option to pass to Heroku, e.g. --tar=/usr/local/bin/gtar",
|
||||||
|
)
|
||||||
def heroku(
|
def heroku(
|
||||||
files,
|
files,
|
||||||
metadata,
|
metadata,
|
||||||
|
|
@ -44,6 +48,7 @@ def publish_subcommand(publish):
|
||||||
about,
|
about,
|
||||||
about_url,
|
about_url,
|
||||||
name,
|
name,
|
||||||
|
tar,
|
||||||
):
|
):
|
||||||
fail_if_publish_binary_not_installed(
|
fail_if_publish_binary_not_installed(
|
||||||
"heroku", "Heroku", "https://cli.heroku.com"
|
"heroku", "Heroku", "https://cli.heroku.com"
|
||||||
|
|
@ -127,8 +132,13 @@ def publish_subcommand(publish):
|
||||||
call(
|
call(
|
||||||
["heroku", "config:set", "-a", app_name, "{}={}".format(key, value)]
|
["heroku", "config:set", "-a", app_name, "{}={}".format(key, value)]
|
||||||
)
|
)
|
||||||
|
tar_option = []
|
||||||
call(["heroku", "builds:create", "-a", app_name, "--include-vcs-ignore"])
|
if tar:
|
||||||
|
tar_option = ["--tar", tar]
|
||||||
|
call(
|
||||||
|
["heroku", "builds:create", "-a", app_name, "--include-vcs-ignore"]
|
||||||
|
+ tar_option
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,7 @@ Options:
|
||||||
--about TEXT About label for metadata
|
--about TEXT About label for metadata
|
||||||
--about_url TEXT About URL for metadata
|
--about_url TEXT About URL for metadata
|
||||||
-n, --name TEXT Application name to use when deploying
|
-n, --name TEXT Application name to use when deploying
|
||||||
|
--tar TEXT --tar option to pass to Heroku, e.g.
|
||||||
|
--tar=/usr/local/bin/gtar
|
||||||
|
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,22 @@ def test_publish_heroku(mock_call, mock_check_output, mock_which):
|
||||||
runner = CliRunner()
|
runner = CliRunner()
|
||||||
with runner.isolated_filesystem():
|
with runner.isolated_filesystem():
|
||||||
open("test.db", "w").write("data")
|
open("test.db", "w").write("data")
|
||||||
result = runner.invoke(cli.cli, ["publish", "heroku", "test.db"])
|
result = runner.invoke(
|
||||||
|
cli.cli, ["publish", "heroku", "test.db", "--tar", "gtar"]
|
||||||
|
)
|
||||||
assert 0 == result.exit_code, result.output
|
assert 0 == result.exit_code, result.output
|
||||||
mock_call.assert_has_calls(
|
mock_call.assert_has_calls(
|
||||||
[
|
[
|
||||||
mock.call(
|
mock.call(
|
||||||
["heroku", "builds:create", "-a", "f", "--include-vcs-ignore"]
|
[
|
||||||
|
"heroku",
|
||||||
|
"builds:create",
|
||||||
|
"-a",
|
||||||
|
"f",
|
||||||
|
"--include-vcs-ignore",
|
||||||
|
"--tar",
|
||||||
|
"gtar",
|
||||||
|
]
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue