rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
134 stars 82 forks source link

Default recordDir is appPath not appDir #362

Closed cderv closed 1 year ago

cderv commented 5 years ago

Hi,

I was trying to understand where records of deployment are written to. My use case is for internal use to deploy the pkgdown website to RStudio Connect. Currently, the rsconnect folder is inside the docs folder and not at the root of the package. not an issue per se but I find something odd:

Doc is saying

recordDir Directory where publish record is written. Can be NULL in which case record will be written to the location specified with appDir.

However, in the code we have https://github.com/rstudio/rsconnect/blob/b1194acf79acdd1f207c77e898a33b2f380bdc60/R/deployApp.R#L190-L192 where appPath can be modified to appPrimaryDoc or appSourceDoc, so not always appDir

Should the documentation be improve or is there something wrong where the record is written ?

Just for sharing, I use this to have the record file in the root directory

# working directory is package root file
rsconnect::deployApp(
  "docs", # the directory containing the content
  appFiles = list.files("docs", recursive = TRUE), # the list of files to include as dependencies (all of them)
  appPrimaryDoc = "index.html",                 # the primary file
  appSourceDoc = "docs/index.html",                 # the source doc
  recordDir = '.', # folder where to write deployement records
  appName = "appName",                          # name of the endpoint (unique to your account on Connect)
  appTitle = "My app title",                         # display name for the content
  account = "myuser",                # your Connect username
  server = "myconnect.server.com",              # the Connect server, see rsconnect::accounts()
  forceUpdate = TRUE
)

Just in case there is something that I missed...

jmcphers commented 4 years ago

You haven't missed anything; the deployment records for individual files (vs. directories) are indeed written separately. We should make the docs clearer.

hadley commented 1 year ago

The docs now say:

#' @param recordDir Directory where deployment record is written. The default,
#'   `NULL`, uses `appDir`, since this is usually where you want the deployment
#'   data to be stored. This argument is typically only needed when deploying
#'   a directory of static files since you want to store the record with the
#'   code that generated those files, not the files themselves.

It's not 100% accurate, but I think it's mostly true, since even when recordDir is a path to a file, the deployment record will still be stored in a directory leading off off dirname(recordDir). I have some thoughts about a better structure for these files, which I'll pursue in future issues/PRs.