forgetDeployment cannot forget documents
Given a directory containing two standalone Quarto documents; both have been separately deployed.
The rsconnect deployment hierarchy contains:
rsconnect/documents/dangerous.qmd/SERVER1/USER1/dangerous.dcf
rsconnect/documents/index.qmd/SERVER2/USER2/index-name.dcf
Both of these records are enumerated by rsconnect::deployments(), but they cannot be individually removed by rsconnect::forgetDeployment.
Reprex:
td <- tempfile()
dir.create(td); setwd(td)
writeLines("hi", "bar.qmd")
writeLines("hi", "foo.qmd")
library(rsconnect)
deployDoc("bar.qmd", server = "colorado.posit.co")
deployDoc("foo.qmd", server = "colorado.posit.co")
deployments()
forgetDeployment(name = "bar", account = "account", server = "colorado.posit.co")
#> No deployment of /Users/hadleywickham/Documents/rstudio/rsconnect to 'bar' on colorado.posit.co found.
I think the problem is that forgetDeployments() calls deploymentConfigFile() directly, rather than looking up the deploymentFile from the return value of deployments().
I think we should also make the function specification more flexible so you can just say forgetDeployment(name = "bar") (or maybe even forgetDeployment("bar") by tweaking the argument order), rather than having to spell out all three arguments.