|
| 1 | +R := R --no-save --no-restore |
| 2 | +RSCRIPT := Rscript |
| 3 | +DELETE := rm -fR |
| 4 | +PKGNAME := $(shell Rscript ./makeR/get-pkg-name) |
| 5 | +VERSION := $(shell Rscript ./makeR/get-pkg-version) |
| 6 | +TARGZ := $(PKGNAME)_$(VERSION).tar.gz |
| 7 | + |
| 8 | +.SILENT: |
| 9 | + |
| 10 | +.FORCE: |
| 11 | + |
| 12 | +usage: |
| 13 | + echo "Available targets:" |
| 14 | + echo "" |
| 15 | + echo " clean - Clean everything up" |
| 16 | + echo " bump-cran - Bump second digit of version (0.1 -> 0.2) and tag" |
| 17 | + echo " bump-gh - Bump third digit of version (0.1.2 -> 0.1.3) and tag" |
| 18 | + echo " bump - Bump fourth digit of version (0.1.2.3 -> 0.1.2.4) and tag" |
| 19 | + echo " rd - Create documentation via roxygen2" |
| 20 | + echo " install - Install dependencies" |
| 21 | + echo " dependencies " |
| 22 | + echo " dt_* - Run devtools verb" |
| 23 | + echo " test - Run tests" |
| 24 | + echo " covr - Check coverage" |
| 25 | + echo " lintr - Run lintr" |
| 26 | + echo " check-rev-dep - Run a reverse dependency check against packages on CRAN" |
| 27 | + echo " check-rd-files - Run Rd2pdf on each doc file to track hard-to-spot doc/latex errors" |
| 28 | + echo " winbuilder - Ask for email and build on winbuilder" |
| 29 | + echo " init-gh-pages - Initialize orphan gh-pages branch" |
| 30 | + echo " staticdocs - Build staticdocs in inst/web" |
| 31 | + echo " gh-pages-build - Populate gh-pages branch with staticdocs" |
| 32 | + echo " gh-pages-push - Push gh-pages branch to GitHub Pages" |
| 33 | + echo " view-docs - View staticdocs locally" |
| 34 | + echo " init-wercker - Install a default wercker.yml" |
| 35 | + echo " wercker-build - Run wercker build for local instance of docker" |
| 36 | + echo " wercker-deploy - Run wercker deploy for local instance of docker" |
| 37 | + echo " upgrade - upgrade installation of makeR" |
| 38 | + echo " uninstall - uninstall makeR" |
| 39 | + |
| 40 | + |
| 41 | +## Script targers |
| 42 | + |
| 43 | +git-is-clean branch-is-master init-gh-pages init-staticdocs gh-pages-build postinstall init-wercker: |
| 44 | + sh ./makeR/$@ |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | +## devtools targets: |
| 49 | + |
| 50 | +# ls("package:devtools") %>% setNames(nm=.) %>% lapply(get) %>% lapply(formals) %>% lapply(`[`, 1) %>% lapply(names) %>% equals("pkg") %>% Filter(isTRUE, .) %>% names %>% sprintf("dt_%s", .) %>% cat |
| 51 | +dt_add_rstudio_project dt_add_test_infrastructure dt_add_travis dt_bash dt_build dt_build_vignettes dt_build_win dt_check dt_check_doc dt_clean_dll dt_clean_vignettes dt_compile_dll dt_document dt_imports_env dt_install dt_install_deps dt_lint dt_load_all dt_load_code dt_load_data dt_load_dll dt_missing_s3 dt_ns_env dt_parse_ns_file dt_pkg_env dt_release dt_release_checks dt_reload dt_revdep dt_revdep_check dt_revdep_maintainers dt_run_examples dt_show_news dt_submit_cran dt_test dt_unload dt_use_appveyor dt_use_cran_comments dt_use_data_raw dt_use_package_doc dt_use_rcpp dt_use_readme_rmd dt_use_revdep dt_use_rstudio dt_use_testthat dt_use_travis dt_wd: |
| 52 | + |
| 53 | +dt_%: git-is-clean |
| 54 | + Rscript -e "devtools::$(subst dt_,,$@)()" |
| 55 | + git add . |
| 56 | + git commit -m "$(subst dt_,,$@)" |
| 57 | + |
| 58 | + |
| 59 | + |
| 60 | +## Helper targers |
| 61 | + |
| 62 | +git-is-clean: |
| 63 | + |
| 64 | +branch-is-master: git-is-clean |
| 65 | + |
| 66 | +tag: |
| 67 | + (echo Release v$$(sed -n -r '/^Version: / {s/.* ([0-9.-]+)$$/\1/;p}' DESCRIPTION); echo; sed -n '/^===/,/^===/{:a;N;/\n===/!ba;p;q}' NEWS.md | head -n -3 | tail -n +3) | git tag -a -F /dev/stdin v$$(sed -n -r '/^Version: / {s/.* ([0-9.-]+)$$/\1/;p}' DESCRIPTION) |
| 68 | + |
| 69 | +bump-cran-desc: git-is-clean rd |
| 70 | + crant -u 2 -C |
| 71 | + |
| 72 | +bump-gh-desc: git-is-clean rd |
| 73 | + crant -u 3 -C |
| 74 | + |
| 75 | +bump-desc: git-is-clean rd |
| 76 | + test "$$(git status --porcelain | wc -c)" = "0" |
| 77 | + sed -i -r '/^Version: / s/( [0-9.]+)$$/\1-0.0/' DESCRIPTION |
| 78 | + git add DESCRIPTION |
| 79 | + test "$$(git status --porcelain | wc -c)" = "0" || git commit -m "add suffix -0.0 to version" |
| 80 | + crant -u 4 -C |
| 81 | + |
| 82 | +inst/NEWS.Rd: git-is-clean NEWS.md |
| 83 | + Rscript -e "tools:::news2Rd('$(word 2,$^)', '$@')" |
| 84 | + sed -r -i 's/`([^`]+)`/\\code{\1}/g' $@ |
| 85 | + git add $@ |
| 86 | + test "$$(git status --porcelain | wc -c)" = "0" || git commit -m "update NEWS.Rd" |
| 87 | + |
| 88 | +inst/web: |
| 89 | + mkdir -p inst |
| 90 | + git branch gh-pages origin/gh-pages || true |
| 91 | + git clone --branch gh-pages . inst/web |
| 92 | + |
| 93 | + |
| 94 | + |
| 95 | +## Cleanup |
| 96 | + |
| 97 | +clean: |
| 98 | + echo "Cleaning up ..." |
| 99 | + ${DELETE} src/*.o src/*.so *.tar.gz |
| 100 | + ${DELETE} *.Rcheck |
| 101 | + ${DELETE} .RData .Rhistory |
| 102 | + |
| 103 | + |
| 104 | + |
| 105 | +## Tagging |
| 106 | + |
| 107 | +bump-cran: bump-cran-desc inst/NEWS.Rd tag |
| 108 | + |
| 109 | +bump-gh: bump-gh-desc inst/NEWS.Rd tag |
| 110 | + |
| 111 | +bump: bump-desc inst/NEWS.Rd tag |
| 112 | + |
| 113 | + |
| 114 | + |
| 115 | +## Documentation |
| 116 | + |
| 117 | +rd: git-is-clean |
| 118 | + Rscript -e "library(methods); devtools::document()" |
| 119 | + git add man/ NAMESPACE |
| 120 | + test "$$(git status --porcelain | wc -c)" = "0" || git commit -m "document" |
| 121 | + |
| 122 | + |
| 123 | + |
| 124 | +## Testing |
| 125 | + |
| 126 | +dependencies-hook: |
| 127 | + |
| 128 | +install dependencies: dependencies-hook |
| 129 | + Rscript -e "sessionInfo()" |
| 130 | + Rscript -e "options(repos = c(CRAN = 'http://cran.rstudio.com')); devtools::install_deps(dependencies = TRUE, upgrade = FALSE)" |
| 131 | + |
| 132 | +test: |
| 133 | + Rscript -e "devtools::check(document = TRUE, check_dir = '.', cleanup = FALSE)" |
| 134 | + ! egrep -A 5 "ERROR|WARNING|NOTE" *.Rcheck/00check.log |
| 135 | + |
| 136 | +covr: |
| 137 | + Rscript -e 'if (!requireNamespace("covr")) devtools::install_github("jimhester/covr"); covr::codecov()' |
| 138 | + |
| 139 | +lintr: |
| 140 | + Rscript -e 'Sys.setenv(LINTR_COMMENT_BOT="FALSE"); if (!requireNamespace("lintr")) devtools::install_github("jimhester/lintr"); lintr::lint_package()' |
| 141 | + |
| 142 | +check-rev-dep: |
| 143 | + echo "Running reverse dependency checks for CRAN ..." |
| 144 | + ${RSCRIPT} ./makeR/check-rev-dep |
| 145 | + |
| 146 | +check-rd-files: rd |
| 147 | + echo "Checking RDs one by one ..." |
| 148 | + ${RSCRIPT} ./makeR/check-rd-files |
| 149 | + |
| 150 | +winbuilder: rd |
| 151 | + echo "Building via winbuilder" |
| 152 | + ${RSCRIPT} ./makeR/winbuilder |
| 153 | + |
| 154 | + |
| 155 | + |
| 156 | +# staticdocs |
| 157 | + |
| 158 | +gh-pages-init: |
| 159 | + |
| 160 | +init-staticdocs: |
| 161 | + |
| 162 | +staticdocs: inst/web |
| 163 | + Rscript -e 'if (!requireNamespace("staticdocs")) devtools::install_github("gaborcsardi/staticdocs"); staticdocs::build_site()' |
| 164 | + |
| 165 | +gh-pages-build: staticdocs |
| 166 | + |
| 167 | +gh-pages-push: |
| 168 | + git push origin gh-pages |
| 169 | + |
| 170 | +view-html-vignettes: |
| 171 | + chromium-browser inst/doc/*.html |
| 172 | + |
| 173 | +view-docs: |
| 174 | + chromium-browser inst/web/index.html |
| 175 | + |
| 176 | + |
| 177 | + |
| 178 | +## wercker |
| 179 | + |
| 180 | +init-wercker: git-is-clean |
| 181 | + |
| 182 | +wercker-build: |
| 183 | + wercker build --docker-host=unix://var/run/docker.sock --no-remove |
| 184 | + |
| 185 | +wercker-deploy: |
| 186 | + wercker deploy --docker-host=unix://var/run/docker.sock --no-remove |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | +## Maintenance |
| 191 | + |
| 192 | +postinstall: git-is-clean |
| 193 | + |
| 194 | +upgrade: git-is-clean |
| 195 | + echo "Upgrading makeR" |
| 196 | + sh ./makeR/upgrade |
| 197 | + |
| 198 | +uninstall: git-is-clean |
| 199 | + echo "Uninstalling makeR" |
| 200 | + sh ./makeR/uninstall |
| 201 | + |
| 202 | + |
| 203 | +## Obsolete |
| 204 | + |
| 205 | +init: |
| 206 | + true |
0 commit comments