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

Members

Functions

addOverride
void addOverride(LocalPackageType scope_, string package_, Dependency version_spec, Version target)
void addOverride(LocalPackageType scope_, string package_, Dependency version_spec, NativePath target)

Adds a new override for the given package.

addSearchPath
void addSearchPath(NativePath path, LocalPackageType type)

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

completeSearchPath
const(NativePath)[] completeSearchPath()

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

customCachePaths
void customCachePaths(NativePath[] custom_cache_paths)

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

disableDefaultSearchPaths
void disableDefaultSearchPaths(bool val)

Disables searching DUB's predefined search paths.

getBestPackage
Package getBestPackage(string name, Dependency version_spec, bool enable_overrides = true)
Package getBestPackage(string name, string version_spec)

Searches for the latest version of a package matching the given dependency.

getFirstPackage
Package getFirstPackage(string name)

Looks up the first package matching the given name.

getOrLoadPackage
Package getOrLoadPackage(NativePath path, NativePath recipe_path = NativePath.init, bool allow_sub_packages = false)

For a given package path, returns the corresponding package.

getOverrides
const(PackageOverride)[] getOverrides(LocalPackageType scope_)

Returns a list of all package overrides for the given scope.

getPackage
Package getPackage(string name, Version ver, bool enable_overrides = true)
Package getPackage(string name, string ver, bool enable_overrides = true)
Package getPackage(string name, Version ver, NativePath path)
Package getPackage(string name, string ver, NativePath path)
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.

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

Gets the a specific sub package.

hashPackage
Hash hashPackage(Package pack)

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

isManagedPackage
bool isManagedPackage(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.

remove
void remove(in Package pack)

Removes the given the package.

remove
void remove(in Package pack, bool force_remove)

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

removeOverride
void removeOverride(LocalPackageType scope_, string package_, Dependency version_spec)

Removes an existing package override.

removeSearchPath
void removeSearchPath(NativePath path, LocalPackageType type)

Removes a search path from the given type.

searchPath
void searchPath(NativePath[] paths)
const(NativePath)[] searchPath()

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

storeFetchedPackage
Package storeFetchedPackage(NativePath zip_file_path, Json package_info, NativePath destination)

Extracts the package supplied as a path to it's zip file to the destination and sets a version field in the package description.

Meta