Skip to content

Commit 4772336

Browse files
authored
Merge pull request #63 from ThinkR-open/att-rebase-0.3
Att rebase 0.3
2 parents 5893625 + 622da15 commit 4772336

18 files changed

+294
-59
lines changed
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
2+
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
name: R-CMD-check-HTML5
10+
11+
jobs:
12+
R-CMD-check:
13+
runs-on: ubuntu-latest
14+
env:
15+
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
16+
R_KEEP_PKG_SOURCE: yes
17+
_R_CHECK_RD_VALIDATE_RD2HTML_: TRUE
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Install pdflatex
22+
run: sudo apt-get install texlive-latex-base texlive-fonts-recommended texlive-fonts-extra texlive-latex-extra
23+
24+
- name: Install tidy
25+
run: sudo apt install tidy
26+
27+
- uses: r-lib/actions/setup-r@v2
28+
with:
29+
r-version: 'devel'
30+
http-user-agent: 'release'
31+
use-public-rspm: true
32+
33+
- uses: r-lib/actions/setup-r-dependencies@v2
34+
with:
35+
extra-packages: any::rcmdcheck
36+
needs: check
37+
38+
- uses: r-lib/actions/check-r-package@v2
39+
with:
40+
args: '"--as-cran"'
41+
build_args: 'character()'
42+
error-on: '"note"'

DESCRIPTION

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: attachment
22
Title: Deal with Dependencies
3-
Version: 0.2.5.9000
3+
Version: 0.3.0
44
Authors@R:
55
c(person(given = "Sébastien",
66
family = "Rochette",
@@ -15,18 +15,17 @@ Authors@R:
1515
"previous maintainer")),
1616
person(given = "ThinkR",
1717
role = c("cph", "fnd")))
18-
Description: Tools to help manage dependencies during package
19-
development. This can retrieve all dependencies that are used in R
20-
files in the "R" directory, in Rmd files in "vignettes" directory and
18+
Description: Manage dependencies during package
19+
development. This can retrieve all dependencies that are used in ".R"
20+
files in the "R/" directory, in ".Rmd" files in "vignettes/" directory and
2121
in 'roxygen2' documentation of functions. There is a function to
22-
update the Description file of your package and a function to create a
23-
file with the R commands to install all dependencies of your package.
24-
All functions to retrieve dependencies of R scripts and Rmd files can
22+
update the "DESCRIPTION" file of your package with 'CRAN' packages or any other remote package.
23+
All functions to retrieve dependencies of ".R" scripts and ".Rmd" or ".qmd" files can
2524
be used independently of a package development.
2625
License: GPL-3
2726
URL: https://thinkr-open.github.io/attachment/,
28-
https://github.com/Thinkr-open/attachment
29-
BugReports: https://github.com/Thinkr-open/attachment/issues
27+
https://github.com/ThinkR-open/attachment
28+
BugReports: https://github.com/ThinkR-open/attachment/issues
3029
VignetteBuilder:
3130
knitr
3231
Encoding: UTF-8

NAMESPACE

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ export("%>%")
44
export(att_amend_desc)
55
export(att_from_description)
66
export(att_from_namespace)
7+
export(att_from_qmd)
8+
export(att_from_qmds)
79
export(att_from_rmd)
810
export(att_from_rmds)
911
export(att_from_rscript)

NEWS.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
# attachment (development version)
1+
# attachment 0.3.0
22

33
## New features
44

5-
- `set_remotes_to_desc()` now detects github, gitlab, git, local installations (@MurielleDelmotte)
5+
- `find_remotes()` and `set_remotes_to_desc()` now detects github, gitlab, git, bitbucket, local installations to add to the "Remotes:" part of the DESCRIPTION file (@MurielleDelmotte)
6+
- Quarto documents can be parsed with `att_from_qmds()` as an alias of `att_from_rmds()`.
67

78
## Minor changes
89

9-
- Quarto documents can be parsed with `att_from_rmds()`.
1010
- Documentation for bookdown and quarto dependencies extraction updated
1111

1212
## Bug fixes

R/att_from_rmds.R

+9
Original file line numberDiff line numberDiff line change
@@ -114,3 +114,12 @@ att_from_rmds <- function(path = "vignettes",
114114
res
115115
}
116116
}
117+
118+
#' @rdname att_from_rmds
119+
#' @export
120+
att_from_qmds <- att_from_rmds
121+
122+
#' @rdname att_from_rmd
123+
#' @export
124+
att_from_qmd <- att_from_rmd
125+

