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

New argument create_if_missing to load_all #852

Closed
krlmlr opened this issue Jun 17, 2015 · 2 comments
Closed

New argument create_if_missing to load_all #852

krlmlr opened this issue Jun 17, 2015 · 2 comments

Comments

@krlmlr
Copy link
Member

krlmlr commented Jun 17, 2015

If load_all() doesn't find a DESCRIPTION file in the package directory, it is created. As of #803, parent directories will not be scanned for a DESCRIPTION file. #816 explicitly documents and tests this behavior.

Now the behavior of load_all() is difficult to understand and communicate: If a directory happens to contain R, src or data, a DESCRIPTION is created -- if not (and no DESCRIPTION exists), an error is thrown:

> pkg <- tempfile(); dir.create(pkg); devtools::load_all(pkg)
Error: '/tmp/RtmpqMuf1p/file498b5f0c4c48' does not look like a package: no R/, src/ or data directories
No traceback available 
> pkg <- tempfile(); dir.create(pkg); dir.create(file.path(pkg, "R")); devtools::load_all(pkg)
No DESCRIPTION found. Creating with values:

I suggest a new argument create_if_missing that governs this behavior. If TRUE, always create (perhaps via devtools::setup()). If FALSE, never create (but use the usual pkg <- as.package(pkg) idiom). If NULL (the default), the user will be asked if in interactive mode (otherwise same as FALSE).

@hadley: Is this sufficient for the use case you described in your comment?

@hadley
Copy link
Member

hadley commented Jun 19, 2015

That sounds good to me (although I'd use NA as the default not NULL, and maybe it only needs to be called create?)

@lock
Copy link

lock bot commented Sep 18, 2018

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants