Title: | Make use_this usable in foders |
---|---|
Description: | The use_this package likes to work in "projects", but that's annoying if you have more than one package in development at a time. This helps. |
Authors: | Barry Rowlingson |
Maintainer: | Barry Rowlingson <[email protected]> |
License: | GPL (>= 2) |
Version: | 1.1 |
Built: | 2024-10-26 05:57:45 UTC |
Source: | https://gitlab.com/b-rowlingson/abusethis |
The use_this package likes to work in "projects", but that's annoying if you have more than one package in development at a time. This helps.
Index of help topics:
ab_use ab_use abusethis-package Make use_this usable in foders attach_use wrap and attach make_use make package-wrapped functions project_wrap_function project_wrap_function use_functions use_functions wrap_all wrap_all
Barry Rowlingson <[email protected]>
Barry Rowlingson
create and attach a new environment of use functions
ab_use(prefix = "ab", name = "ab_users")
ab_use(prefix = "ab", name = "ab_users")
prefix |
characters to prepend to function names |
name |
name of environment to attach |
Finds all the use_ functions, and creates an environment with them all wrapped for a project argument.
the name of the attached environment
Barry Rowlingson
wrap and attach functions for a given package
attach_use(package, prefix = paste0(basename(package), "_"))
attach_use(package, prefix = paste0(basename(package), "_"))
package |
package path |
prefix |
prefix for functions and the environment name |
given a package, this function attaches a new environment with all the use_ functions wrapped to work with that package, and with a prefix in the name.
name of environment
Barry Rowlingson
make a set of wrapped functions for a package
make_use(package, prefix = paste0(basename(package), "_"))
make_use(package, prefix = paste0(basename(package), "_"))
package |
path to package |
prefix |
prefix for function names |
returns a list of functions from use_this, but wrapped for use with the given package. The list names are the function names but with the added prefix.
named list of wrapped functions
Barry Rowlingson
Wrap a function call in a with_project block
project_wrap_function(wrapped)
project_wrap_function(wrapped)
wrapped |
the function to wrap |
Take a function, return a function that has one new arg which is the directory of a project to run the function in with the rest of the argument.
a wrapped function
Barry Rowlingson
get all the use_ functions
use_functions(p = "package:usethis")
use_functions(p = "package:usethis")
p |
where to look for functions |
Finds all function starting use_ in a package.
a named list of functions
Barry Rowlingson
wrap functions with project
wrap_all(fs)
wrap_all(fs)
fs |
a named list of functions |
transforms a named list of functions to a named list of wrapped functions
a named list of wrapped functions
Barry Rowlingson