summaryrefslogtreecommitdiffstats
path: root/lib/models/pluginDependency.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-05-27 11:10:39 +0200
committerSamy Pessé <samypesse@gmail.com>2016-05-27 11:10:39 +0200
commitccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d (patch)
treef1330211ce466d01ac1947375e6bd04272e279b3 /lib/models/pluginDependency.js
parente2e0ca3f0585ab245bae91c7a48178454fe96a44 (diff)
downloadgitbook-ccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d.zip
gitbook-ccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d.tar.gz
gitbook-ccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d.tar.bz2
Add unit tests for installPlugin
Diffstat (limited to 'lib/models/pluginDependency.js')
-rw-r--r--lib/models/pluginDependency.js20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/models/pluginDependency.js b/lib/models/pluginDependency.js
index e5deef0..f668013 100644
--- a/lib/models/pluginDependency.js
+++ b/lib/models/pluginDependency.js
@@ -2,6 +2,7 @@ var is = require('is');
var semver = require('semver');
var Immutable = require('immutable');
+var PREFIX = require('../constants/pluginPrefix');
var DEFAULT_VERSION = '*';
/*
@@ -31,6 +32,15 @@ PluginDependency.prototype.isEnabled = function() {
};
/**
+ Return NPM ID for the dependency
+
+ @return {String}
+*/
+PluginDependency.prototype.getNpmID = function() {
+ return PluginDependency.nameToNpmID(this.getName());
+};
+
+/**
Is the plugin using a git dependency
@return {Boolean}
@@ -140,4 +150,14 @@ PluginDependency.listToArray = function(list) {
.toJS();
};
+/**
+ Return NPM id for a plugin name
+
+ @param {String}
+ @return {String}
+*/
+PluginDependency.nameToNpmID = function(s) {
+ return PREFIX + s;
+};
+
module.exports = PluginDependency;