lucee.Componentcommandbox.system.services.PackageService
Copyright Since 2014 CommandBox by Ortus Solutions, Corp www.coldbox.org | www.ortussolutions.com I handle working with the box.json file
Property Summary | ||||
---|---|---|---|---|
type | property | default | serializable | required |
any
|
CR
|
true
|
false
|
|
any
|
JSONService
|
true
|
false
|
|
any
|
artifactService
|
true
|
false
|
|
any
|
consoleLogger
|
true
|
false
|
|
any
|
endpointService
|
true
|
false
|
|
any
|
fileSystemUtil
|
true
|
false
|
|
any
|
formatterUtil
|
true
|
false
|
|
any
|
interceptorService
|
true
|
false
|
|
any
|
javaService
|
true
|
false
|
|
any
|
logger
|
true
|
false
|
|
any
|
pathPatternMatcher
|
true
|
false
|
|
any
|
semanticVersion
|
true
|
false
|
|
any
|
serverService
|
true
|
false
|
|
any
|
shell
|
true
|
false
|
|
any
|
systemSettings
|
true
|
false
|
|
any
|
tempDir
|
true
|
false
|
|
any
|
wirebox
|
true
|
false
|
Constructor Summary | |
---|---|
init()
Constructor. |
Method Summary | |
---|---|
any
|
addDependency(string currentWorkingDirectory, string packageName, string version, [string installDirectory=''], [boolean installDirectoryIsDedicated='true'], [boolean dev='false'], [struct endpointData])
Adds a dependency to a packge. |
private any
|
buildChildren(struct boxJSON, struct parent, string basePath, [any depth='0'], [any currentlevel])
|
any
|
buildDependencyHierarchy(any directory, [any depth='0'])
Builds a struct of structs that represents the dependency hierarchy. |
any
|
completeProperty(any directory, [any all='false'], [any asSet='false'])
Dynamic completion for property name based on contents of box. |
any
|
findPackageRoot([any packagePath])
|
string
|
getArtifactService()
|
string
|
getCR()
|
string
|
getConsoleLogger()
|
any
|
getDescriptorPath(string directory)
Returns the path to the package descriptor. |
string
|
getEndpointService()
|
string
|
getFileSystemUtil()
|
string
|
getFormatterUtil()
|
string
|
getInterceptorService()
|
string
|
getJSONService()
|
string
|
getJavaService()
|
string
|
getLogger()
|
array
|
getOutdatedDependencies(any directory, any print, [boolean verbose='false'], [any includeSlugs=''])
Return an array of all outdated depdendencies in a project. |
string
|
getPathPatternMatcher()
|
string
|
getSemanticVersion()
|
string
|
getServerService()
|
string
|
getShell()
|
string
|
getSystemSettings()
|
string
|
getTempDir()
|
string
|
getWirebox()
|
boolean
|
installPackage(string ID, [string directory], [boolean save='false'], [boolean saveDev='false'], [boolean production], [string currentWorkingDirectory='[runtime expression]'], [boolean verbose='false'], [boolean force='false'], [string packagePathRequestingInstallation='[runtime expression]'], [string defaultName=''])
Installs a package and its dependencies, obeying ignors in the box. |
any
|
isPackage(string directory)
Checks to see if a box. |
any
|
isPackageModule(string packageType)
|
any
|
newPackageDescriptor([struct defaults='[runtime expression]'], [boolean omitDeprecated='false'])
Get the default package description, AKA box. |
private any
|
parseSlug(string package)
Parses just the slug portion out of an endpoint ID. |
private any
|
parseVersion(string package)
Parses just the version portion out of an endpoint ID. |
private any
|
processDependencies([any dependencies], [any installPaths], [any dev='false'], [any basePath], [any depth='0'], [any currentlevel])
|
struct
|
readPackageDescriptor(any directory, [boolean expandSystemSettings='true'])
Get the box. |
struct
|
readPackageDescriptorRaw(any directory)
Get the box. |
struct
|
readPackageDescriptorTemplate(any directory)
Does everything readPackageDescriptor() does, but won't default deprecated box. |
any
|
removeDependency(string directory, string packageName)
Removes a dependency from a packge if it exists. |
any
|
runScript(string scriptName, [string directory='[runtime expression]'], [boolean ignoreMissing='true'], [any interceptData='[runtime expression]'])
Nice wrapper to run a package script. |
any
|
setArtifactService(any artifactService)
|
any
|
setCR(any CR)
|
any
|
setConsoleLogger(any consoleLogger)
|
any
|
setEndpointService(any endpointService)
|
any
|
setFileSystemUtil(any fileSystemUtil)
|
any
|
setFormatterUtil(any formatterUtil)
|
any
|
setInterceptorService(any interceptorService)
|
any
|
setJSONService(any JSONService)
|
any
|
setJavaService(any javaService)
|
any
|
setLogger(any logger)
|
any
|
setPathPatternMatcher(any pathPatternMatcher)
|
any
|
setSemanticVersion(any semanticVersion)
|
any
|
setServerService(any serverService)
|
any
|
setShell(any shell)
|
any
|
setSystemSettings(any systemSettings)
|
any
|
setTempDir(any tempDir)
|
any
|
setWirebox(any wirebox)
|
any
|
uninstallPackage(string ID, [string directory], [boolean save='false'], string currentWorkingDirectory, [string packagePathRequestingUninstallation='[runtime expression]'], [boolean verbose='false'])
Uninstalls a package and its dependencies. |
any
|
writePackageDescriptor(any JSONData, any directory)
Write the box. |
Methods inherited from class lucee.Component |
---|
None |
Constructor Detail |
---|
Constructor
Property Detail |
---|
access
- publicrequired
- falsereturntype
- anyinject
- CR@constantsserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- JSONServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- ArtifactServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- logbox:logger:consoleserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- EndpointServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- FileSystemserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- formatterserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- interceptorServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- provider:JavaServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- logbox:logger:{this}serializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- provider:pathPatternMatcher@globberserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- provider:semanticVersion@semverserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- serverServiceserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- Shellserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- SystemSettingsserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- tempDir@constantsserializable
- trueaccess
- publicrequired
- falsereturntype
- anyinject
- wireboxserializable
- trueMethod Detail |
---|
Adds a dependency to a packge
currentWorkingDirectory
- The directory that is the root of the packagepackageName
- Package to add a a dependencyversion
- Version of the dependencyinstallDirectory
- The location that the package is installed to including the container folder.installDirectoryIsDedicated
- True if the package was placed in a dedicated folderdev
- True if this is a development dependency, false if it is a production dependencyendpointData
boxJSON
parent
basePath
depth
currentlevel
Builds a struct of structs that represents the dependency hierarchy
directory
- The directory of the package to start indepth
- how deep to climb down the rabbit hole. A value of 0 means infinite depthDynamic completion for property name based on contents of box.json
directory
- The package rootall
- Pass false to ONLY suggest existing property names. True will suggest all possible box.json properties.asSet
- Pass true to add = to the end of the optionspackagePath
Returns the path to the package descriptor
directory
- The directory that is the root of the packageReturn an array of all outdated depdendencies in a project.
directory
- The directory of the package to start inprint
- The print buffer used for command operationverbose
- Outputs additional information about each package as it is checkedincludeSlugs
- A commit-delimited list of slugs to include. Empty means include everything.Installs a package and its dependencies, obeying ignors in the box.json file. Returns a struct containing a "copied" array and an "ignored" array containing the relative paths inside the package that were copied and ignored.
ID
directory
- The directory to install in. This will override the packages's box.json install dir if provided.save
- Save the installed package as a dependancy in box.json (if it exists)saveDev
- Save the installed package as a dev dependancy in box.json (if it exists)production
- When calling this command with no slug to install all dependencies, set this to true to ignore devDependencies.currentWorkingDirectory
- Root of the application (used for finding box.json)verbose
- If set, it will produce much more verbose information about the package installationforce
- When set to true, it will force dependencies to be installed whether they already exist or notpackagePathRequestingInstallation
- If installing smart dependencies packages (like ColdBox modules) that are capable of being nested, this is our current leveldefaultName
Checks to see if a box.json exists in a given directory
directory
- The directory to examinepackageType
Get the default package description, AKA box.json
defaults
- A struct of default values to be merged into the empty, default documentomitDeprecated
Parses just the slug portion out of an endpoint ID
package
- The full endpointID like foo@1.0.0Parses just the version portion out of an endpoint ID
package
- The full endpointID like foo@1.0.0dependencies
installPaths
dev
basePath
depth
currentlevel
Get the box.json as data from the passed directory location. Any missing properties will be defaulted with our box.json template. If you plan on writing the box.json back out to disk, use readPackageDescriptorRaw() instead. If you ask for system settings to be swapped out, do not write this box.json back to disk. It's has possibly been modified to expand the props like ${foo} and will overwrite the actual place holders
directory
- The directory to search for the box.jsonexpandSystemSettings
Get the box.json as data from the passed directory location, if not found then we return an empty struct. This method will NOT default box.json properties and will return JUST what was defined. Make sure you use existence checks when using the returned data structure
directory
- The directory to search for the box.jsonDoes everything readPackageDescriptor() does, but won't default deprecated box.json proprties.
directory
- The directory to search for the box.jsonRemoves a dependency from a packge if it exists
directory
- The directory that is the root of the packagepackageName
- Package to add a a dependencyNice wrapper to run a package script
scriptName
- Name of the package script to rundirectory
- The package rootignoreMissing
- Set true to ignore missing package scripts, false to throw an exceptioninterceptData
- An optional struct of data if this package script is being fired as part of an interceptor announcement. Will be loaded into env varsartifactService
CR
consoleLogger
endpointService
fileSystemUtil
formatterUtil
interceptorService
JSONService
javaService
logger
pathPatternMatcher
semanticVersion
serverService
shell
systemSettings
tempDir
wirebox
Uninstalls a package and its dependencies
ID
- Identifier of the packge to uninstall.directory
- The directory to install in. This will override the packages's box.json install dir if provided.save
- Remove package as a dependancy in box.json (if it exists)currentWorkingDirectory
- Root of the application (used for finding box.json)packagePathRequestingUninstallation
verbose
Write the box.json data as a JSON file
JSONData
- The JSON data to write to the file. Can be a struct, or the string JSONdirectory
- The directory to write the box.json