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

fix: use_internal_file doesnt strip the extension anymore #1174

Merged
merged 8 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: golem
Title: A Framework for Robust Shiny Applications
Version: 0.5.1.9001
Version: 0.5.1.9002
Authors@R: c(
person("Colin", "Fay", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0001-7343-1846")),
Expand Down
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

## Breaking change

- The use_*_files now fail when:
- The `add_*_files` and `use_*_files` now fail when:
- The directory where the user tries to add the file doesn't exist. `{golem}` used to try to create the directory but that's not the function job — use_*_file functions should only be there to add file (Singe responsabily )
- The file that the user tries to create already exists

## Internal changes

- Full refactoring of the use_*_files functions that now all share the same behavior
- Full refactoring of the `add_*_files` and `use_*_files` functions that now all share the same behavior

# golem 0.5.1

Expand Down
219 changes: 112 additions & 107 deletions R/add_dockerfiles.R
Original file line number Diff line number Diff line change
Expand Up @@ -83,25 +83,26 @@ talk_once <- function(.f, msg = "") {
#' }
#' @return The `{dockerfiler}` object, invisibly.
add_dockerfile <- function(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
port = 80,
host = "0.0.0.0",
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL) {
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
port = 80,
host = "0.0.0.0",
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
add_dockerfile_(
path = path,
output = output,
Expand All @@ -122,26 +123,26 @@ add_dockerfile <- function(

add_dockerfile_ <- talk_once(
function(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
port = 80,
host = "0.0.0.0",
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
port = 80,
host = "0.0.0.0",
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
where <- fs_path(pkg, output)

usethis_use_build_ignore(
Expand Down Expand Up @@ -190,23 +191,24 @@ add_dockerfile_ <- talk_once(
#' @export
#' @rdname dockerfiles
add_dockerfile_shinyproxy <- function(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL) {
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
add_dockerfile_shinyproxy_(
path = path,
output = output,
Expand All @@ -225,23 +227,24 @@ add_dockerfile_shinyproxy <- function(

add_dockerfile_shinyproxy_ <- talk_once(
function(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL) {
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
where <- fs_path(pkg, output)

usethis_use_build_ignore(output)
Expand Down Expand Up @@ -282,23 +285,24 @@ add_dockerfile_shinyproxy_ <- talk_once(
#' @export
#' @rdname dockerfiles
add_dockerfile_heroku <- function(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL) {
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
add_dockerfile_heroku_(
path = path,
output = output,
Expand All @@ -317,23 +321,24 @@ add_dockerfile_heroku <- function(

add_dockerfile_heroku_ <- talk_once(
function(
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL) {
path = "DESCRIPTION",
output = "Dockerfile",
pkg = get_golem_wd(),
from = paste0(
"rocker/verse:",
R.Version()$major,
".",
R.Version()$minor
),
as = NULL,
sysreqs = TRUE,
repos = c(CRAN = "https://cran.rstudio.com/"),
expand = FALSE,
open = TRUE,
update_tar_gz = TRUE,
build_golem_from_source = TRUE,
extra_sysreqs = NULL
) {
where <- fs_path(pkg, output)

usethis_use_build_ignore(output)
Expand Down
4 changes: 1 addition & 3 deletions R/add_dockerfiles_renv.R
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@ add_dockerfile_with_renv_heroku <- function(
"README"
)

write_there <- function(...) {
write(..., file = readme_output, append = TRUE)
}
write_there <- write_there_builder(readme_output)

write_there("From your command line, run:\n")

Expand Down
Loading
Loading