Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove fs as hard dep #916

Merged
merged 11 commits into from
Sep 2, 2022
10 changes: 0 additions & 10 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,6 @@ importFrom(cli,cli_alert_info)
importFrom(config,get)
importFrom(desc,desc_get_deps)
importFrom(desc,description)
importFrom(fs,dir_copy)
importFrom(fs,dir_create)
importFrom(fs,dir_exists)
importFrom(fs,file_copy)
importFrom(fs,file_create)
importFrom(fs,file_delete)
importFrom(fs,file_exists)
importFrom(fs,path)
importFrom(fs,path_abs)
importFrom(fs,path_file)
importFrom(htmltools,htmlDependency)
importFrom(rstudioapi,documentSaveAll)
importFrom(rstudioapi,getSourceEditorContext)
Expand Down
11 changes: 4 additions & 7 deletions R/add_dockerfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ talk_once <- function(.f, msg = "") {
#' @importFrom usethis use_build_ignore
#' @importFrom desc desc_get_deps
#' @importFrom rstudioapi navigateToFile isAvailable hasFun
#' @importFrom fs path path_file
#'
#' @examples
#' \donttest{
Expand Down Expand Up @@ -179,9 +178,9 @@ add_dockerfile_ <- talk_once(
reason = "to build a Dockerfile."
)

where <- path(pkg, output)
where <- fs_path(pkg, output)

usethis::use_build_ignore(path_file(where))
usethis::use_build_ignore(basename(where))

dock <- dockerfiler::dock_from_desc(
path = path,
Expand Down Expand Up @@ -228,7 +227,6 @@ add_dockerfile_ <- talk_once(

#' @export
#' @rdname dockerfiles
#' @importFrom fs path path_file
add_dockerfile_shinyproxy <- function(
path = "DESCRIPTION",
output = "Dockerfile",
Expand Down Expand Up @@ -289,7 +287,7 @@ add_dockerfile_shinyproxy_ <- talk_once(
version = "0.2.0",
reason = "to build a Dockerfile."
)
where <- path(pkg, output)
where <- fs_path(pkg, output)

usethis::use_build_ignore(output)

Expand Down Expand Up @@ -332,7 +330,6 @@ add_dockerfile_shinyproxy_ <- talk_once(

#' @export
#' @rdname dockerfiles
#' @importFrom fs path path_file
add_dockerfile_heroku <- function(
path = "DESCRIPTION",
output = "Dockerfile",
Expand Down Expand Up @@ -393,7 +390,7 @@ add_dockerfile_heroku_ <- talk_once(
version = "0.2.0",
reason = "to build a Dockerfile."
)
where <- path(pkg, output)
where <- fs_path(pkg, output)

usethis::use_build_ignore(output)

Expand Down
16 changes: 13 additions & 3 deletions R/add_dockerfiles_renv.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,17 @@ add_dockerfile_with_renv_ <- function(
}

if (is.null(lockfile)) {
lockfile <- attachment::create_renv_for_prod(path = source_folder, output = file.path(output_dir, "renv.lock.prod"))
lockfile <- attachment::create_renv_for_prod(
path = source_folder,
output = file.path(output_dir, "renv.lock.prod")
)
}

file.copy(from = lockfile, to = output_dir)
fs_file_copy(
path = lockfile,
new_path = output_dir,
overwrite = TRUE
)

socle <- dockerfiler::dock_from_renv(
lockfile = lockfile,
Expand Down Expand Up @@ -289,7 +296,10 @@ add_dockerfile_with_renv_heroku <- function(
)
)

readme_output <- file.path(output_dir, "README")
readme_output <- fs_path(
output_dir,
"README"
)

write_there <- function(...) {
write(..., file = readme_output, append = TRUE)
Expand Down
Loading