EnvironmentMigrators.EnvironmentMigrators
— ModuleWelcome to EnvironmentMigrators.jl.
Use EnvironmentMigrators.wizard()
for interactive use.
High level interface (unexported)
list_shared_environments([depot])
select_shared_environments([depot])
backup_current_environment(; fileaction = cp)
migrate_selected_environment(selected_environment; backup = true)
migrate_current_environment_to(path)
wizard([depot])
Exported types
SimpleEnvironmentMigrator
SimpleBackupOnlyEnvironmentMigrator
Exported methods
migrate(m::EnvironmentMigrators.AbstractEnvironmentMigrator)
backup(m::EnvironmentMigrators.AbstractEnvironmentMigrator)
EnvironmentMigrators.AbstractEnvironmentMigrator
— TypeAbstractEnvironmentMigrator
Base abstract type for EnvironmentMigrators.
Interface:
source_project_toml(m::AbstractEnvironmentMigrator)
- return path of (Julia)Project.toml to copy from or
nothing
if there is no source
- return path of (Julia)Project.toml to copy from or
source_manifest_toml(m::AbstractEnvironmentMigrator)
- return path of (Julia)Manifest.toml to copy from or
nothing
if there is no source
- return path of (Julia)Manifest.toml to copy from or
target_project_toml(m::AbstractEnvironmentMigrator)
- return path of (Julia)Project.toml to backup and to which to copy
target_manifest_toml(m::AbstractEnvironmentMigrator)
- return path of (Julia)Manifest.toml to backup and to which to copy
fileaction(m::AbstractEnvironmentMigrator)
- action to take during backup operations
backup(m::AbstractEnvironmentMigrator)
- save a copy of the target environment in a timestamped subfolder
migrate(m::AbstractEnvironmentMigrator; backup = true, update = true)
- migrate project and manifest files from source to target
Subtypes:
SimpleEnvironmentMigrator
- set source and target project and manifest files as fields
SimpleBackupOnlyEnvironmentMigrator
- set target project and manifest files as fields
EnvironmentMigrators.SimpleBackupOnlyEnvironmentMigrator
— TypeSimpleBackupOnlyEnvironmentMigrator{F}([target_project_toml, target_manifest_toml], fileaction::F)
AbstractEnvironmentMigrator
only for backing up the target project and manifest tomls to a timestamped folder. The target project and manifest tomls will default to the current project and manifest tomls.
EnvironmentMigrators.SimpleEnvironmentMigrator
— TypeSimpleEnvironmentMigrator([source_project_toml, source_target_toml], [target_project_toml, target_manifest_toml])
An AbstractEnvironmentMigrator
where one can set source and target project and manifest files as fields. If source_project_toml
and source_manifest_toml
are not specified, they will be nothing
. If target_project_toml
and target_manifest_toml
are not specified, they will be set to the current environment.
Fields
source_project_toml
source_manifest_toml
target_project_toml
target_manifest_toml
Method details
fileaction(m)
will return cp
if source_project_toml
is nothing
or mv
otherwise.
EnvironmentMigrators.backup
— Methodbackup(m::AbstractEnvironmentMigrator)
Backup an environment. Typically, this involves copying the Project.toml and Manifest.toml to a time-stamped backup subfolder.
Extended Help
The standard backup procedure is as follows.
- Check that the target project and manifest TOMLs are in the same directory.
- Check that one of either the project or manifest TOMLs exist
- Create a time stamp in the format "yyyy-mm-ddHHMM_SS
- Create a subpath in the same directory as the project TOML called
backups/[timestamp]
- Copy (or move) the project and manifest TOMLs to the backup path if they exist.
EnvironmentMigrators.backup_current_environment
— Methodbackup_current_environments([depot]; fileaction=cp)
Backup the Project.toml and Manifest.toml to backups/timestamp
where timestamp = Dates.format(Dates.now(), "yyyy-mm-dd_HH_MM_SS")
`.
fileaction
is a keyword parameter for a function that accepts two parameters. fileaction
defaults to cp
for copy. An alternative is mv
for move. depot
defaults to first(DEPOT_PATH)
.
EnvironmentMigrators.get_current_project_and_manifest
— Methodget_current_project_and_manifest()
Return the current project and manifest TOML files.
Implementation details
Base.active_project()
is used to determine the location the current (Julia)Project.toml- JuliaManifest.toml takes precedent over Manifest.toml in the same directory as the Project.toml
EnvironmentMigrators.list_shared_environments
— Functionlist_shared_environments([depot])
List the top level shared environments in /juliateam/.julia/environments. depot
defaults to first(DEPOT_PATH)
.
EnvironmentMigrators.migrate
— Methodmigrate(m::AbstractEnvironmentMigrator; backup = true, update = true)
Move an environment from one place to another. backup
- whether to perform a backup of the target environment (true
) or not (false
). update
- whether to perform an update of the source environment (true
) or not (false
).
Extended Help
The typical migration procedure is as follows.
- Backup the target environment by moving the files if indicated.
- Copy the (Julia)Project.toml from the source to the target environment.
- Copy the (Julia)Manifest.toml from the source to the target environment.
- Activate the target environment
Pkg.status()
Pkg.upgrade_manifest()
- skip if errorPkg.resolve()
Pkg.instantiate()
Pkg.status()
Pkg.update()
EnvironmentMigrators.migrate_current_environment_to
— Methodmigrate_current_environment_to(path::AbstractString)
Migrate the current environment to the indicated path.
EnvironmentMigrators.migrate_selected_environment
— Methodmigrate_selected_environment(selected_env)
Migrate the selected environment specified as a directory in selected_env to the current active project.
selected_env
should be the absolute path to an environment directory.
EnvironmentMigrators.select_shared_environments
— Functionselect_shared_environments([depot])
Present an interactive menu to select a shared environment to copy from. Also provide options to select the current enviornment for backup or quit. depot
defaults to first(DEPOT_PATH)
.
EnvironmentMigrators.wizard
— Functionwizard([depot])
Run an interactive terminal based wizard.
depot
defaults to first(DEPOT_PATH)
.