PackageManager

The PackageManager can retrieve present packages and get / remove packages.

class PackageManager {}

Constructors

this
this(NativePath path)

Instantiate an instance with a single search path

this
this(NativePath package_path, NativePath user_path, NativePath system_path, bool refresh_packages)
Undocumented in source.

Members

Aliases

Hash
alias Hash = ubyte[]
Undocumented in source.
IterateDirDg
alias IterateDirDg = int delegate(scope int delegate(ref FileInfo))

Used for dependency injection

Functions

addLocalPackage
Package addLocalPackage(NativePath path, string verName, PlacementLocation type)
Undocumented in source. Be warned that the author may not have intended to support it.
addOverride
deprecated void addOverride(PlacementLocation scope_, string package_, Dependency version_spec, Version target)
deprecated void addOverride(PlacementLocation scope_, string package_, Dependency version_spec, NativePath target)

Adds a new override for the given package.

addOverride_
void addOverride_(PlacementLocation scope_, string package_, VersionRange source, Version target)
Undocumented in source. Be warned that the author may not have intended to support it.
addOverride_
void addOverride_(PlacementLocation scope_, string package_, VersionRange source, NativePath target)
Undocumented in source. Be warned that the author may not have intended to support it.
addPackages
void addPackages(Package[] dst_repos, Package pack)

Adds the package and scans for sub-packages.

addSearchPath
void addSearchPath(NativePath path, PlacementLocation type)

For the given type add another path where packages will be looked up.

ensureDirectory
void ensureDirectory(NativePath path)

Used for dependency injection

existsDirectory
bool existsDirectory(NativePath path)
existsFile
bool existsFile(NativePath path)

Used for dependency injection

findPackageFile
NativePath findPackageFile(NativePath directory)

Searches the given directory for package recipe files.

getBestPackage
deprecated Package getBestPackage(string name, Version vers)
Package getBestPackage(PackageName name, Version vers)
deprecated Package getBestPackage(string name, VersionRange range)
Package getBestPackage(PackageName name, VersionRange range)
deprecated Package getBestPackage(string name, string range)
deprecated Package getBestPackage(string name, Dependency version_spec, bool enable_overrides)

Searches for the latest version of a package matching the version range.

getFirstPackage
deprecated Package getFirstPackage(string name)

Looks up the first package matching the given name.

getLatestPackage
deprecated Package getLatestPackage(string name)

Looks up the latest package matching the given name.

getOrLoadPackage
Package getOrLoadPackage(NativePath path, NativePath recipe_path, bool allow_sub_packages, StrictMode mode)

For a given package path, returns the corresponding package.

getOverrides_
const(PackageOverride_)[] getOverrides_(PlacementLocation scope_)
Undocumented in source. Be warned that the author may not have intended to support it.
getPackage
Package getPackage(PackageName name, Version ver, bool enable_overrides)

Looks up a specific package.

getPackage
deprecated Package getPackage(string name, Version ver, bool enable_overrides)
Undocumented in source. Be warned that the author may not have intended to support it.
getPackage
deprecated Package getPackage(string name, string ver, bool enable_overrides)
deprecated Package getPackage(string name, Version ver, NativePath path)
deprecated Package getPackage(string name, Version ver, PlacementLocation loc)
Package getPackage(PackageName name, Version ver, PlacementLocation loc)
deprecated Package getPackage(string name, string ver, NativePath path)
deprecated Package getPackage(string name, NativePath path)

Looks up a specific package.

getPackageIterator
int delegate(int delegate(ref Package)) getPackageIterator()

Enables iteration over all known local packages.

getPackageIterator
int delegate(int delegate(ref Package)) getPackageIterator(string name)

Enables iteration over all known local packages with a certain name.

getPackagePath
NativePath getPackagePath(PlacementLocation base, PackageName name, string vers)

Get the final destination a specific package needs to be stored in.

getSubPackage
Package getSubPackage(Package base_package, string sub_name, bool silent_fail)

Gets the a specific sub package.

gitClone
bool gitClone(string remote, string gitref, NativePath dest)

Perform a git clone operation at dest using repo

