-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 14a9a8a
Showing
9 changed files
with
176 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
^\.github$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# permissions and concurrency settings for GitHub Pages | ||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
concurrency: | ||
group: "pages" | ||
cancel-in-progress: true | ||
|
||
on: [push] | ||
jobs: | ||
build: | ||
name: pkgup | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: r-lib/actions/setup-pandoc@v2 | ||
- uses: r-lib/actions/setup-r@v2 | ||
- name: build | ||
run: | | ||
R CMD build . | ||
- name: check | ||
run: | | ||
R CMD check --as-cran $(ls -1t pkgup_*.tar.gz | head -n 1) | ||
- name: manual | ||
if: github.ref == 'refs/heads/master' | ||
run: | | ||
mkdir library | ||
R_LIBS="library" R CMD INSTALL $(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 | ||
mkdir -p public | ||
mv doc public | ||
cp -r --parents library/*/{html,help,DESCRIPTION,README,NEWS,README.md,NEWS.md} public 2>/dev/null | ||
echo '<!DOCTYPE html>\n<html><head><meta http-equiv="refresh" content="0; url=library/pkgup/html/00Index.html"><title>HTTP redirect</title></head><body></body></html>' > public/index.html | ||
- 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")' | ||
- name: upload | ||
if: github.ref == 'refs/heads/master' | ||
uses: actions/upload-pages-artifact@v1 | ||
with: | ||
path: "public" | ||
- name: deploy | ||
if: github.ref == 'refs/heads/master' | ||
id: deployment | ||
uses: actions/deploy-pages@v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Package: pkgup | ||
Version: 0.0.1 | ||
Title: Package release | ||
Authors@R: c( | ||
person("Jan","Gorecki", role=c("aut","cre"), email="[email protected]")) | ||
Description: Lightweight release of R packages on github. | ||
License: GPL-2 | ||
URL: https://jangorecki.github.io/pkgup | ||
BugReports: https://github.com/jangorecki/pkgup/issues | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export(installcmd) | ||
S3method(print, installcmd) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
dcf.field = function(dcf, field) { | ||
if (field %in% colnames(dcf)) | ||
trimws(strsplit(gsub("\n", " ", dcf[,field][[1L]], fixed=TRUE), ",")[[1L]]) | ||
else | ||
character() | ||
} | ||
|
||
installcmd = function(pkg = "pkgup") { | ||
dcf = read.dcf(system.file("DESCRIPTION", package=pkg)) | ||
pkg = dcf[,"Package"][[1L]] | ||
repos = grep("github.io", dcf.field(dcf, "URL"), value=TRUE) | ||
if (length(repos) > 1L) repos = repos[1L] ## take first github.io url | ||
repos = c(repos, dcf.field(dcf, "Additional_repositories")) | ||
repos = unique(c(repos, getOption("repos"))) ## could omit if package.dcf returns length 0 | ||
x = sprintf('install.packages("%s", repos=c(%s))', pkg, paste0('"', repos, '"', collapse=",")) | ||
class(x) = "installcmd" | ||
x | ||
} | ||
|
||
print.installcmd = function(x, ...) { | ||
cat(unclass(x), "\n", sep="") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
pkgup | ||
---- | ||
|
||
Example package to present lightweight configuration for a complete R package release. | ||
- [x] R package repository | ||
- [x] html manual | ||
- [ ] html vignettes | ||
|
||
[R package website](https://jangorecki.github.io/pkgup) | ||
|
||
---- | ||
|
||
Installation | ||
---- | ||
|
||
```r | ||
install.packages("pkgup", repos="https://jangorecki.github.io/pkgup") | ||
``` | ||
|
||
Usage | ||
---- | ||
|
||
|
||
```r | ||
library(pkgup) | ||
|
||
installcmd() | ||
``` | ||
|
||
See `.github/workflows/pkgup.yaml` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
\name{installcmd} | ||
\alias{installcmd} | ||
\title{ Installation command } | ||
\description{ | ||
Function generates installation command for a given installed package. Installation command points to a github page of a package. | ||
} | ||
\usage{ | ||
installcmd(pkg = "pkgup") | ||
} | ||
\arguments{ | ||
\item{pkg}{ Character, default \code{"pkgup"}. A package name for which we want to generate installation command. } | ||
} | ||
\value{ | ||
Object of class \code{installcmd} is returned. | ||
} | ||
\seealso{\code{\link{print.installcmd}}} | ||
\examples{ | ||
installcmd("pkgup") | ||
} | ||
\keyword{ data } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
\name{print.installcmd} | ||
\alias{print.installcmd} | ||
\title{ susy installcmd method } | ||
\description{ | ||
Prints installation command for \code{installcmd} object. | ||
} | ||
\usage{ | ||
\method{print}{installcmd}(x, \dots) | ||
} | ||
\arguments{ | ||
\item{x}{ An \code{installcmd} object. } | ||
\item{\dots}{ Ignored. } | ||
} | ||
\value{ | ||
Returns \code{x} invisibly. Display output to console as a side effect. | ||
} | ||
\seealso{\code{\link{installcmd}}} | ||
\examples{ | ||
cmd = installcmd("pkgup") | ||
print(cmd) | ||
} | ||
\keyword{ data } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
library(pkgup) | ||
|
||
cmd = installcmd() | ||
|
||
stopifnot(all.equal( | ||
unclass(cmd), | ||
'install.packages("pkgup", repos=c("https://jangorecki.github.io/pkgup","https://cloud.r-project.org"))' | ||
)) | ||
|
||
stopifnot(all.equal( | ||
capture.output(print(cmd)), | ||
'install.packages("pkgup", repos=c("https://jangorecki.github.io/pkgup","https://cloud.r-project.org"))' | ||
)) |