new Extensions()
A module that represents a extension manager.
- Copyright:
- Copyright (c) 2014 Typesettin. All rights reserved.
- License:
- MIT
- Source:
- To Do:
-
- to do later
Throws:
-
If missing configuration files
- Type
- Error
Requires
- module:fs
- module:util-extent
Members
-
init :Error
-
load extension config file: content/extensions/extensions.json
Type:
- Error
- Source:
-
<inner> extensionsConfig
-
use the existing config file without modifying it
- Source:
Methods
-
copyMissingConfigFiles(options, callback)
-
copy missing files if any are missing
Parameters:
Name Type Description optionsobject ext_default_config_file_path - ext conf files,ext_installed_config_file_path - destination for ext conf files,missingExtConfFiles array of missing files
callbackfunction async callback
- Source:
-
getCurrentExt(options) → {object}
-
Returns the position in array of extensions and data of extension in the extension configuration json file
Parameters:
Name Type Description optionsobject contains, extname name to look up, array of extensions from the extension file
- Source:
Returns:
selectedExt - ext json data,err - error in finding ext in conf,numX - index of ext in conf
- Type
- object
-
getExtensionConfigFiles(options, callback) → {Array}
-
get both installed files, and the default files in ext conf directory, if missin files, add them to missing conf files array
Parameters:
Name Type Description optionsobject ext_default_config_file_path - ext conf files,ext_installed_config_file_path - destination for ext conf files
callbackfunction async.parallel callback
- Source:
Returns:
array of missing conf files
- Type
- Array
-
install(options, callback) → {function}
-
installs extension files to public directory, content directory and inserts into extenions.json
Parameters:
Name Type Description optionsobject dirname
callbackfunction async callback
- Source:
Returns:
callback(err,results)
- Type
- function
-
installConfigDirectory(options, callback) → {function}
-
copy extension config files if they don't exist
Parameters:
Name Type Description optionsobject configdir - default config files, extconfigdir - install directory of config files
callbackfunction async callback
- Source:
Returns:
async callback
- Type
- function
-
moveExtensionBefore(options, callback) → {function}
-
move ext to before specified extension in extension.json extension array
Parameters:
Name Type Description optionsobject extname,movebefore - this is the name of the extension you want to move it before
callbackfunction async callback
- Source:
Returns:
async callback
- Type
- function
-
removeConfigFiles(options, callback) → {function}
-
remove an extensions config files
Parameters:
Name Type Description optionsobject contains path to ext files in content/config directory
callbackfunction async callback
- Source:
Returns:
async callback(err,status)
- Type
- function
-
removeExtFromConf(options, callback) → {function}
-
remove extension from extensions.json
Parameters:
Name Type Description optionsobject extname,currentExtensionsConfJson
callbackfunction async callback
- Source:
Returns:
async callback(err,status)
- Type
- function
-
removePublicFiles(options, callback) → {function}
-
remove an extensions public files
Parameters:
Name Type Description optionsobject contains path to ext files in public directory
callbackfunction async callback
- Source:
Returns:
async callback(err,status)
- Type
- function
-
setExtConf(options, callback) → {function}
-
set the extension JSON to be appended to extensions.json
Parameters:
Name Type Description optionsobject logfile,extpackfile - package.json for ext, extconffile - periodicjs.ext.json, enabled - set the enabled status
callbackfunction async callback
- Source:
Returns:
async callback
- Type
- function
-
settings() → {string}
-
gets the configuration information
- Source:
Returns:
file path for config file
- Type
- string
-
uninstall(options, callback) → {function}
-
removes extension files from public directory, content directory and from extenions.json
Parameters:
Name Type Description optionsobject dirname,removepublicdir,removeconfigdir
callbackfunction async callback
- Source:
Returns:
callback(err,results)
- Type
- function
-
updateExtConfFile(options, callback) → {function}
-
updates extensions.json with extToAdd
Parameters:
Name Type Description optionsobject currentExtensions - current ext conf, extToAdd - extension to add
callbackfunction async callback
- Source:
Returns:
async callback
- Type
- function