diff --git a/.Rbuildignore b/.Rbuildignore
index c503c4f..df72bab 100644
--- a/.Rbuildignore
+++ b/.Rbuildignore
@@ -1 +1,3 @@
^\.github$
+^_litedown\.yml$
+^pkgup$
diff --git a/.github/workflows/pkgup.yaml b/.github/workflows/pkgup.yaml
index e434441..7353560 100644
--- a/.github/workflows/pkgup.yaml
+++ b/.github/workflows/pkgup.yaml
@@ -18,10 +18,9 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
- runs-on: ubuntu-latest
+ runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v2
- - uses: r-lib/actions/setup-pandoc@v2
- uses: r-lib/actions/setup-r@v2
- name: cache-r-dependencies
uses: actions/cache@v3
@@ -31,7 +30,7 @@ jobs:
restore-keys: library-cache
- name: setup-r-dependencies
run: |
- Rscript -e 'stopifnot(file.copy("DESCRIPTION", file.path(tdir<-tempdir(), "PACKAGES"))); db<-available.packages(paste0("file://", tdir)); deps<-setdiff(tools::package_dependencies(read.dcf("DESCRIPTION", fields="Package")[[1L]], db, which="most")[[1L]], installed.packages(priority="high")[,"Package"]); if (length(deps)) { ap<-available.packages()[,"Version"]; ap<-ap[names(ap) %in% deps]; if (!all(deps%in%names(ap))) stop("dependencies are not avaiable in repository: ",paste(setdiff(deps, names(ap)), collapse=", ")); ip<-installed.packages()[,"Version"]; ip<-ip[names(ip) %in% deps]; pkgs<-ap[deps]>ip[deps]; install.packages(names(pkgs[pkgs|is.na(pkgs)]), INSTALL_opts="--html") }'
+ Rscript -e 'stopifnot(file.copy("DESCRIPTION", file.path(tdir<-tempdir(), "PACKAGES"))); db<-available.packages(paste0("file://", tdir)); deps<-setdiff(tools::package_dependencies(read.dcf("DESCRIPTION", fields="Package")[[1L]], db, which="most")[[1L]], installed.packages(priority="high")[,"Package"]); if (length(deps)) { ap<-available.packages()[,"Version"]; ap<-ap[names(ap) %in% deps]; if (!all(deps%in%names(ap))) stop("dependencies are not avaiable in repository: ",paste(setdiff(deps, names(ap)), collapse=", ")); ip<-installed.packages()[,"Version"]; ip<-ip[names(ip) %in% deps]; pkgs<-ap[deps]>ip[deps]; install.packages(names(pkgs[pkgs|is.na(pkgs)])) }'
- name: build
run: |
echo "Revision:" $GITHUB_SHA >> ./DESCRIPTION
@@ -39,20 +38,16 @@ jobs:
- name: check
run: |
R CMD check --as-cran --no-manual $(ls -1t pkgup_*.tar.gz | head -n 1)
- - name: manual
+ - name: website
if: github.ref == 'refs/heads/master'
run: |
- cp -R ${{ env.R_LIBS_USER }} library
- R CMD INSTALL --library="library" $(ls -1t pkgup_*.tar.gz | head -n 1) --html
- mkdir -p doc/html
- cp /usr/share/R/doc/html/{left.jpg,up.jpg,Rlogo.svg,R.css,index.html} doc/html
- Rscript -e 'utils::make.packages.html("library", docdir="doc")'
- sed -i "s|file://|../..|g" doc/html/packages.html
+ 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
- mv doc public/doc
- cp -r --parents library/*/{html,help,doc,demo,DESCRIPTION,README,NEWS,README.md,NEWS.md} public 2>/dev/null || :
- sed -i 's|"/doc/html/|"/pkgup/doc/html/|g' public/library/pkgup/doc/index.html 2>/dev/null || :
- echo '\n
HTTP redirect' > public/index.html
+ 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: |
diff --git a/DESCRIPTION b/DESCRIPTION
index 2209222..7e1eb4c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -1,5 +1,5 @@
Package: pkgup
-Version: 0.2.0
+Version: 0.3.0
Title: Package Release
Authors@R: c(
person("Jan","Gorecki", role=c("aut","cre"), email="j.gorecki@wit.edu.pl"))
@@ -7,5 +7,5 @@ Description: Lightweight release of R packages on github.
License: GPL-2
URL: https://jangorecki.github.io/pkgup/
BugReports: https://github.com/jangorecki/pkgup/issues/
-Suggests: knitr, markdown
-VignetteBuilder: knitr
+Suggests: litedown
+VignetteBuilder: litedown
diff --git a/README.md b/README.md
index 175fa39..247ab8c 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
pkgup
----
-Example package to present lightweight setup for R package release.
+Example lightweight setup for R package release.
- [x] R package repository
-- [x] html manual
-- [x] html vignettes
+- [x] R package documentation as html website
+ - [x] manual
+ - [x] news
+ - [x] vignettes
[R package documentation](https://jangorecki.github.io/pkgup)
@@ -17,9 +19,9 @@ Installation
install.packages("pkgup", repos="https://jangorecki.github.io/pkgup")
```
-How to use
+How to pkgup
----
-Let's keep it light, no need to install.
+Let's keep it light, no need to install.
-See [howto vignette](https://jangorecki.github.io/pkgup/library/pkgup/doc/howto.html) for details.
\ No newline at end of file
+See [howto vignette](https://jangorecki.github.io/pkgup/vignettes/howto.html) for details.
diff --git a/pkgup/_litedown.yml b/pkgup/_litedown.yml
new file mode 100644
index 0000000..f0a5b39
--- /dev/null
+++ b/pkgup/_litedown.yml
@@ -0,0 +1,15 @@
+output:
+ litedown::html_format:
+ options:
+ toc:
+ depth: 4
+ litedown::latex_format:
+ meta:
+ documentclass: "book"
+
+book:
+ new_session: false
+ subdir: true
+ pattern: "[.]R?md$"
+ chapter_before: "Information before a chapter."
+ chapter_after: "This chapter was generated from `$input$`."
diff --git a/pkgup/index.Rmd b/pkgup/index.Rmd
new file mode 100644
index 0000000..2bd1740
--- /dev/null
+++ b/pkgup/index.Rmd
@@ -0,0 +1,15 @@
+---
+site:
+ rebuild: "outdated"
+ pattern: "[.]R?md$"
+---
+
+```{r, echo=FALSE}
+litedown::pkg_desc()
+```
+
+To cite the package:
+
+```{r, echo=FALSE}
+litedown::pkg_citation()
+```
diff --git a/pkgup/manual.Rmd b/pkgup/manual.Rmd
new file mode 100644
index 0000000..a9a9cb7
--- /dev/null
+++ b/pkgup/manual.Rmd
@@ -0,0 +1,3 @@
+```{r, echo=FALSE}
+litedown::pkg_manual()
+```
diff --git a/pkgup/news.Rmd b/pkgup/news.Rmd
new file mode 100644
index 0000000..b9458a7
--- /dev/null
+++ b/pkgup/news.Rmd
@@ -0,0 +1,3 @@
+```{r, echo=FALSE}
+litedown::pkg_news(recent=0)
+```
diff --git a/pkgup/vignettes.Rmd b/pkgup/vignettes.Rmd
new file mode 100644
index 0000000..0142eeb
--- /dev/null
+++ b/pkgup/vignettes.Rmd
@@ -0,0 +1,25 @@
+```{r, echo=FALSE, results='asis'}
+rmd = list.files("./vignettes", "*.Rmd", full.names=TRUE)
+if (!length(rmd)) {
+ cat("no vignettes\n")
+} else {
+ title = function(f) {
+ title1 = function(f) {
+ if (!file.exists(f))
+ stop("file ", f, " does not exists")
+ l = readLines(f)
+ t = paste(head(strsplit(basename(f), ".", fixed=TRUE)[[1L]], -1L), collapse=".") ## default, basename without extension
+ for (i in seq_along(l)) {
+ if (substr(l[i], 1L, 6L) != "title:")
+ next
+ t = trimws(gsub("title:", "", l[i], fixed=TRUE))
+ break
+ }
+ t
+ }
+ sapply(f, title1)
+ }
+ html = paste0(substr(rmd, 1L, nchar(rmd)-3L), "html")
+ lapply(html, function(f) cat(sprintf("[%s](%s)\n", title(rmd), f))) |> invisible()
+}
+```
diff --git a/vignettes/howto.Rmd b/vignettes/howto.Rmd
index c90dc72..fcb5550 100644
--- a/vignettes/howto.Rmd
+++ b/vignettes/howto.Rmd
@@ -1,10 +1,10 @@
---
-title: "How to use pkgup"
+title: "How to pkgup"
output:
- markdown::html_vignette
+ litedown::html_vignette
vignette: >
%\VignetteIndexEntry{howto pkgup}
- %\VignetteEngine{knitr::knitr}
+ %\VignetteEngine{litedown::vignette}
\usepackage[utf8]{inputenc}
---
@@ -30,4 +30,11 @@ Set _build and deployment_ source: _GitHub Actions_
## Push pkgup yaml to your package repo
-Once _pkgup_ workflow complete, your R package source tarball should be published in CRAN-like repo at `https://namespace.github.io/yourpkg`. Base R html style manual and vignettes of your package as well, at the same address.
+Once _pkgup_ workflow completes, your R package source tarball should be published in CRAN-like repo at `https://namespace.github.io/yourpkg`. Package desription, manual and vignettes will be published at the same address.
+
+## Use R package repo
+
+Then anyone can install package by pointing `repos` to your address.
+```r
+install.packages("yourpkg", repos="https://namespace.github.io/yourpkg")
+```