From 6c897ed4c94e61a1d7cf893f264b72f378ad67f6 Mon Sep 17 00:00:00 2001 From: jangorecki Date: Sat, 19 Oct 2024 18:45:16 +0200 Subject: [PATCH] use make, dir rename --- .Rbuildignore | 3 +++ .github/workflows/pkgup.yaml | 20 +++------------ .gitignore | 4 +++ {pkgup => .pkgup}/_litedown.yml | 0 {pkgup => .pkgup}/index.Rmd | 0 {pkgup => .pkgup}/manual.Rmd | 0 {pkgup => .pkgup}/news.Rmd | 0 {pkgup => .pkgup}/vignettes.Rmd | 0 Makefile | 45 +++++++++++++++++++++++++++++++++ 9 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 .gitignore rename {pkgup => .pkgup}/_litedown.yml (100%) rename {pkgup => .pkgup}/index.Rmd (100%) rename {pkgup => .pkgup}/manual.Rmd (100%) rename {pkgup => .pkgup}/news.Rmd (100%) rename {pkgup => .pkgup}/vignettes.Rmd (100%) create mode 100644 Makefile diff --git a/.Rbuildignore b/.Rbuildignore index df72bab..1dcb7bf 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,3 +1,6 @@ ^\.github$ ^_litedown\.yml$ ^pkgup$ +^doc$ +^Makefile$ +^public$ diff --git a/.github/workflows/pkgup.yaml b/.github/workflows/pkgup.yaml index 7353560..6cf52bb 100644 --- a/.github/workflows/pkgup.yaml +++ b/.github/workflows/pkgup.yaml @@ -34,26 +34,14 @@ jobs: - name: build run: | echo "Revision:" $GITHUB_SHA >> ./DESCRIPTION - R CMD build . + make build - name: check run: | - R CMD check --as-cran --no-manual $(ls -1t pkgup_*.tar.gz | head -n 1) - - name: website + make check + - name: public if: github.ref == 'refs/heads/master' run: | - R CMD INSTALL $(ls -1t pkgup_*.tar.gz | head -n 1) ## seems to be required - Rscript -e 'invisible(file.copy("vignettes", "pkgup", recursive=TRUE))' - Rscript -e 'litedown::fuse_site("pkgup")' - mkdir -p public - find pkgup -name '*.html' -print0 | cpio -pvdmB --null public - mv public/pkgup/* public - rm -r public/pkgup - - name: repo - if: github.ref == 'refs/heads/master' - run: | - mkdir -p public/src/contrib - mv $(ls -1t pkgup_*.tar.gz | head -n 1) public/src/contrib - Rscript -e 'tools::write_PACKAGES("public/src/contrib", fields="Revision")' + make public - name: upload if: github.ref == 'refs/heads/master' uses: actions/upload-pages-artifact@v1 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8447fe0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.Rhistory +*.html +pkgup_*.tar.gz +public diff --git a/pkgup/_litedown.yml b/.pkgup/_litedown.yml similarity index 100% rename from pkgup/_litedown.yml rename to .pkgup/_litedown.yml diff --git a/pkgup/index.Rmd b/.pkgup/index.Rmd similarity index 100% rename from pkgup/index.Rmd rename to .pkgup/index.Rmd diff --git a/pkgup/manual.Rmd b/.pkgup/manual.Rmd similarity index 100% rename from pkgup/manual.Rmd rename to .pkgup/manual.Rmd diff --git a/pkgup/news.Rmd b/.pkgup/news.Rmd similarity index 100% rename from pkgup/news.Rmd rename to .pkgup/news.Rmd diff --git a/pkgup/vignettes.Rmd b/.pkgup/vignettes.Rmd similarity index 100% rename from pkgup/vignettes.Rmd rename to .pkgup/vignettes.Rmd diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..f293f30 --- /dev/null +++ b/Makefile @@ -0,0 +1,45 @@ +.PHONY : clean build install doc repo + +srcpath = $(wildcard ls -1t pkgup_*.tar.gz | head -n 1) + +all: + make clean + make build + make public + +clean: + rm -f $(srcpath) + rm -rf pkgup.Rcheck + rm -rf doc .pkgup/doc + rm -rf .pkgup/repo + rm -rf public + +build: + R CMD build . + +check: + R CMD check --as-cran --no-manual $(srcpath) + +install: + R CMD INSTALL $(srcpath) + +doc: + rm -rf .pkgup/doc + mkdir -p .pkgup/doc/vignettes + rsync -r --exclude 'doc' --exclude 'repo' .pkgup/* .pkgup/doc/ + cp -r vignettes/* .pkgup/doc/vignettes/ + Rscript -e 'litedown::fuse_site(".pkgup/doc")' + #ls -aR .pkgup/doc + +repo: + rm -rf .pkgup/repo + mkdir -p .pkgup/repo/src/contrib + mv "$(srcpath)" .pkgup/repo/src/contrib + Rscript -e 'tools::write_PACKAGES(".pkgup/repo/src/contrib", fields="Revision")' + #ls -aR .pkgup/repo + +public: install doc repo + mkdir -p public + cp -r .pkgup/repo/* public + rsync -ravz --include '*/' --include='*.html' --exclude='*' .pkgup/doc/ public/ + #ls -aR public