From f4ba53188443e1afdd991d99925ff48aa793d358 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:23:26 +0100 Subject: [PATCH 01/14] render to Markdown manually --- R/here.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/here.R b/R/here.R index 119bef9..92be0fc 100644 --- a/R/here.R +++ b/R/here.R @@ -10,7 +10,7 @@ #' the \pkg{rprojroot} package for more control, #' or for package development. #' -#' @evalRd format_root_section() +#' @evalRd roxygen2:::full_markdown(format_root_section()) #' #' @param ... \code{[character]}\cr #' Path components below the project root, can be empty. From 39171573ef31da3c90ddd40166b9f160b02cf61f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:29:13 +0100 Subject: [PATCH 02/14] CRAN comments --- .Rbuildignore | 1 + cran-comments.md | 14 ++++++++++++++ 2 files changed, 15 insertions(+) create mode 100644 cran-comments.md diff --git a/.Rbuildignore b/.Rbuildignore index 6a55a39..62a1788 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -8,3 +8,4 @@ ^scripts/deploy-pages\.sh$ ^_pkgdown\.yml$ ^tic\.R$ +^cran-comments\.md$ diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 0000000..296e632 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,14 @@ +## Test environments +* local Ubuntu 16.10 install, R 3.3.2 +* ubuntu 12.04 (on travis-ci), R 3.3.2 +* win-builder (devel and release) + +## R CMD check results + +0 errors | 0 warnings | 1 note + +* This is a new release. + +## Reverse dependencies + +This is a new release, so there are no reverse dependencies. From ef538dac7bb093a747986044b3fd0d930f5cb6e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:29:47 +0100 Subject: [PATCH 03/14] ignore --- .Rbuildignore | 1 + .gitignore | 1 + 2 files changed, 2 insertions(+) diff --git a/.Rbuildignore b/.Rbuildignore index 62a1788..26a9fc9 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -9,3 +9,4 @@ ^_pkgdown\.yml$ ^tic\.R$ ^cran-comments\.md$ +^docs$ diff --git a/.gitignore b/.gitignore index 807ea25..ac1293b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .Rproj.user .Rhistory .RData +/docs From 952a41807448a00c92e374e7c9c09f3332ce43fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:34:43 +0100 Subject: [PATCH 04/14] describe --- DESCRIPTION | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/DESCRIPTION b/DESCRIPTION index c31ef61..660246a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,6 +3,10 @@ Title: A Simpler Way to Find Your Files Version: 0.0-6 Authors@R: person("Kirill", "Müller", role = c("aut", "cre"), email = "krlmlr+r@mailbox.org") Description: Constructs paths to your project's files. + The 'here()' function uses a reasonable heuristics to find your project's + files, based on the current working directory at the time when the package + is loaded. Use it as a drop-in replacement for 'file.path()', it will always + locate the files relative to your project root. Imports: rprojroot (>= 1.2) License: GPL-3 Encoding: UTF-8 From 330a50df73922db09d364bdf16481bb26f0d6ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:36:25 +0100 Subject: [PATCH 05/14] get rid of remote --- DESCRIPTION | 1 - 1 file changed, 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 660246a..961961e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,4 +16,3 @@ URL: https://github.com/krlmlr/here, http://krlmlr.github.io/here BugReports: https://github.com/krlmlr/here/issues Roxygen: list(markdown = TRUE) RoxygenNote: 5.0.1.9000 -Remotes: krlmlr/rprojroot@r-1.2 From c8a7ed8fa025d5e0e82bd6812833f2861c95dcd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:56:18 +0100 Subject: [PATCH 06/14] fall back to current working directory, but only after all other criteria fail --- R/here.R | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/R/here.R b/R/here.R index 92be0fc..459e628 100644 --- a/R/here.R +++ b/R/here.R @@ -34,15 +34,25 @@ dr_here <- function(show_reason = TRUE) { } format_dr_here <- function(show_reason) { - root <- .root_env$f() paste0( - "here() starts at ", root, + "here() starts at ", .root_env$f(), if (show_reason) { - paste0(", because it ", get_root_desc(.root_env$crit, root)) + paste0(", because ", format_reason()) } ) } +format_reason <- function() { + root <- .root_env$f() + if (any(vapply(.root_env$crit$testfun, function(f) f(root), logical(1L)))) { + paste0("it ", get_root_desc(.root_env$crit, .root_env$f())) + } else { + paste0("none of the following criteria apply for this directory or any of its parents:\n", + format_root_criteria_items(), "\n", + "Use set_here() to create a `.here` file") + } +} + #' @rdname here #' @description `set_here()` creates an empty file named `.here`, by default #' in the current directory. When `here` encounters such a file, it uses the @@ -78,7 +88,13 @@ is_here <- has_file(".here") #' @import rprojroot .onLoad <- function(libname, pkgname) { .root_env$crit <- is_here | is_rstudio_project | is_r_package | is_remake_project | is_projectile_project | is_vcs_root - .root_env$f <- .root_env$crit$make_fix_file() + tryCatch( + .root_env$f <- .root_env$crit$make_fix_file(), + error = function(e) { + warning(conditionMessage(e), call. = FALSE) + .root_env$f <- from_wd$make_fix_file() + } + ) } .onAttach <- function(libname, pkgname) { @@ -89,10 +105,14 @@ format_root_section <- function() { paste( "\\section{Project root}{", "Starting with the current working directory during package load time, `here` will walk the directory hierarchy upwards until it finds a directory that satisfies at least one of the following conditions:", - paste(format(.root_env$crit)[-1], collapse = "\n"), + format_root_criteria_items(), "", "Once established, the root directory doesn't change during the active R session. `here()` then appends the arguments to the root directory.", "}", sep = "\n" ) } + +format_root_criteria_items <- function() { + paste(format(.root_env$crit)[-1L], collapse = "\n") +} From 37aa30d8b9506afb16a280c680849810b82e31a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 15:06:33 +0100 Subject: [PATCH 07/14] don't even warn on loading --- R/here.R | 1 - 1 file changed, 1 deletion(-) diff --git a/R/here.R b/R/here.R index 459e628..c825b0c 100644 --- a/R/here.R +++ b/R/here.R @@ -91,7 +91,6 @@ is_here <- has_file(".here") tryCatch( .root_env$f <- .root_env$crit$make_fix_file(), error = function(e) { - warning(conditionMessage(e), call. = FALSE) .root_env$f <- from_wd$make_fix_file() } ) From 9528c8c704d2a64aa059f6a7007f19357c8cae4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:25:30 +0100 Subject: [PATCH 08/14] bump version to 0.1 --- DESCRIPTION | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 961961e..46cd151 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: here Title: A Simpler Way to Find Your Files -Version: 0.0-6 +Version: 0.1 Authors@R: person("Kirill", "Müller", role = c("aut", "cre"), email = "krlmlr+r@mailbox.org") Description: Constructs paths to your project's files. The 'here()' function uses a reasonable heuristics to find your project's @@ -11,7 +11,7 @@ Imports: rprojroot (>= 1.2) License: GPL-3 Encoding: UTF-8 LazyData: true -Date: 2017-01-16 +Date: 2017-01-25 URL: https://github.com/krlmlr/here, http://krlmlr.github.io/here BugReports: https://github.com/krlmlr/here/issues Roxygen: list(markdown = TRUE) From 9502ac54417c8888b422d247586ca5e3b5b9ef06 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 14:28:36 +0100 Subject: [PATCH 09/14] NEWS --- NEWS.md | 42 ++++++++---------------------------------- 1 file changed, 8 insertions(+), 34 deletions(-) diff --git a/NEWS.md b/NEWS.md index 395d5dc..d425780 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,36 +1,10 @@ -## here 0.0-6 (2017-01-16) +# here 0.1 (2017-01-25) -- New `set_here()` function that creates a `.here` file and talks about it by default (#1). -- New `dr_here()`, describes why `here()` has settled for a particular path. -- Recognize projectile projects and VCS roots. -- Using working directory as fallback produces wrong results, reverted. +Initial CRAN release. - -## here 0.0-5 (2016-10-29) - -- `remake` projects are also recognized by default. -- Silently falling back to current working directory if no root found. - - -## here 0.0-4 (2016-10-29) - -- `pkgdown`. - - -## here 0.0-3 (2016-07-19) - -- Install `rprojroot` from GitHub. -- Show message only when attaching. - - -## here 0.0-2 (2016-07-19) - -- Better argument documentation. -- README. - - -## here 0.0-1 (2016-07-19) - -- A single function `here()` -- Uses a fixed root that can be either an RStudio project, or an R package -- The root is established at package loading time, and shown with a message +- Main function `here()` + - Uses a fixed root that contains a `.here` file or can be either an RStudio project, an R package, a `remake` project, a Projectile project, or a VCS repository. + - The root is established at package loading time, and shown with a message. + - The current working directory is used as a fallback. +- The `set_here()` function creates a `.here` file so that a directory is recognized as root by `here()`. +- The `dr_here()` function explains the reasoning of `here()` for the current session. From 007bfd947ccf1392e59fd683ebda6248d3921b62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Wed, 25 Jan 2017 15:54:03 +0100 Subject: [PATCH 10/14] bump From 502794107921490095f7c663be6620b540daf463 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 27 May 2017 22:48:59 +0200 Subject: [PATCH 11/14] up date --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 46cd151..360f6bc 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -11,7 +11,7 @@ Imports: rprojroot (>= 1.2) License: GPL-3 Encoding: UTF-8 LazyData: true -Date: 2017-01-25 +Date: 2017-05-27 URL: https://github.com/krlmlr/here, http://krlmlr.github.io/here BugReports: https://github.com/krlmlr/here/issues Roxygen: list(markdown = TRUE) From a4a533fecf29d871574f9dee0c2332489e986745 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 27 May 2017 22:49:48 +0200 Subject: [PATCH 12/14] up roxygen2 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 360f6bc..2d790a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -15,4 +15,4 @@ Date: 2017-05-27 URL: https://github.com/krlmlr/here, http://krlmlr.github.io/here BugReports: https://github.com/krlmlr/here/issues Roxygen: list(markdown = TRUE) -RoxygenNote: 5.0.1.9000 +RoxygenNote: 6.0.1 From 94df9d030ef2a45d3308f01c807f0e10300ec60e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sat, 27 May 2017 22:50:59 +0200 Subject: [PATCH 13/14] to Markdown --- R/here.R | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/R/here.R b/R/here.R index c825b0c..048e535 100644 --- a/R/here.R +++ b/R/here.R @@ -12,7 +12,7 @@ #' #' @evalRd roxygen2:::full_markdown(format_root_section()) #' -#' @param ... \code{[character]}\cr +#' @param ... `[character]`\cr #' Path components below the project root, can be empty. #' @export #' @examples @@ -26,7 +26,7 @@ here <- function(...) { #' @description `dr_here()` shows a message that by default also includes the #' reason why `here()` is set to a particular directory. Use this function #' if `here()` gives unexpected results. -#' @param show_reason \code{[logical(1)]}\cr +#' @param show_reason `[logical(1)]`\cr #' Include reason in output of `dr_here()`, defaults to `TRUE`. #' @export dr_here <- function(show_reason = TRUE) { @@ -58,9 +58,9 @@ format_reason <- function() { #' in the current directory. When `here` encounters such a file, it uses the #' directory that contains this file as root. This is useful if none of the #' default criteria apply. -#' @param path \code{[character(1)]}\cr +#' @param path `[character(1)]`\cr #' Directory where to create `.here` file, defaults to the current directory. -#' @param verbose \code{[logical(1)]}\cr +#' @param verbose `[logical(1)]`\cr #' Verbose output, defaults to `TRUE`. #' @export set_here <- function(path = ".", verbose = TRUE) { From 1efd1a197ecd75dbd824eae1e52fb7b7e3d287b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Sun, 28 May 2017 01:47:16 +0200 Subject: [PATCH 14/14] up versions --- cran-comments.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cran-comments.md b/cran-comments.md index 296e632..0169646 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,6 @@ ## Test environments -* local Ubuntu 16.10 install, R 3.3.2 -* ubuntu 12.04 (on travis-ci), R 3.3.2 +* local Ubuntu 16.10 install, R 3.4.0 +* ubuntu 12.04 (on travis-ci), R release, devel, and oldrel * win-builder (devel and release) ## R CMD check results