Identifies system running and pulls the relevant tarball for the current release of bbi from GitHub, and then installs it in the directory passed to .dir. If used in an interactive session, will open an installation menu confirming the installed version.

use_bbi(.path = NULL, .version = "latest", .force = FALSE, .quiet = FALSE)

Arguments

.path

absolute path to install bbi to. See Details section for defaults, if nothing is passed.

.version

version of bbi to install. Must pass a character scalar corresponding to a tag found in https://github.com/metrumresearchgroup/bbi/releases

.force

If FALSE, the default, skips installation if requested version and local version are the same. If TRUE forces installation if it will be the same version.

.quiet

If TRUE, suppresses output printed to the console. FALSE by default.

Value

character

Details

If nothing is passed to the .path argument, use_bbi() will attempt to find a valid path for installation. The following decision waterfall is used:

  • First, check getOption("bbr.bbi_exe_path"). If this is anything other than "bbi" (the default value) then attempt to install to that path.

  • Second, check Sys.which("bbi") which will look for a bbi installation in the user's $PATH. If one is found, ask the user if they wish to overwrite it and, if they confirm, install to that path.

  • Third, attempt to install to a "default location" and add this location to the user's $PATH. If Sys.getenv("XDG_DATA_HOME") is found, install to {Sys.getenv("XDG_DATA_HOME")}/bbi/bbi (per XGD specification). Otherwise, install to OS dependent defaults:

    • Linux: {Sys.getenv("HOME")}/.local/share/bbi/bbi

    • Mac: /usr/local/bin/bbi

    • Windows: {Sys.getenv("APPDATA")}\bbi\bbi

If none of these are successful, the user will be prompted to set options("bbr.bbi_exe_path") and try again.