Internal types

ShareAdd.EnvSetType
struct EnvSet
  • envs::Set{String} - set of environment names
  • extraneous_pks::Set{String} - (internally used, see optim_set function for details)
  • extra_lng::Int - as above
  • no_of_sets::Int - as above
source

Internal functions

ShareAdd.activate_tempMethod
activate_temp()

If current environment is a temporary one, does nothing. Otherwise activates a temporary environment. If the initial environment was a package (under development), makes this package available in the new environment by calling Pkg.develop.

Returns nothing.

source
ShareAdd.check_packagesMethod
check_packages(packages; depot = first(DEPOT_PATH)) -> NamedTuple

checks whether packages are available in the current environment, shared environments, or are installable.

Returns a NamedTuple with the following fields:

  • inpath_pkgs: packages that are already present in some environment in LOAD_PATH
  • inshared_pkgs: packages that are available in some shared environments
  • installable_pkgs: available packages
  • unavailable_pkgs: packages that are not available from any registry
  • shared_pkgs: Dictionary of packages in shared environments
  • current_pr: information about the current environment as @NamedTuple{name::String, shared::Bool}
source
ShareAdd.cleanup_testenvsMethod

Removes folders created in the ~/.julia/environments/ folder during the testing. Used in the test suite, but also on the package startup just for the case the test errored.

source
ShareAdd.delete_shared_envMethod
delete_shared_env(env::Union{AbstractString, EnvInfo}; force = SKIPPING)

Deletes the shared environment env by erasing it's directory. Set force=FORCING if you want to delete the environment even if it is currently in LOAD_PATH.

Returns true, if the environment has been deleted, and false otherwise.

source
ShareAdd.delete_shared_pkgMethod
delete_shared_pkg(pkg::AbstractString; inall, force)
delete_shared_pkg(p::Pair{EnvInfo, <:AbstractString}; force)
delete_shared_pkg(p::Pair{<:AbstractString, <:AbstractString}; force)

Deletes the package pkg from it's shared environment. Deletes this environment if it was the only package there. If the package may be present in multiple environments, and you want to delete it from all of them, set inall=true. Set force=true if you want to delete the package even if it is currently loaded, and it's env, in case it is empty then, even if it is in LOAD_PATH.

Returns NamedTuple (; success, nowempty), where `nowempty` is a flag for the containing environment being now empty.

source
ShareAdd.env_foldersMethod
env_folders(; depot = first(DEPOT_PATH), create=false) -> 
    (; envs_folder, main_env, envs_exist)

Returns a named tuple containing the path to the main folder holding all share environments, the path to the main shared environment, and a boolean indicating whether the main environment folder exists.

If create=true, the main environment folder will be created if it does not exist.

source
ShareAdd.env_pathFunction
env_path(env_name::AbstractString, depot = first(DEPOT_PATH); skipfirstchar = true) -> String

Returns the path of the environment with name env_name. If skipfirstchar is true, the first character of env_name is skipped, so that the name of a shared environment can be passed without the leading @.

source
ShareAdd.list_shared_envsMethod
list_shared_envs() -> Vector{String}
list_shared_envs(pkg_name) -> Vector{String}

Returns the names of all shared environments (if called without an argument), or the environment(s) containing the package pkg_name.

source
ShareAdd.optim_setMethod
optim_set(pks::AbstractArray{<:AbstractString}, envs::AbstractVector{EnvInfo}) -> OptimSet
optim_set(pkgs::AbstractArray{PackageInfo}) -> OptimSet

Finds the optimum set of environments for the given list of packages. Optimal is a set of environments with the least number of extraneous packages. If two sets have the same number of extraneous packages, then the one with the least number of environments is chosen.

The function is internal.

source
ShareAdd.prompt2installMethod
prompt2install(packages::AbstractVector{<:AbstractString})
prompt2install(package::AbstractString)

Prompt user to select a shared environment to install a package or packages.

For a single package, if the user selects an environment, the package will be installed there. If the user selects "A new shared environment (you will be prompted for the name)", the user will be prompted to enter a name for a new environment.

For multiple packages, the function will be called on each package and the user will be prompted for each package.

The function will return a vector of NamedTuples, each with field pkg and env, where pkg is the name of the package and env is the environment where it should be installed.

The function will return nothing if the user selects "Quit. Do Nothing." on any of the prompts.

source
ShareAdd.shared_environments_envinfosMethod
shared_environments_envinfos(; std_lib=false, depot = first(DEPOT_PATH)) -> 
    (; shared_envs::Dict{name, EnvInfo},
    envs_folder_path::String, 
    shared_env_names::Vector{String})
source

Index