-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
.prepare4CRAN
101 lines (84 loc) · 5.23 KB
/
.prepare4CRAN
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# compare the files in inst/extdata (write and read again)
for (crrFle in list.files('R')) { source(file.path('R', crrFle)) }
OR
devtools::load_all()
for (blnAtt in c(TRUE, FALSE)) {
for (crrOMV in list.files('inst/extdata/', '*.omv')) {
cat(sprintf('\n%s\n\n%s\n\n', strrep("=", 100), crrOMV))
data <- read_omv(file.path('inst/extdata/', crrOMV), sveAtt = blnAtt)
write_omv(data, "~/Trial.omv")
data2 <- read_omv("~/Trial.omv", sveAtt = blnAtt)
suppressWarnings(print(diffdf::diffdf(data, data2)))
unlink("~/Trial.omv")
rm("data", "data2")
}
cat(sprintf('\n%s\n%s\n\n', strrep("=", 100), strrep("=", 100)))
}
rm('blnAtt', 'crrOMV')
# checks the requirements (all dependencies up-to-date, etc.)
# use devtools::update_packages("devtools") and devtools::install_dev_deps() if required
# NB: there might be an error when updating the tidyverse-packages: start R with R --no-init-file
devtools::dev_sitrep()
# do some initial checks
devtools::release_checks()
# update man-pages and NAMESPACE
devtools::check_man()
devtools::spell_check()
# system("gedit inst/WORDLIST")
# check whether the examples and the unit tests run through and do some linting
devtools::run_examples(run_dontrun = TRUE)
devtools::lint()
devtools::test()
devtools::test_coverage()
# once happy with the coverage, it can be uploaded using
covr::codecov(token = "2f521d97-d1e2-4baf-b05b-0b569a7c6f0f") # jmvReadWrite
covr::codecov(token = "821f2b2f-e305-49b2-ab96-7f328530f6ed") # jTransform
# ================================================================================================================================================
# REMEMBER: error messages from R are not always pointing to the place where the error occurs - especially when using commands like build_readme()
# ================================================================================================================================================
# update version number in DESCRIPTION and NEWS.md (and changes in NEWS.md)$(git log --date=format:'%Y-%m-%d' | grep -m1 "^Date" | sed 's/Date:\s*//')"
system("gedit DESCRIPTION NEWS.md inst/CITATION") # jmvReadWrite
# building / updating README, PDF manual, and the HTML documentation
# add new functions to _pkgdown.yaml and to vignettes/jmvReadWrite.Rmd if required
devtools::build_readme()
pkgdown::clean_site()
pkgdown::build_site()
pkgdown::build_reference(run_dont_run = TRUE, preview = FALSE)
pkgdown::build_reference_index()
devtools::build_manual(path="doc")
# the package itself (tar.gz) - build() also builds vignettes
# ping-pong between build() and check() until all errors, warnings, notes are resolved
devtools::build()
devtools::check(force_suggests = TRUE, incoming = TRUE, remote = TRUE, env_vars = c(NOT_CRAN = "FALSE"))
# check on win-builder (Rhub underneath may take a while, run check_win_devel first)
devtools::check_win_devel()
# the next stage of ping-pong, either build on the standard platforms
#rhub::rc_submit(platforms=c("linux", "windows", "macos", "macos-arm64"))
rhub::rhub_check(platforms=c("linux", "windows", "macos", "macos-arm64"))
# running github actions requires a personal access token: https://github.com/settings/profile
# → Developer options → Personal access token → Tokens (classic) → tick “repo”
# the token is valid for a limited time period and can be regenerated; to update the
# token, the following function can be used (choose 2 and copy the token when requested)
gitcreds::gitcreds_set()
# update version number and comments in cran-comments.md (and perhaps NEWS.md)
system("gedit cran-comments.md NEWS.md")
# update codemeta.json (devtools::release() asks for it)
codemetar::write_codemeta()
# now, we are ready to release the package onto CRAN
devtools::release()
# on the shell (after the submission got accepted):
V="v$(grep "^Version:" DESCRIPTION | cut -d: -f2 | sed -e 's/ //')"
git tag -a "${V}" $(git log | grep -m1 commit | sed 's/commit\s*//') -m "CRAN submission: $(git log --date=format:'%Y-%m-%d' | grep -m1 "^Date" | sed 's/Date:\s*//')" -s && git commit -a -m "Tagged CRAN-package on github" && git push origin "${V}"
# optional: Use the tag to create a release on GitHub
# other helpful commands: =========================================================================
devtools::revdep() # shows reverse imports of the package
devtools::revdep_maintainers() # ... and their maintainers
usethis::use_vignette('jmvReadWrite') # assigns a vignette
# run this when getting "Setting active project to '<no active project>'" from build() or build_vignettes()
devtools::install_local() # install locally from current working directory
devtools::uninstall() # ... and uninstall it
devtools::session_info() # information regd. system and installed / loaded packages
devtools::dev_packages() # returns a vector with packages loaded by devtools - typically, the package that is actually developed
devtools::loaded_packages() # shows currently loaded packages
devtools::load_all() # works approx. like using library()
devtools::update_packages() # updates packages - unclear to what degree it is equivalent to update.packages()