-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathmakeReadme.R
49 lines (46 loc) · 2.17 KB
/
makeReadme.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# This file is part of colorplaner.
#
# colorplaner is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# colorplaner is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with colorplaner. If not, see <http://www.gnu.org/licenses/>.
readme <- readLines("vignettes/colorplaner.Rmd")
loc <- grep("^---$", readme)
news_loc <- grep("^## Motivation$", readme)[1] - 1
ins <- c("# colorplaner",
"",
"[![BuildStatus](https://travis-ci.org/wmurphyrd/colorplaner.svg?branch=master)](https://travis-ci.org/wmurphyrd/colorplaner)",
"[![Coverage Status](https://coveralls.io/repos/github/wmurphyrd/colorplaner/badge.svg?branch=master)](https://coveralls.io/github/wmurphyrd/colorplaner?branch=master)",
"[![CRAN Version](http://www.r-pkg.org/badges/version/colorplaner)](https://cran.r-project.org/package=colorplaner)",
"[![CRAN Downloads](http://cranlogs.r-pkg.org/badges/grand-total/colorplaner)](https://cran.r-project.org/package=colorplaner)",
"```{r include = F}",
"knitr::opts_chunk$set(fig.width = 5, fig.height = 5)",
"```",
"")
news <- readLines("NEWS.md")
news <- gsub("^#", "####", news)
news_ins <- c("",
"## Installation",
"",
"To install:",
"",
"```{r, eval=FALSE}",
"# CRAN Version:",
"install.packages(\"colorplaner\")",
"# Current development version: ",
"devtools::install_github(\"wmurphyrd/colorplaner\")",
"```",
"",
news,
"")
knitr::knit(text = c(ins, readme[seq(loc[2] + 1, news_loc)],
news_ins, readme[seq(news_loc + 1, length(readme))]),
output = "readme.md", quiet = TRUE)