R/attachment-deprecated.R

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
11
#' Deprecated functions
22
#'
3-
#' @name attachment-deprecated
3+
#' @description
4+
#' List of functions deprecated. They will be removed in a future release.
5+
#'
46
#'
7+
#' @name attachment-deprecated
8+
#' @keywords internal
9+
#' @return List of functions used for deprecation side effects.
10+
#' Output depends on the deprecated function.
511
#' @section Details:
612
#' \tabular{rl}{
713
#' `att_to_description` \tab is now called `att_amend_desc`

R/set_remotes.R

+38-14
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
#' @param pkg Character. Packages to test for potential non-CRAN installation
44
#'
55
#' @return
6-
#' List of non-CRAN packages and code to add in Remotes field in DESCRIPTION
6+
#' List of all non-CRAN packages and code to add in Remotes field in DESCRIPTION.
7+
#' NULL otherwise.
8+
#' @importFrom utils packageDescription
79
#' @export
810
#'
911
#' @examples
@@ -15,10 +17,16 @@
1517
#' path = file.path(dummypackage, "DESCRIPTION")) %>%
1618
#' find_remotes()
1719
#' \dontrun{
18-
#' # For your current directory
20+
#' # For the current package directory
1921
#' att_from_description() %>% find_remotes()
20-
#' # Find from all installed packages
21-
#' head(find_remotes(installed.packages()[,1]))
22+
#' }
23+
#'
24+
#' \donttest{
25+
#' # For a specific package name
26+
#' find_remotes("attachment")
27+
#'
28+
#' # Find remotes from all installed packages
29+
#' find_remotes(list.dirs(.libPaths(), full.names = FALSE, recursive = FALSE))
2230
#' }
2331
find_remotes <- function(pkg) {
2432

@@ -27,6 +35,19 @@ find_remotes <- function(pkg) {
2735
}) %>%
2836
setNames(pkg)
2937

38+
# Keep only thos that are packages
39+
w.notpkg <- which(unlist(lapply(pkgdesc, function(x) all(is.na(x)))))
40+
if (length(w.notpkg) != 0) {
41+
message(glue::glue_collapse(names(pkgdesc)[w.notpkg], sep = ", ", last = " & "),
42+
ifelse(length(w.notpkg) == 1,
43+
" does not seem to be a package. It is removed from exploration.",
44+
" do not seem to be packages. They are removed from exploration."
45+
)
46+
)
47+
pkgdesc <- pkgdesc[-w.notpkg]
48+
if (length(pkgdesc) == 0) {return(NULL)}
49+
}
50+
3051
extract_pkg_info(pkgdesc)
3152
}
3253

