@@ -243,6 +243,7 @@ def wrapper(*args, **kwargs):
243
243
244
244
return wrapper
245
245
246
+
246
247
# This callback handles the "shorthand" --disable-env-management option.
247
248
# If the shorthand flag is provided, then it takes precendence over the R and Python flags.
248
249
# This callback also inverts the --disable-env-management-r and
@@ -252,7 +253,7 @@ def wrapper(*args, **kwargs):
252
253
# which is more consistent when writing these values to the manifest.
253
254
def env_management_callback (ctx , param , value ) -> typing .Optional [bool ]:
254
255
# eval the shorthand flag if it was provided
255
- disable_env_management = ctx .params .get (' disable_env_management' )
256
+ disable_env_management = ctx .params .get (" disable_env_management" )
256
257
if disable_env_management is not None :
257
258
value = disable_env_management
258
259
@@ -486,7 +487,6 @@ def bootstrap(
486
487
@cloud_shinyapps_args
487
488
@click .pass_context
488
489
def add (ctx , name , server , api_key , insecure , cacert , account , token , secret , verbose ):
489
-
490
490
set_verbosity (verbose )
491
491
if click .__version__ >= "8.0.0" and sys .version_info >= (3 , 7 ):
492
492
click .echo ("Detected the following inputs:" )
@@ -1081,11 +1081,11 @@ def deploy_manifest(
1081
1081
name = "quarto" ,
1082
1082
short_help = "Deploy Quarto content to Posit Connect [v2021.08.0+] or Posit Cloud." ,
1083
1083
help = (
1084
- ' Deploy a Quarto document or project to Posit Connect or Posit Cloud. Should the content use the Quarto '
1084
+ " Deploy a Quarto document or project to Posit Connect or Posit Cloud. Should the content use the Quarto "
1085
1085
'Jupyter engine, an environment file ("requirements.txt") is created and included in the deployment if one '
1086
- ' does not already exist. Requires Posit Connect 2021.08.0 or later.'
1087
- ' \n \n '
1088
- ' FILE_OR_DIRECTORY is the path to a single-file Quarto document or the directory containing a Quarto project.'
1086
+ " does not already exist. Requires Posit Connect 2021.08.0 or later."
1087
+ " \n \n "
1088
+ " FILE_OR_DIRECTORY is the path to a single-file Quarto document or the directory containing a Quarto project."
1089
1089
),
1090
1090
no_args_is_help = True ,
1091
1091
)
@@ -1439,51 +1439,31 @@ def deploy_help():
1439
1439
@deploy .command (
1440
1440
name = "git" ,
1441
1441
short_help = "Deploy git repository with exisiting manifest file" ,
1442
- help = "Deploy git repository with exisiting manifest file"
1443
- )
1444
- @click .option ("--name" , "-n" , help = "The nickname of the RStudio Connect server to deploy to." )
1445
- @click .option (
1446
- "--server" , "-s" , envvar = "CONNECT_SERVER" , help = "The URL for the RStudio Connect server to deploy to." ,
1447
- )
1448
- @click .option (
1449
- "--api-key" , "-k" , envvar = "CONNECT_API_KEY" , help = "The API key to use to authenticate with RStudio Connect." ,
1450
- )
1451
- @click .option (
1452
- "--insecure" , "-i" , envvar = "CONNECT_INSECURE" , is_flag = True , help = "Disable TLS certification/host validation." ,
1442
+ help = "Deploy git repository with exisiting manifest file" ,
1453
1443
)
1454
- @click .option (
1455
- "--cacert" ,
1456
- "-c" ,
1457
- envvar = "CONNECT_CA_CERTIFICATE" ,
1458
- type = click .File (),
1459
- help = "The path to trusted TLS CA certificates." ,
1460
- )
1461
- @click .option ("--verbose" , "-v" , is_flag = True , help = "Print detailed messages." )
1462
- @click .option ('--app_name' , '-a' )
1463
- @click .option ('--repository' , "-r" )
1464
- @click .option ('--branch' , "-b" )
1465
- @click .option ('--subdirectory' , "-d" )
1466
- def deploy_git (name , server , api_key , insecure , cacert , verbose , app_name , repository , branch , subdirectory ):
1444
+ @server_args
1445
+ @click .option ("--app_name" , "-a" )
1446
+ @click .option ("--repository" , "-r" , required = True )
1447
+ @click .option ("--branch" , "-b" , default = "main" )
1448
+ @click .option ("--subdirectory" , "-d" , default = "/" )
1449
+ @cli_exception_handler
1450
+ def deploy_git (
1451
+ name : str ,
1452
+ server : str ,
1453
+ api_key : str ,
1454
+ insecure : bool ,
1455
+ cacert : typing .IO ,
1456
+ verbose ,
1457
+ app_name : str ,
1458
+ repository : str ,
1459
+ branch : str ,
1460
+ subdirectory : str ,
1461
+ ):
1462
+ subdirectory = subdirectory .strip ("/" )
1463
+ kwargs = locals ()
1467
1464
set_verbosity (verbose )
1468
-
1469
- with cli_feedback ("Checking arguments" ):
1470
- connect_server = _validate_deploy_to_args (name , server , api_key , insecure , cacert )
1471
-
1472
- connect_client = api .RSConnect (connect_server )
1473
-
1474
- with cli_feedback ("Deploying git repository" ):
1475
- app = connect_client .deploy_git (app_name , repository , branch , subdirectory )
1476
-
1477
- with cli_feedback ("" ):
1478
- click .secho ("\n Deployment log:" , fg = "bright_white" )
1479
- app_url , _ = spool_deployment_log (connect_server , app , click .echo )
1480
- click .secho ("Deployment completed successfully." , fg = "bright_white" )
1481
- click .secho (" Dashboard content URL: %s" % app_url , fg = "bright_white" )
1482
- click .secho (" Direct content URL: %s" % app ["app_url" ], fg = "bright_white" )
1483
-
1484
-
1485
- click .secho ("Git deployment completed successfully." , fg = "bright_white" )
1486
- click .secho ("App available as %s" % app_name , fg = "bright_white" )
1465
+ ce = RSConnectExecutor (** kwargs )
1466
+ ce .validate_server ().deploy_git ().emit_task_log ()
1487
1467
1488
1468
1489
1469
@cli .group (
@@ -1499,6 +1479,7 @@ def deploy_git(name, server, api_key, insecure, cacert, verbose, app_name, repos
1499
1479
def write_manifest ():
1500
1480
pass
1501
1481
1482
+
1502
1483
@write_manifest .command (
1503
1484
name = "notebook" ,
1504
1485
short_help = "Create a manifest.json file for a Jupyter notebook." ,
0 commit comments