Skip to content
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
Merged

Conversation

jimhester
Copy link
Member

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.

@@ -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)),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be fixed by 4903b51

@wch
Copy link
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
Copy link
Member Author

@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
Copy link
Member

wch commented Sep 23, 2015

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

@jimhester
Copy link
Member Author

I edited the comment, no one will ever know!

@jimhester
Copy link
Member Author

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
Use get directly instead of match.fun
@hadley hadley merged commit 0295d20 into r-lib:master Oct 6, 2015
@hadley
Copy link
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
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants