Skip to content

Commit

Permalink
resolved merge conflict
Browse files Browse the repository at this point in the history
Merge branch 'master' of github.com:trinker/pacman

Conflicts:
	DESCRIPTION
	NEWS
	NEWS.md
	inst/CITATION
  • Loading branch information
trinker committed Mar 30, 2016
2 parents 4f99944 + fc2492d commit 7f94cb7
Show file tree
Hide file tree
Showing 8 changed files with 106 additions and 14 deletions.
1 change: 1 addition & 0 deletions NAMESPACE
Expand Up @@ -26,6 +26,7 @@ export(p_information)
export(p_install)
export(p_install_gh)
export(p_install_version)
export(p_install_version_gh)
export(p_inter)
export(p_interactive)
export(p_iscran)
Expand Down
29 changes: 29 additions & 0 deletions R/p_install_version_gh.R
@@ -0,0 +1,29 @@
#' Install Minimal GitHub Package Version
#'
#' Install minimal GitHub package version(s).
#'
#' @param package \code{character} vector of the repository address(es) of the
#' package(s) you want to install a particular minimal version of. Repository
#' address(es) in the format \code{username/repo[/subdir][@@ref|#pull]}.
#' @param version Corresponding \code{character} vector of the minimal
#' package version(s).
#' @keywords version
#' @export
#' @examples
#' p_install_version_gh(
#' c("trinker/pacman", "hadley/testthat"),
#' c("0.2.0", "0.9.1")
#' )
p_install_version_gh <- function (package, version){

## Check that package and version are equal in length
if (length(package) != length(version)) {
stop("`packages` must be equal in length to `version`")
}

# Version check on each of the packages
status <- Map(p_install_version_single_gh, package, version)
return(invisible(status))

}

32 changes: 32 additions & 0 deletions R/p_install_version_single_gh.R
@@ -0,0 +1,32 @@
## Helper single version of p_install_version
p_install_version_single_gh <- function(package, version, ...){

## Determine if package is even in the users library
if (!basename(package) %in% p_lib()){
out <- p_install_gh(package, ...)
if (isTRUE(out)) {
message(sprintf(
"\n%s not found in user's library; Version %s was installed",
basename(package), utils::packageVersion(basename(package)))
)
}
return(invisible(out))
} else {

## If package is not in user's library check if version ok
if (p_ver(basename(package)) < version) {
out <- p_install_gh(package, ...)
if (isTRUE(out)) {
message(sprintf("\n%s was updated to v. %s",
basename(package), utils::packageVersion(basename(package))))
}
return(invisible(out))
} else {
message(sprintf("\nVersion of %s (v. %s) is suitable",
basename(package), utils::packageVersion(basename(package))))
return(invisible(TRUE))
}
}

}

2 changes: 1 addition & 1 deletion README.md
@@ -1,6 +1,6 @@
# pacman

[![Build Status](https://travis-ci.org/trinker/pacman.png?branch=master)](https://travis-ci.org/trinker/pacman) [![DOI](https://zenodo.org/badge/5398/trinker/pacman.svg)](http://dx.doi.org/10.5281/zenodo.15406) [![Version](https://img.shields.io/badge/Version-0.3.0-orange.svg)](https://img.shields.io/badge/Version-0.3.0-orange.svg)
[![Build Status](https://travis-ci.org/trinker/pacman.png?branch=master)](https://travis-ci.org/trinker/pacman) [![DOI](https://zenodo.org/badge/5398/trinker/pacman.svg)](http://dx.doi.org/10.5281/zenodo.15406) [![Version](https://img.shields.io/badge/Version-0.4.0-orange.svg)](https://img.shields.io/badge/Version-0.4.0-orange.svg)

The [pacman](http://trinker.github.io/pacman_dev/) package is an R package management tool that combines the functionality of base library related functions into intuitively named functions. This package is ideally added to .Rprofile to increase workflow by reducing time recalling obscurely named functions, reducing code and integrating functionality of base functions to simultaneously perform multiple actions.

Expand Down
6 changes: 3 additions & 3 deletions inst/CITATION
Expand Up @@ -2,14 +2,14 @@ citHeader("To cite pacman in publications, please use:")


citEntry(entry = "manual",
title = "{pacman}: {P}ackage Management for R",
title = "{pacman}: {P}ackage Management for {R}",
author = "Tyler W. Rinker and Dason Kurkiewicz",
organization = "University at Buffalo/SUNY",
address = "Buffalo, New York",
note = "version 0.4.0",
year = "2013",
year = "2015",
url = "http://github.com/trinker/pacman",
textVersion = paste("Rinker, T. W. & Kurkiewicz, D. (2013).",
textVersion = paste("Rinker, T. W. & Kurkiewicz, D. (2015).",
"pacman: Package Management for R.",
"version 0.4.0. University at Buffalo. Buffalo, New York.",
"http://github.com/trinker/pacman")
Expand Down
19 changes: 10 additions & 9 deletions inst/build.R
@@ -1,20 +1,22 @@
root <- Sys.getenv("USERPROFILE")
repo <- pack <- basename(getwd())

curd <- getwd()
usr <- dirname(path.expand("~"))
loc <- file.path(usr, "Desktop")
loc <- file.path(root, "Desktop")
setwd(loc)

qman <- function(x = "pacman", db = file.path(usr, "Dropbox/Public"), dir=loc) {
base.git <- dirname(curd)

qman <- function(x = repo, db = file.path(root, "/Dropbox/Public"), dir=loc) {
path <- file.path(dir, paste0(x, ".pdf"))
if (!file.exists(path)) stop(paste(x, "does not exist..."))
if (!file.exists(path)) stop(paste(x, "does not exist..."))
opath <- file.path(db, paste0(x, ".pdf"))
file.copy(path, opath, overwrite = TRUE)
message("manual copied!\n")
}


repo <- pack <- "pacman"
base.git = file.path(usr, "GitHub")
quick = TRUE
quick <- TRUE
library(devtools)

unlink(paste0(pack, ".pdf"), recursive = TRUE, force = TRUE)
Expand All @@ -28,5 +30,4 @@ system(paste(shQuote(file.path(R.home("bin"), "R")),

qman(repo, dir=loc)
setwd(curd)
message("Done!")

message("Done!")
27 changes: 27 additions & 0 deletions man/p_install_version_gh.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion tests/testthat/test-p_install.R
@@ -1,8 +1,10 @@
context("Checking p_install")

test_that("p_install works",{
skip_on_cran()
skip_on_travis()
require(pacman)
expect_warning(p_install("iDontExistAnywhere"))
tmp <- suppressWarnings(p_install("iDontExistAnywhere"))
expect_false(tmp)
})
})

0 comments on commit 7f94cb7

Please sign in to comment.