summaryrefslogtreecommitdiffstats
path: root/lib/models/plugin.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/plugin.js
parente2e0ca3f0585ab245bae91c7a48178454fe96a44 (diff)
downloadgitbook-ccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d.zip
gitbook-ccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d.tar.gz
gitbook-ccb87d5a13ecf6499d701e1e8ca1f9ed52e21d9d.tar.bz2
Add unit tests for installPlugin
Diffstat (limited to 'lib/models/plugin.js')
-rw-r--r--lib/models/plugin.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/models/plugin.js b/lib/models/plugin.js
index 23019aa..e3d6c4d 100644
--- a/lib/models/plugin.js
+++ b/lib/models/plugin.js
@@ -1,9 +1,10 @@
var Immutable = require('immutable');
var TemplateBlock = require('./templateBlock');
-var PREFIX = require('../constants/pluginPrefix');
var DEFAULT_VERSION = '*';
+var PluginDependency = require('./pluginDependency');
+
var Plugin = Immutable.Record({
name: String(),
@@ -53,7 +54,7 @@ Plugin.prototype.getDepth = function() {
@return {String}
*/
Plugin.prototype.getNpmID = function() {
- return Plugin.nameToNpmID(this.getName());
+ return PluginDependency.nameToNpmID(this.getName());
};
/**
@@ -152,14 +153,6 @@ Plugin.createFromDep = function(dep) {
});
};
-/**
- Return NPM id for a plugin name
-
- @param {String}
- @return {String}
-*/
-Plugin.nameToNpmID = function(s) {
- return PREFIX + s;
-};
+Plugin.nameToNpmID = PluginDependency.nameToNpmID;
module.exports = Plugin;