.build_package.R 2.22 KB
Newer Older
1 2 3 4 5
#!/usr/bin/env Rscript

#-----------------------------------------------------------------------

options(echo = TRUE)
6 7
R.version.string
Sys.info()
8 9 10 11 12 13 14 15 16 17 18 19 20 21

#-----------------------------------------------------------------------
# Load packages used develop this package and install packages needed.

library(devtools)
library(roxygen2)

# Install dependencies (DESCRIPTION)
install_github("walmes/wzRfun")
install_deps(dependencies = TRUE,
             quiet = TRUE,
             upgrade = FALSE,
             repos = "http://cran-r.c3sl.ufpr.br/")

22
session_info()
23

24 25
inpack <- installed.packages()
rownames(inpack) <- NULL
26 27
print(inpack[order(inpack[, "Package"]), c("Package", "Version")],
      quote = FALSE)
28

29 30 31 32 33
#-----------------------------------------------------------------------
# Load package objects.

load_all()

34 35 36
search()
ls("package:wzCoop")
packageVersion("wzCoop")
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59

#-----------------------------------------------------------------------
# Ignore the check on non-ASCII present in the datasets.

Sys.setenv(`_R_CHECK_ASCII_DATA_` = "FALSE")

#-----------------------------------------------------------------------
# Run the unit tests in the package.

test()

#-----------------------------------------------------------------------
# Create de documentation.

document()

cp <- compareVersion(a = as.character(packageVersion("devtools")),
                     b = "1.9.1")
if (cp > 0) { check_man() } else { check_doc() }

#-----------------------------------------------------------------------
# Generate the rendered vignettes.

60 61 62
# if (length(list.files("./vignettes"))) {
#     build_vignettes(dependencies = FALSE)
# }
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80

#-----------------------------------------------------------------------
# Check the entire package.

check(manual = TRUE,
      vignettes = FALSE,
      check_dir = "../")

#-----------------------------------------------------------------------
# Builds the package *.tar.gz.

build(manual = TRUE, vignettes = TRUE)

#-----------------------------------------------------------------------
# Install the package.

rm(list = ls())

81 82 83 84
# lib <- path.expand("~/R-test/")
# dir.create(lib)
# .libPaths(new = lib)
# .libPaths()
85 86 87

install()

88
# unlink(lib, recursive = TRUE)
89 90

#-----------------------------------------------------------------------