Skip to content

Commit 5c11e68

Browse files
committed
close #158 and update some functions that have been removed from devtools
1 parent 68d0831 commit 5c11e68

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ LazyData: true
3737
URL: https://github.com/benmarwick/rrtools
3838
BugReports: https://github.com/benmarwick/rrtools/issues
3939
Suggests: testthat, quarto, knitr
40-
RoxygenNote: 7.3.1
40+
RoxygenNote: 7.3.2
4141
VignetteBuilder: knitr
4242
Date: 2019-01-15

R/helpers_package.R

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,16 @@ suggests_dep <- function(pkg) {
6161
deps[found, ]
6262
}
6363

64-
# from https://github.com/r-lib/devtools/blob/master/R/utils.R
65-
is_installed <- function(pkg, version = 0) {
64+
# from https://github.com/r-lib/devtools/blob/master/R/utils.R but this
65+
# function was removed some time ago, so I've just updated it to keep it
66+
# working
67+
is_installed <- function(pkg, version = "0.0.0") {
6668
installed_version <- tryCatch(utils::packageVersion(pkg), error = function(e) NA)
67-
!is.na(installed_version) && installed_version >= version
69+
required_version <- as.package_version(version)
70+
!is.na(installed_version) && installed_version >= required_version
6871
}
6972

73+
7074
# from https://github.com/r-lib/devtools/blob/master/R/pkgload.R
7175
check_suggested <- function(pkg, version = NULL, compare = NA) {
7276

R/helpers_templates.R

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@ use_template <- function(template, save_as = template, data = list(),
55

66
path <- file.path(pkg$path, out_path, save_as)
77
if (!can_overwrite(path, ask = ask)) {
8-
stop("`", save_as, "` already exists.", call. = FALSE)
8+
stop(glue::glue("`{save_as}` already exists."), call. = FALSE)
99
}
1010

1111
template_path <- template_path_fn(template)
1212

1313
template_out <- whisker::whisker.render(readLines(template_path), data)
1414

15-
usethis::ui_done("Creating {usethis::ui_value(save_as)} from template.")
15+
usethis::ui_done(glue::glue("Creating {usethis::ui_value(save_as)} from template."))
1616
writeLines(template_out, path)
1717

1818
if (ignore) {
19-
usethis::ui_done("Adding {usethis::ui_value(save_as)} to `.Rbuildignore`.")
19+
usethis::ui_done(glue::glue("Adding {usethis::ui_value(save_as)} to `.Rbuildignore`."))
2020
use_build_ignore(save_as, pkg = pkg)
2121
}
2222

2323
if (open) {
24-
usethis::ui_todo("Modify ", usethis::ui_value(save_as))
24+
usethis::ui_todo(glue::glue("Modify {usethis::ui_value(save_as)}"))
2525
open_in_rstudio(path)
2626
}
2727

0 commit comments

Comments
 (0)