New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use get directly instead of match.fun #936

Merged
merged 5 commits into from Oct 6, 2015

Conversation

Projects
None yet
3 participants
@jimhester
Member

jimhester commented Sep 23, 2015

The previous implementation used match.fun(), which has the undesirable effect that the function cannot be found if the devtools namespace is not attached.

So devtools::install_deps() would fail, which is what was happening on travis (https://travis-ci.org/hadley/devtools/builds/81765159#L2108-L2110) when I tried to use Remotes:

This fix uses get() directly in the devtools namespace, so works regardless if devtools is attached.

R/deps.R Outdated
@@ -152,7 +152,9 @@ dev_remote_type <- function(remotes = "") {
} else {
stop("Malformed remote specification '", x, "'", call. = FALSE)
}
tryCatch(fun <- match.fun(paste0("install_", tolower(type))),
tryCatch(fun <- get(x = paste0("install_", tolower(type)),

This comment has been minimized.

@hadley

hadley Sep 23, 2015

Member

I'm not terribly consistent about enforcing this, but I'd prefer subsequent arguments to be indented just one extra level

This comment has been minimized.

@jimhester

jimhester Sep 23, 2015

Member

Should be fixed by 4903b51

@wch

This comment has been minimized.

Member

wch commented Sep 23, 2015

Is it desirable to have it search in non-devtools environments? (That's what happens because of the default inherits=TRUE).

@jimhester

This comment has been minimized.

Member

jimhester commented Sep 23, 2015

@wch It is probably not desirable. Doing so opens the possibility for another package to export an install_* function to support a new backend, but I am not sure that is worth the extra search cost and safety concerns. 3b265fb uses inherits = FALSE

@wch

This comment has been minimized.

Member

wch commented Sep 23, 2015

I think you mean that commit uses inherits = FALSE. :)

@jimhester

This comment has been minimized.

Member

jimhester commented Sep 23, 2015

I edited the comment, no one will ever know!

@jimhester

This comment has been minimized.

Member

jimhester commented Oct 2, 2015

jimhester@d21c892 should be ready to merge whenever. This will allow use of the Remotes: feature on travis, so it is fairly useful.

hadley added a commit that referenced this pull request Oct 6, 2015

Merge pull request #936 from jimhester/remote_bug
Use get directly instead of match.fun

@hadley hadley merged commit 0295d20 into r-lib:master Oct 6, 2015

2 checks passed

continuous-integration/appveyor AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@hadley

This comment has been minimized.

Member

hadley commented Oct 6, 2015

Thanks!

dckc added a commit to PCORnet/DECOY that referenced this pull request Nov 24, 2015

jimhester added a commit to jimhester/rocker-jenkins that referenced this pull request Dec 30, 2015

Install everything in one R session
This installs all packages from one R session rather than using multiple. It should be slightly faster. I also explicitly attached devtools to avoid r-lib/devtools#936, the fix is not yet on CRAN.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment