Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions R/publishGitbook.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,25 @@
#' @param repo the github repository. Should be of form username/repository
#' @param out.dir location of the built gitbook.
#' @param message commit message.
#' @param CNAME web address to be added to CNAME file on github for custom domain names
#'
#' @export
publishGitbook <- function(repo,
out.dir=paste0(getwd(), '/_book'),
message='Update built gitbook') {
message='Update built gitbook',
CNAME = ""
) {
test <- system('git --version', ignore.stderr=TRUE, ignore.stdout=TRUE, show.output.on.console=FALSE)
if(test != 0) { stop('Git does not appear to be installed.')}
cmd <- paste0(


if(CNAME != ""){
fileConn<-file(paste0(out.dir,"/CNAME"))
writeLines(CNAME, fileConn)
close(fileConn)
}

cmd <- paste0(
"cd ", out.dir, " \n",
"git init \n",
"git commit --allow-empty -m '", message,"' \n",
Expand Down
5 changes: 4 additions & 1 deletion man/publishGitbook.Rd
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
\title{Publish the built gitbook to Github.}
\usage{
publishGitbook(repo, out.dir = paste0(getwd(), "/_book"),
message = "Update built gitbook")
message = "Update built gitbook", CNAME = "")
}
\arguments{
\item{repo}{the github repository. Should be of form
Expand All @@ -12,6 +12,9 @@ publishGitbook(repo, out.dir = paste0(getwd(), "/_book"),
\item{out.dir}{location of the built gitbook.}

\item{message}{commit message.}

\item{CNAME}{web address to be added to CNAME file on
github for custom domain names}
}
\description{
Note that this is a wrapper to system \code{git} call.
Expand Down