hashPackage
Hash hashPackage(Package pack)

Generates a hash digest for a given package. Some files or folders are ignored during the generation (like .dub and .svn folders)

isManagedPackage
bool isManagedPackage(const(Package) pack)

Determines if a package is managed by DUB.

isManagedPath
bool isManagedPath(NativePath path)

Determines if a specific path is within a DUB managed package folder.

iterateDirectory
IterateDirDg iterateDirectory(NativePath path)

Used for dependency injection

load
Package load(NativePath path, NativePath recipe, Package parent, string version_, StrictMode mode)

Loads a Package from the filesystem

loadSCMPackage
Package loadSCMPackage(PackageName name, Repository repo)

For a given SCM repository, returns the corresponding package.

loadSCMPackage
deprecated Package loadSCMPackage(string name, Dependency dependency)
Undocumented in source.
loadSCMPackage
deprecated Package loadSCMPackage(string name, Repository repo)
Undocumented in source. Be warned that the author may not have intended to support it.
lookup
Package lookup(PackageName name, Version vers)

Looks up a package, first in the list of loaded packages, then directly on the file system.

readText
string readText(NativePath path)

Used for dependency injection

refresh
deprecated void refresh(bool refresh)
Undocumented in source. Be warned that the author may not have intended to support it.
refresh
void refresh()
Undocumented in source. Be warned that the author may not have intended to support it.
remove
void remove(Package pack)

Removes the given the package.

remove
deprecated void remove(Package pack, bool force_remove)

Compatibility overload. Use the version without a force_remove argument instead.

removeFile
void removeFile(NativePath path)

Used for dependency injection

removeLocalPackage
void removeLocalPackage(NativePath path, PlacementLocation type)
Undocumented in source. Be warned that the author may not have intended to support it.
removeOverride
deprecated void removeOverride(PlacementLocation scope_, string package_, Dependency version_spec)

Removes an existing package override.

removeOverride_
void removeOverride_(PlacementLocation scope_, string package_, VersionRange src)
Undocumented in source. Be warned that the author may not have intended to support it.
removeSearchPath
void removeSearchPath(NativePath path, PlacementLocation type)

Removes a search path from the given type.

setAttributes
void setAttributes(NativePath path, uint attributes)
setTimes
void setTimes(NativePath path, SysTime accessTime, SysTime modificationTime)

Used for dependency injection

store
deprecated Package store(NativePath src, PlacementLocation dest, string name, Version vers)
Package store(NativePath src, PlacementLocation dest, PackageName name, Version vers)
Package store(ubyte[] data, PlacementLocation dest, PackageName name, Version vers)

Store a zip file stored at src into a managed location destination

storeFetchedPackage
deprecated Package storeFetchedPackage(NativePath zip_file_path, Json package_info, NativePath destination)
Undocumented in source. Be warned that the author may not have intended to support it.
writeFile
void writeFile(NativePath path, const(ubyte)[] data)
void writeFile(NativePath path, const(char)[] data)

Used for dependency injection

writeSelections
void writeSelections(Package project, Selections!1 selections, bool overwrite)

Writes the selections file (dub.selections.json)

Properties

completeSearchPath
deprecated const(NativePath)[] completeSearchPath [@property getter]

Returns the effective list of search paths, including default ones.

customCachePaths
NativePath[] customCachePaths [@property setter]

Sets additional (read-only) package cache paths to search for packages.

searchPath
NativePath[] searchPath [@property setter]
const(NativePath)[] searchPath [@property getter]

Gets/sets the list of paths to search for local packages.

Static functions

selectionsToJSON
Json selectionsToJSON(Selections!1 s)

Package function to avoid code duplication with deprecated SelectedVersions.save, merge with writeSelections in the future.

selectionsToString
string selectionsToString(Selections!1 s)

Package function to avoid code duplication with deprecated SelectedVersions.save, merge with writeSelections in the future.

Variables

m_initialized
bool m_initialized;

Whether refresh has been called or not

m_internal
Location m_internal;

The 'internal' location, for packages not attributable to a location.

m_repositories
Location[] m_repositories;

List of locations that are managed by this PackageManager

Meta