diff --git a/.Rbuildignore b/.Rbuildignore
new file mode 100644
index 0000000..c503c4f
--- /dev/null
+++ b/.Rbuildignore
@@ -0,0 +1 @@
+^\.github$
diff --git a/.github/workflows/pkgup.yaml b/.github/workflows/pkgup.yaml
new file mode 100644
index 0000000..6ec19dd
--- /dev/null
+++ b/.github/workflows/pkgup.yaml
@@ -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 '\n
HTTP redirect' > 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
diff --git a/DESCRIPTION b/DESCRIPTION
new file mode 100644
index 0000000..cabaebc
--- /dev/null
+++ b/DESCRIPTION
@@ -0,0 +1,10 @@
+Package: pkgup
+Version: 0.0.1
+Title: Package release
+Authors@R: c(
+ person("Jan","Gorecki", role=c("aut","cre"), email="j.gorecki@wit.edu.pl"))
+Description: Lightweight release of R packages on github.
+License: GPL-2
+URL: https://jangorecki.github.io/pkgup
+BugReports: https://github.com/jangorecki/pkgup/issues
+
diff --git a/NAMESPACE b/NAMESPACE
new file mode 100644
index 0000000..c0cc962
--- /dev/null
+++ b/NAMESPACE
@@ -0,0 +1,3 @@
+export(installcmd)
+S3method(print, installcmd)
+
diff --git a/R/pkgup.R b/R/pkgup.R
new file mode 100644
index 0000000..9b891ce
--- /dev/null
+++ b/R/pkgup.R
@@ -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="")
+}
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..029986a
--- /dev/null
+++ b/README.md
@@ -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`
diff --git a/man/installcmd.Rd b/man/installcmd.Rd
new file mode 100644
index 0000000..a77ee4c
--- /dev/null
+++ b/man/installcmd.Rd
@@ -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 }
diff --git a/man/print.installcmd.Rd b/man/print.installcmd.Rd
new file mode 100644
index 0000000..d8c6c18
--- /dev/null
+++ b/man/print.installcmd.Rd
@@ -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 }
diff --git a/tests/tests.R b/tests/tests.R
new file mode 100644
index 0000000..144ff8e
--- /dev/null
+++ b/tests/tests.R
@@ -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"))'
+))