@@ -112,6 +133,7 @@ internal_remotes_to_desc <- function(remotes, path.d = "DESCRIPTION",
112133

113134
w.unique <- !duplicated(names(new_remotes))
114135
new_remotes <- unlist(new_remotes)[w.unique]
136+
new_remotes <- new_remotes[sort(names(new_remotes))]
115137

116138
if (length(new_remotes) != 0) {
117139
desc$set_remotes(new_remotes)
@@ -146,22 +168,24 @@ extract_pkg_info <- function(pkgdesc) {
146168
guess_repo <- lapply(pkg_not_cran, function(x) {
147169
desc <- pkgdesc[[x]]
148170
if (!is.null(desc$RemoteType) && desc$RemoteType == "github") {
149-
tolower(paste(desc$RemoteUsername, desc$RemoteRepo, sep = "/"))
171+
paste(desc$RemoteUsername, desc$RemoteRepo, sep = "/")
150172
} else if (!is.null(desc$RemoteType) && desc$RemoteType %in% c("gitlab", "bitbucket")) {
151-
tolower(paste0(desc$RemoteType, "::",
152-
paste(desc$RemoteUsername, desc$RemoteRepo, sep = "/")))
173+
paste0(desc$RemoteType, "::",
174+
paste(desc$RemoteUsername, desc$RemoteRepo, sep = "/"))
153175
} else if (desc$RemoteType == "local" && !is.null(desc$RemoteUrl) && is.null(desc$RemoteHost)) {
154-
tolower(paste0(desc$RemoteType, "::", desc$RemoteUrl))
155-
} else if (!is.null(desc$RemoteType) && !(desc$RemoteType %in% c("github","gitlab","bitbucket","local")) && grepl(".git",x = desc$RemoteUrl) ){
156-
tolower(paste0("git::",desc$RemoteUrl))
176+
paste0(desc$RemoteType, "::", desc$RemoteUrl)
177+
} else if (!is.null(desc$RemoteType) &&
178+
!(desc$RemoteType %in% c("github","gitlab","bitbucket","local")) &&
179+
grepl("git",x = desc$RemoteType) ){
180+
paste0("git::",desc$RemoteUrl)
157181
} else if (is.null(desc$RemoteType) && isTRUE(grepl("bioconductor",x = desc$URL))) {
158182
biocversion <- desc$git_branch %>%
159183
gsub(pattern = "RELEASE_", replacement = "") %>%
160184
gsub(pattern = "_", replacement = ".")
161-
tolower(paste0("bioc::",biocversion,"/",desc$Package))
162-
} else if (!is.null(desc$RemoteType) && is.null(desc$RemoteHost)) {
163-
c("Maybe ?" = tolower(paste0(desc$RemoteType, "::", desc$RemoteHost, ":",
164-
paste(desc$RemoteUsername, desc$RemoteRepo, sep = "/"))))
185+
paste0("bioc::",biocversion,"/",desc$Package)
186+
} else if (!is.null(desc$RemoteType) && !is.null(desc$RemoteHost)) {
187+
c("Maybe ?" = paste0(desc$RemoteType, "::", desc$RemoteHost, ":",
188+
paste(desc$RemoteUsername, desc$RemoteRepo, sep = "/")))
165189
} else {
166190
c("local maybe ?" = NA)
167191
}

dev/dev_history.R

+13-4
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ usethis::use_appveyor()
6060
usethis::use_github_action_check_standard()
6161
usethis::use_github_action("pkgdown")
6262
usethis::use_github_action("test-coverage")
63+
usethis::use_github_action(url = "https://github.com/DavisVaughan/extrachecks-html5/blob/main/R-CMD-check-HTML5.yaml")
6364

6465
usethis::use_vignette("use_renv")
6566
usethis::use_build_ignore("_pkgdown.yml")
@@ -79,7 +80,8 @@ usethis::use_roxygen_md()
7980
roxygen2md::roxygen2md()
8081
roxygen2::roxygenise()
8182
attachment::att_amend_desc(
82-
pkg_ignore = c("remotes", "i", "usethis", "rstudioapi", "renv"), #i
83+
pkg_ignore = c("remotes", "i", "usethis", "rstudioapi", "renv",
84+
"gitlab", "git", "local", "find.rscript", "bioc"), #i
8385
extra.suggests = c("testthat", "rstudioapi", "renv", "lifecycle"), #"pkgdown", "covr",
8486
dir.t = "",
8587
normalize = FALSE)
@@ -108,6 +110,9 @@ devtools::test()
108110
devtools::load_all()
109111
testthat::test_file(here::here("tests/testthat/test-amend-description.R"))
110112

113+
# Test for dependencies
114+
tools:::.check_packages_used_in_tests(dir = ".", testdir = "tests/testthat")
115+
111116
# Checks for CRAN release ----
112117
# Check package as CRAN
113118
rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"))
@@ -128,19 +133,22 @@ urlchecker::url_update()
128133

129134
# check on other distributions
130135
# _rhub
131-
devtools::check_rhub()
136+
# devtools::check_rhub()
132137
rhub::local_check_linux_images()
133138
rhub::local_check_linux(image = "rhub/debian-gcc-release")
134139
rhub::local_check_linux(image = "rhub/debian-clang-devel")
135140

141+
rhub::platforms()
136142
rhub::check(platform = "windows-x86_64-devel", show_status = FALSE)
143+
rhub::check(platform = "windows-x86_64-oldrel", show_status = FALSE)
137144
rhub::check_on_solaris(show_status = FALSE)
138-
aa <- rhub::check_for_cran(show_status = FALSE)
139-
aa
145+
rhub::check_for_cran(show_status = FALSE)
146+
140147

141148
# _win devel
142149
devtools::check_win_devel()
143150
devtools::check_win_release()
151+
devtools::check_win_oldrelease()
144152
devtools::check_mac_release()
145153

146154
# Check reverse dependencies
@@ -157,6 +165,7 @@ id <- rstudioapi::terminalExecute("Rscript -e 'revdepcheck::revdep_check(num_wor
157165
rstudioapi::terminalKill(id)
158166
# See outputs
159167
revdep_details(revdep = "fusen")
168+
revdep_details(revdep = "golem")
160169
revdep_summary()
161170
# table of results by package
162171
revdep_report() # in revdep/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
test_that("Add works", {
2+
expect_equal(1 + 1, 2)
3+
})

man/att_from_rmd.Rd

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/att_from_rmds.Rd

+10
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/attachment-deprecated.Rd

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/attachment-package.Rd

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)