From 248eacdc287d7e2b1e5a99edb48821f8252b3d51 Mon Sep 17 00:00:00 2001
From: Fernando Mayer <fernandomayer@gmail.com>
Date: Mon, 24 Aug 2015 20:15:41 -0300
Subject: [PATCH] new methods to build and test the package

---
 buildPkg.R | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/buildPkg.R b/buildPkg.R
index fc7d77c..7c31438 100644
--- a/buildPkg.R
+++ b/buildPkg.R
@@ -1,21 +1,27 @@
-## require(roxygen2)
-## setwd("/home/walmes/GitHub/")
-## roxygenise(package.dir="wzRfun")
+## Script to build and verify the package
 
-require(devtools)
+## Set working directory
+wd <- "~/GitLab/legTools"
+setwd(wd)
 
 if(!grepl(x=getwd(), pattern="/legTools$")){
     stop("Move to /legTools directory.")
 }
 
+## Packages
+library(devtools)
+
 ## Create/update NAMESPACE, *.Rd files.
 document()
 
 ## Check documentation.
 check_doc()
 
-## Check functions, datasets, run examples, etc.
-check()
+## Check functions, datasets, run examples, etc. Using cleanup = FALSE
+## and check_dir = "../" will create a directory named legTools.Rcheck
+## with all the logs, manuals, figures from exemples, etc.
+check(cleanup = FALSE, manual = TRUE, vignettes = FALSE,
+      check_dir = "../")
 
 ## Load the package.
 load_all()
@@ -24,5 +30,11 @@ load_all()
 ls("package:legTools")
 packageVersion("legTools")
 
-## build()
+## Build the package (it will be one directory up)
+build(manual = TRUE, vignettes = FALSE)
 ## build_win()
+
+## Test install with install.packages
+pkg <- paste("../legTools_", packageVersion("legTools"),
+             ".tar.gz", sep = "")
+install.packages(pkg, repos = NULL)
-- 
GitLab