Skip to content

Commit

Permalink
Using README.md.rsp
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Feb 22, 2015
1 parent 3d0e12e commit 450d08c
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 12 deletions.
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ $(R_OUTDIR)/vigns: install

vignettes: $(R_OUTDIR)/vigns

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Build package README.md
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
README.md: README.md.rsp
$(R_SCRIPT) -e "R.rsp::rfile('README.md.rsp', postprocess=FALSE)"


# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# Run package tests
Expand Down
21 changes: 9 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
# R package: R.methodsS3

Stable release available via [CRAN](http://cran.r-project.org/package=R.methodsS3). Install in R as:

```s
## Installation
Package is available on [CRAN](http://cran.r-project.org/package=R.methodsS3). Install in R as:
```r
install.packages('R.methodsS3')
```


## Quality assessment
## Software quality

* R CMD check status:
- <a href="http://cran.r-project.org/web/checks/check_results_R.methodsS3.html">CRAN checks</a>
- <a href="https://travis-ci.org/HenrikBengtsson/R.methodsS3"><img src="https://travis-ci.org/HenrikBengtsson/R.methodsS3.svg?branch=master" alt="Build status"></a>
- <a href="https://ci.appveyor.com/project/HenrikBengtsson/r-methodss3/"><img src="https://ci.appveyor.com/api/projects/status/3jjkfvbxt7823965" alt="Build status"></a>

* Test coverage status:
<a href='https://coveralls.io/r/HenrikBengtsson/R.methodsS3?branch=develop'><img
src='https://coveralls.io/repos/HenrikBengtsson/R.methodsS3/badge.png?branch=develop'
alt='Coverage Status' /></a>
| Resource: | CRAN | Travis CI | Appveyor |
| ------------- | ------------------- | ---------------- | ---------------- |
| _Platforms:_ | _Multiple_ | _Linux_ | _Windows_ |
| R CMD check | [status](http://cran.r-project.org/web/checks/check_results_R.methodsS3.html) | <a href="https://travis-ci.org/HenrikBengtsson/R.methodsS3"><img src="https://travis-ci.org/HenrikBengtsson/R.methodsS3.svg?branch=master" alt="Build status"></a> | <a href="https://ci.appveyor.com/project/HenrikBengtsson/r-methodss3"><img src="https://ci.appveyor.com/api/projects/status/github/HenrikBengtsson/R.methodsS3" alt="Build status"></a> |
| Test coverage | | <a href="https://coveralls.io/r/HenrikBengtsson/R.methodsS3"><img src="https://coveralls.io/repos/HenrikBengtsson/R.methodsS3/badge.png?branch=develop" alt="Coverage Status"/></a> | |
114 changes: 114 additions & 0 deletions README.md.rsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<%------------------------------------------------------------------------
Usage:
md <- R.rsp::rfile("README.md.rsp", postprocess=FALSE)
------------------------------------------------------------------------%>
<%
pkg <- local({
name <- NULL
function() {
if (is.null(name)) {
pd <- as.list(as.data.frame(read.dcf("DESCRIPTION"), stringsAsFactors=FALSE))
name <<- pd$Package
}
name
}
})

cran <- local({
available <- NULL
function() {
if (is.null(available)) {
repos <- "http://cran.r-project.org"
data <- available.packages(contriburl=contrib.url(repos, "source"))
available <<- pkg() %in% rownames(data)
}
available
}
})

bioc <- local({
available <- NULL
function() {
if (is.null(available)) {
repos <- "http://www.bioconductor.org/packages/devel/bioc/"
data <- available.packages(contriburl=contrib.url(repos, "source"))
available <<- pkg() %in% rownames(data)
}
available
}
})

github_repos = local({
repos <- NULL;
function() {
if (is.null(repos)) repos <<- gsub(".*:", "", gsub("[.]git", "", system2("git", args=c("config", "--get remote.origin.url"), stdout=TRUE)))
repos
}
})

repos <- function() {
if (cran()) "CRAN" else if (bioc()) "Bioonductor" else "GitHub"
}

repos_status <- function() {
if (cran()) {
sprintf("[status](http://cran.r-project.org/web/checks/check_results_%s.html)", pkg())
} else if (bioc()) {
biocURL <- function(type) sprintf("[%s](http://master.bioconductor.org/checkResults/%s/bioc-LATEST/%s)", type, type, pkg())
paste("status:", paste(biocURL(c("release", "devel")), collapse=", "))
} else {
""
}
}

travis <- function() {
if (!file.exists(".travis.yml")) return("")
sprintf('<a href="https://travis-ci.org/%s"><img src="https://travis-ci.org/%s.svg?branch=master" alt="Build status"></a>', github_repos(), github_repos())
}

appveyor <- function() {
if (!file.exists("appveyor.yml")) return("")
repos <- github_repos()
repos <- strsplit(repos, split="/")[[1]]
repos[2] <- gsub("[.]", "-", tolower(repos[2]))
repos <- paste(repos, collapse="/")
sprintf('<a href="https://ci.appveyor.com/project/%s"><img src="https://ci.appveyor.com/api/projects/status/github/%s" alt="Build status"></a>', repos, github_repos())
}

coveralls <- function() {
if (!file.exists(".coveralls.R")) return("")
sprintf('<a href="https://coveralls.io/r/%s"><img src="https://coveralls.io/repos/%s/badge.png?branch=develop" alt="Coverage Status"/></a>', github_repos(), github_repos())
}
%>
# R package: <%=pkg()%>

<% if (file.exists("OVERVIEW.md")) { R.rsp::rcat(file="OVERVIEW.md") } %>

## Installation
<% if (cran()) { %>
Package is available on [CRAN](http://cran.r-project.org/package=<%=pkg()%>). Install in R as:
```r
install.packages('<%=pkg()%>')
```
<% } else if (bioc()) { %>
Package is available on [Bioconductor](http://www.bioconductor.org/packages/devel/bioc/html/<%=pkg()%>.html). Install in R as:

```r
source('http://bioconductor.org/biocLite.html')
biocLite('<%=pkg()%>')
```
<% } else { %>
Package is only available via [GitHub](https://github.com/<%=github_repos()%>). Install in R as:
```r
source('http://callr.org/install#<%=github_repos()%>')
```
<% } %>


## Software quality

| Resource: | <%=repos()%> | Travis CI | Appveyor |
| ------------- | ------------------- | ---------------- | ---------------- |
| _Platforms:_ | _Multiple_ | _Linux_ | _Windows_ |
| R CMD check | <%=repos_status()%> | <%=travis()%> | <%=appveyor() %> |
| Test coverage | | <%=coveralls()%> | |

0 comments on commit 450d08c

Please sign in to comment.