Class: Extensions

Extensions

new Extensions()

A module that represents a extension manager.

Author:
  • Yaw Joseph Etse
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
options object

ext_default_config_file_path - ext conf files,ext_installed_config_file_path - destination for ext conf files,missingExtConfFiles array of missing files

callback function

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
options object

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
options object

ext_default_config_file_path - ext conf files,ext_installed_config_file_path - destination for ext conf files

callback function

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
options object

dirname

callback function

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
options object

configdir - default config files, extconfigdir - install directory of config files

callback function

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
options object

extname,movebefore - this is the name of the extension you want to move it before

callback function

async callback

Source:
Returns:

async callback

Type
function

removeConfigFiles(options, callback) → {function}

remove an extensions config files

Parameters:
Name Type Description
options object

contains path to ext files in content/config directory

callback function

async callback

Source:
Returns:

async callback(err,status)

Type
function

removeExtFromConf(options, callback) → {function}

remove extension from extensions.json

Parameters:
Name Type Description
options object

extname,currentExtensionsConfJson

callback function

async callback

Source:
Returns:

async callback(err,status)

Type
function

removePublicFiles(options, callback) → {function}

remove an extensions public files

Parameters:
Name Type Description
options object

contains path to ext files in public directory

callback function

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
options object

logfile,extpackfile - package.json for ext, extconffile - periodicjs.ext.json, enabled - set the enabled status

callback function

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
options object

dirname,removepublicdir,removeconfigdir

callback function

async callback

Source:
Returns:

callback(err,results)

Type
function

updateExtConfFile(options, callback) → {function}

updates extensions.json with extToAdd

Parameters:
Name Type Description
options object

currentExtensions - current ext conf, extToAdd - extension to add

callback function

async callback

Source:
Returns:

async callback

Type
function