@@ -505,7 +505,11 @@ def quarto_inspect(
505505 """
506506 Runs 'quarto inspect' against the target and returns its output as a
507507 parsed JSON object.
508+
509+ The JSON result has different structure depending on whether or not the
510+ target is a directory or a file.
508511 """
512+
509513 args = [quarto , "inspect" , target ]
510514 try :
511515 inspect_json = check_output (args , universal_newlines = True , stderr = subprocess .STDOUT )
@@ -527,7 +531,7 @@ def validate_quarto_engines(inspect):
527531
528532
529533def write_quarto_manifest_json (
530- directory : str ,
534+ file_or_directory : str ,
531535 inspect : typing .Any ,
532536 app_mode : AppMode ,
533537 environment : Environment ,
@@ -538,7 +542,7 @@ def write_quarto_manifest_json(
538542 """
539543 Creates and writes a manifest.json file for the given Quarto project.
540544
541- :param directory : The directory containing the Quarto project.
545+ :param file_or_directory : The Quarto document or the directory containing the Quarto project.
542546 :param inspect: The parsed JSON from a 'quarto inspect' against the project.
543547 :param app_mode: The application mode to assume (such as AppModes.STATIC_QUARTO)
544548 :param environment: The (optional) Python environment to use.
@@ -547,10 +551,20 @@ def write_quarto_manifest_json(
547551 :param image: the optional docker image to be specified for off-host execution. Default = None.
548552 """
549553
550- extra_files = validate_extra_files (directory , extra_files )
551- manifest , _ = make_quarto_manifest (directory , inspect , app_mode , environment , extra_files , excludes , image )
552- manifest_path = join (directory , "manifest.json" )
554+ manifest , _ = make_quarto_manifest (
555+ file_or_directory ,
556+ inspect ,
557+ app_mode ,
558+ environment ,
559+ extra_files ,
560+ excludes ,
561+ image ,
562+ )
553563
564+ base_dir = file_or_directory
565+ if not isdir (file_or_directory ):
566+ base_dir = dirname (file_or_directory )
567+ manifest_path = join (base_dir , "manifest.json" )
554568 write_manifest_json (manifest_path , manifest )
555569
556570
@@ -1307,7 +1321,7 @@ def gather_basic_deployment_info_from_manifest(
13071321def gather_basic_deployment_info_for_quarto (
13081322 connect_server : api .RSConnectServer ,
13091323 app_store : AppStore ,
1310- directory : str ,
1324+ file_or_directory : str ,
13111325 new : bool ,
13121326 app_id : int ,
13131327 title : str ,
@@ -1317,7 +1331,7 @@ def gather_basic_deployment_info_for_quarto(
13171331
13181332 :param connect_server: The Connect server information.
13191333 :param app_store: The store for the specified Quarto project directory.
1320- :param directory : The target Quarto project directory.
1334+ :param file_or_directory : The Quarto document or directory containing the Quarto project .
13211335 :param new: A flag to force a new deployment.
13221336 :param app_id: The identifier of the content to redeploy.
13231337 :param title: The content title (optional). A default title is generated when one is not provided.
@@ -1349,11 +1363,11 @@ def gather_basic_deployment_info_for_quarto(
13491363 ) % (app_mode .desc (), existing_app_mode .desc ())
13501364 raise api .RSConnectException (msg )
13511365
1352- if directory [- 1 ] == "/" :
1353- directory = directory [:- 1 ]
1366+ if file_or_directory [- 1 ] == "/" :
1367+ file_or_directory = file_or_directory [:- 1 ]
13541368
13551369 default_title = not bool (title )
1356- title = title or _default_title (directory )
1370+ title = title or _default_title (file_or_directory )
13571371
13581372 return (
13591373 app_id ,
@@ -1589,19 +1603,18 @@ def create_api_deployment_bundle(
15891603
15901604
15911605def create_quarto_deployment_bundle (
1592- directory : str ,
1606+ file_or_directory : str ,
15931607 extra_files : typing .List [str ],
15941608 excludes : typing .List [str ],
15951609 app_mode : AppMode ,
15961610 inspect : typing .Dict [str , typing .Any ],
15971611 environment : Environment ,
1598- extra_files_need_validating : bool ,
15991612 image : str = None ,
16001613) -> typing .IO [bytes ]:
16011614 """
16021615 Create an in-memory bundle, ready to deploy.
16031616
1604- :param directory: the directory that contains the code being deployed .
1617+ :param file_or_directory: The Quarto document or the directory containing the Quarto project .
16051618 :param extra_files: a sequence of any extra files to include in the bundle.
16061619 :param excludes: a sequence of glob patterns that will exclude matched files.
16071620 :param entry_point: the module/executable object for the WSGi framework.
@@ -1614,13 +1627,10 @@ def create_quarto_deployment_bundle(
16141627 :param image: the optional docker image to be specified for off-host execution. Default = None.
16151628 :return: the bundle.
16161629 """
1617- if extra_files_need_validating :
1618- extra_files = validate_extra_files (directory , extra_files )
1619-
16201630 if app_mode is None :
16211631 app_mode = AppModes .STATIC_QUARTO
16221632
1623- return make_quarto_source_bundle (directory , inspect , app_mode , environment , extra_files , excludes , image )
1633+ return make_quarto_source_bundle (file_or_directory , inspect , app_mode , environment , extra_files , excludes , image )
16241634
16251635
16261636def deploy_bundle (
0 commit comments