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

Full refactor of use_*_file #1170

Merged
merged 34 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
c36f946
refactor: split use_external/internal, and wrapped download/copy to f…
ColinFay Aug 26, 2024
95735eb
feat: checking the url extension now throws an error if the extension…
ColinFay Aug 26, 2024
26e931f
refactor: use build_name inside external
ColinFay Aug 26, 2024
8c5910f
refactor: split into two files
ColinFay Aug 26, 2024
82b5508
feat: the function creation files now fail if the dir doesn't not exist
ColinFay Aug 27, 2024
b3a1320
feat: use_*_files now throws an error if the file already exists
ColinFay Aug 27, 2024
c24e07e
refactor: checks are performed at the top of the function
ColinFay Aug 27, 2024
7722dfb
fix: define name before
ColinFay Aug 27, 2024
105ea66
refactor: using basename of where instead of name in file_created_dance
ColinFay Aug 27, 2024
b8f9e15
refactor: merging check_file_exists and download_external
ColinFay Aug 27, 2024
84cf0ae
refactor: merged check_file_exists and copy_internal_file
ColinFay Aug 27, 2024
4b590f2
refactor: renaming params
ColinFay Aug 27, 2024
5490a56
Merge branch 'dev' into cp-1022
ColinFay Aug 27, 2024
9ac5ede
refactor: merging check & download
ColinFay Aug 27, 2024
dbd3acf
refactor: merged perform_checks_and_download_if_everything_is_ok & fi…
ColinFay Aug 27, 2024
598fe99
refactor: merged perform_check and file_created dance
ColinFay Aug 27, 2024
23905aa
refactor: where_to_download moved inside the function
ColinFay Aug 27, 2024
461bb5a
refactor: where_to_download moved inside the function
ColinFay Aug 27, 2024
149ce19
fix: correct param name
ColinFay Aug 27, 2024
75af1ba
refactor: path_abs as input
ColinFay Aug 27, 2024
0a4dcab
refactor: name is now built inside perform_checks_and_download_if_eve…
ColinFay Aug 27, 2024
cbdc7f3
refactor: moving setwd() inside perform_checks_and_download_if_everyt…
ColinFay Aug 27, 2024
c16f135
fix: correct params in build_name
ColinFay Aug 27, 2024
d0d3276
refactor: path_abs(dir) as param
ColinFay Aug 27, 2024
2165bf9
feat: changed extension error message
ColinFay Aug 27, 2024
ccfd1d1
test: update snapshot
ColinFay Aug 27, 2024
88c58f6
refactor: where_to_copy_to is inside perform_checks_and_copy_if_every…
ColinFay Aug 27, 2024
f835ffc
refactor: name & setwd now in wrapper fun
ColinFay Aug 27, 2024
5b331d5
feat: deprecate the dir_create param
ColinFay Aug 27, 2024
598fc7f
refactor: rm name from file_create_dance in use_file
ColinFay Aug 27, 2024
0480655
refactor: rm the open_or_go_to arg from file_created_dance
ColinFay Aug 27, 2024
86328b3
Merge branch 'dev' into cp-1022
ColinFay Aug 27, 2024
5801c0f
doc: news update
ColinFay Aug 27, 2024
13376fe
doc: forgot to push the man
ColinFay Aug 27, 2024
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
Version: 0.5.1.9001
Authors@R: c(
person("Colin", "Fay", , "[email protected]", role = c("cre", "aut"),
comment = c(ORCID = "0000-0001-7343-1846")),
Expand Down
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
> Notes: the # between parenthesis refers to the related issue on GitHub, and the @ refers to an external contributor solving this issue.

# golem 0.5.1 to 0.6.0

## Breaking change

- The 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

# golem 0.5.1

* Hotfixing a bug with utils_download_file (#1168)
Expand Down
15 changes: 5 additions & 10 deletions R/after_creation_msg.R
Original file line number Diff line number Diff line change
Expand Up @@ -123,21 +123,16 @@ file_created_dance <- function(
dir,
name,
open_file,
open_or_go_to = TRUE,
catfun = cat_created
) {
catfun(where)

fun(pkg, dir, name)
fun(pkg, dir, basename(where))

if (open_or_go_to) {
open_or_go_to(
where = where,
open_file = open_file
)
} else {
return(invisible(where))
}
open_or_go_to(
where = where,
open_file = open_file
)
}

file_already_there_dance <- function(
Expand Down
9 changes: 9 additions & 0 deletions R/boostrap_cli.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,12 @@ cli_cli_alert_info <- function(...) {
)
})
}

cli_cli_abort <- function(message) {
if (rlang::is_installed("cli")) {
cli::cli_abort(message = message, call = NULL)
} else {
stop(message)
}
}

Loading
Loading