Skip to content

New argument create_if_missing to load_all #852

@krlmlr

Description

@krlmlr

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions