Package 'abusethis'

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-08-27 03:06:28 UTC
Source: https://gitlab.com/b-rowlingson/abusethis

Help Index


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.

Package Content

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

Maintainer

Barry Rowlingson <[email protected]>

Author(s)

Barry Rowlingson


ab_use

Description

create and attach a new environment of use functions

Usage

ab_use(prefix = "ab", name = "ab_users")

Arguments

prefix

characters to prepend to function names

name

name of environment to attach

Details

Finds all the use_ functions, and creates an environment with them all wrapped for a project argument.

Value

the name of the attached environment

Author(s)

Barry Rowlingson


wrap and attach

Description

wrap and attach functions for a given package

Usage

attach_use(package, prefix = paste0(basename(package), "_"))

Arguments

package

package path

prefix

prefix for functions and the environment name

Details

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.

Value

name of environment

Author(s)

Barry Rowlingson


make package-wrapped functions

Description

make a set of wrapped functions for a package

Usage

make_use(package, prefix = paste0(basename(package), "_"))

Arguments

package

path to package

prefix

prefix for function names

Details

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.

Value

named list of wrapped functions

Author(s)

Barry Rowlingson


project_wrap_function

Description

Wrap a function call in a with_project block

Usage

project_wrap_function(wrapped)

Arguments

wrapped

the function to wrap

Details

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.

Value

a wrapped function

Author(s)

Barry Rowlingson


use_functions

Description

get all the use_ functions

Usage

use_functions(p = "package:usethis")

Arguments

p

where to look for functions

Details

Finds all function starting use_ in a package.

Value

a named list of functions

Author(s)

Barry Rowlingson


wrap_all

Description

wrap functions with project

Usage

wrap_all(fs)

Arguments

fs

a named list of functions

Details

transforms a named list of functions to a named list of wrapped functions

Value

a named list of wrapped functions

Author(s)

Barry Rowlingson