This repository has been archived by the owner on Jul 12, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
104 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
module.exports = function (deps) { | ||
var pluginsPath = deps.getPluginPath()() | ||
|
||
return { | ||
listLocal: function() { | ||
return require('./list_local_plugins')(deps) | ||
return require('./list_local_plugins')(pluginsPath) | ||
}, | ||
listRemote: function() { | ||
return require('./list_remote_plugins')(deps) | ||
return require('./list_remote_plugins')(pluginsPath) | ||
}, | ||
createNew: function() { | ||
return require('./create_new_plugin')(deps) | ||
return require('./create_new_plugin')(pluginsPath) | ||
}, | ||
install: function(pluginName, cb) { | ||
require('./install_plugin')(deps)(pluginName, cb) | ||
install: function(name, cb) { | ||
return require('./install_plugin')(pluginsPath)(name, cb) | ||
}, | ||
uninstall: function(pluginName, cb) { | ||
require('./uninstall_plugin')(deps)(pluginName, cb) | ||
uninstall: function(name, cb) { | ||
return require('./uninstall_plugin')(pluginsPath)(name, cb) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,52 @@ | ||
module.exports = function(deps) { | ||
var getPluginPath = deps.getPluginPath() | ||
module.exports = function(pluginsPath) { | ||
var Loader = require('strider-extension-loader') | ||
var loader = new Loader(); | ||
|
||
var path = require('path') | ||
var glob = require('glob') | ||
var _ = require('lodash') | ||
|
||
return { | ||
path: fullPath, | ||
listAll: listAll, | ||
zip: function (plugins) { | ||
return _.zipObject( | ||
_.pluck(plugins, 'name'), | ||
_.map(plugins, function (plugin) { | ||
return { | ||
version: plugin.version, | ||
path: plugin.path | ||
} | ||
}) | ||
) | ||
} | ||
listAllZipped: listAllZipped | ||
} | ||
|
||
function zip(plugins) { | ||
var ids = _.pluck(plugins, 'name') | ||
return _.zipObject(ids, plugins) | ||
} | ||
|
||
function fullPath() { | ||
return getPluginPath()[0] | ||
return pluginsPath[0] | ||
} | ||
|
||
function getPluginFullPaths(cb) { | ||
glob(path.join(fullPath(), 'strider-*'), cb) | ||
function getVersion(pluginPath) { | ||
return require(path.join(pluginPath, 'package.json')).version | ||
} | ||
|
||
function listAll(cb) { | ||
getPluginFullPaths(function (err, plugins) { | ||
var out = [] | ||
plugins.forEach(function (fullPath) { | ||
out.push({ | ||
path: fullPath, | ||
name: path.basename(fullPath), | ||
version: require(path.join(fullPath, 'package.json')).version | ||
}) | ||
}) | ||
cb(err, out); | ||
loader.collectExtensions(pluginsPath, function(err) { | ||
var plugins = [] | ||
var extensions = loader.extensions; | ||
for (var groupName in extensions) { | ||
var group = extensions[groupName] | ||
for (var pluginName in group) { | ||
var plugin = group[pluginName] | ||
plugins.push({ | ||
group: groupName, | ||
name: pluginName, | ||
path: plugin.dir, | ||
version: getVersion(plugin.dir) | ||
}) | ||
} | ||
} | ||
cb(err, plugins); | ||
}) | ||
} | ||
|
||
function listAllZipped(cb) { | ||
listAll(function(err, plugins) { | ||
cb(err, zip(plugins)) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters