Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions bin/webgme
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env node

var Command = require('commander').Command,
program = new Command(),
version = require('../package.json').version;
const Command = require('commander').Command;
const program = new Command();
const {version} = require('../package.json');

/* * * * * * * * * * Components * * * * * * * * * */
var descs = {
Expand Down
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
"nop": "^1.0.0",
"plural": "^0.1.6",
"q": "^1.4.1",
"ramda": "^0.15.1",
"requirejs": "^2.1.18",
"rimraf": "^2.4.0",
"webgme-engine": "^2.23.0"
Expand Down
5 changes: 1 addition & 4 deletions src/AddonManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';
var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
rm_rf = require('rimraf'),
fs = require('fs'),
Expand Down Expand Up @@ -72,9 +71,7 @@ AddonManager.prototype.new = function(options, callback) {
}

// Get the src, test paths
var setupConfig = R.mapObjIndexed(function(empty, type) {
return `${type}/addons/${name}`;
}, {src: null});
const setupConfig = {src: `src/addons/${name}`};

// Store the addon info in the webgme-setup.json file

Expand Down
5 changes: 2 additions & 3 deletions src/BaseManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ var _ = require('lodash'),
fs = require('fs'),
rm_rf = require('rimraf'),
exists = require('exists-file'),
R = require('ramda'),
mkdir = require('mkdirp'),
Logger = require('./Logger'),
utils = require('./utils'),
Expand Down Expand Up @@ -180,8 +179,8 @@ BaseManager.prototype._createWebGMEFiles = function(project) {
// Config files
fs.mkdirSync(configDir);
fs.readdirSync(path.join(__dirname, 'res', 'config'))
.map(R.pipe(R.nthArg(0), path.join.bind(path, 'config'))) // Add 'config/' for each
.forEach(BaseManager._copyFileToProject.bind(null, project, ''));
.map(filename => path.join('config', filename))
.forEach(path => BaseManager._copyFileToProject(project, '', path));

// Create app.js
BaseManager._copyFileToProject(project, '', 'app.js');
Expand Down
7 changes: 3 additions & 4 deletions src/DecoratorManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';
var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
exists = require('exists-file'),
rm_rf = require('rimraf'),
Expand Down Expand Up @@ -66,9 +65,9 @@ DecoratorManager.prototype.new = function(options, callback) {
}

// Get the src, test paths
var setupConfig = R.mapObjIndexed(function(empty, type) {
return `${type}/decorators/${name}Decorator`;
}, {src: null});
const setupConfig = {
src: `src/decorators/${name}Decorator`
};

// Store the decorator info in the webgme-setup.json file

Expand Down
7 changes: 3 additions & 4 deletions src/LayoutManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';
var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
rm_rf = require('rimraf'),
fs = require('fs'),
Expand Down Expand Up @@ -44,9 +43,9 @@ LayoutManager.prototype.new = function(options, callback) {
}

// Get the src, test paths
var layoutConfig = R.mapObjIndexed(function(empty, type) {
return `${type}/layouts/${options.layoutID}`;
}, {src: null});
const layoutConfig = {
src: `src/layouts/${options.layoutID}`
};

// Store the layout info in the webgme-setup.json file
self._register(options.layoutID, layoutConfig);
Expand Down
7 changes: 3 additions & 4 deletions src/PluginManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';
var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
exists = require('exists-file'),
rm_rf = require('rimraf'),
Expand Down Expand Up @@ -73,9 +72,9 @@ PluginManager.prototype.new = function(options, callback) {
}

// Get the src, test paths
var paths = R.mapObjIndexed(function(empty, type) {
return `${type}/plugins/${config.pluginID}`;
}, {src: null, test: null});
const paths = _.fromPairs(
['src', 'test'].map(type => [type, `${type}/plugins/${config.pluginID}`])
);

// Store the plugin info in the webgme-setup.json file
var pluginConfig = {
Expand Down
1 change: 0 additions & 1 deletion src/RouterManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

'use strict';
var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
exists = require('exists-file'),
rm_rf = require('rimraf'),
Expand Down
7 changes: 3 additions & 4 deletions src/VisualizerManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

'use strict';
var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
rm_rf = require('rimraf'),
fs = require('fs'),
Expand Down Expand Up @@ -50,9 +49,9 @@ VisualizerManager.prototype.new = function(options, callback) {
}

// Get the src, test paths
var paths = R.mapObjIndexed(function(empty, type) {
return `src/visualizers/${type}s/${id}`;
}, {widget: null, panel: null});
const paths = _.fromPairs(
['widget', 'panel'].map(type => [type, `src/visualizers/${type}s/${id}`])
);

// Store the visualizer info in the webgme-setup.json file

Expand Down
3 changes: 1 addition & 2 deletions src/shim/AddonGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

var TEST_FIXTURE_DIR = '../../globals',
_ = require('lodash'),
R = require('ramda'),
path = require('path'),
utils = require('../utils'),
PluginShim = require('./PluginShim'),
Expand Down Expand Up @@ -36,7 +35,7 @@ AddonGenerator.prototype.main = function(callback) {
}

// Fix any file names
R.values(self.blobClient.artifacts).forEach(function(artifact) {
Object.values(self.blobClient.artifacts).forEach(function(artifact) {
artifact.files.forEach(fixFilePath);
artifact.files.forEach(function(file) {
self.logger.info('Saving file at '+file.name);
Expand Down
3 changes: 1 addition & 2 deletions src/shim/DecoratorGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
'use strict';

var _ = require('lodash'),
R = require('ramda'),
utils = require('../utils'),
PluginShim = require('./PluginShim'),
requirejs = require('requirejs'),
Expand Down Expand Up @@ -32,7 +31,7 @@ DecoratorGenerator.prototype.main = function(callback) {
}

// Fix any file names
R.values(self.blobClient.artifacts).forEach(function(artifact) {
Object.values(self.blobClient.artifacts).forEach(function(artifact) {
artifact.files.forEach(fixFilePath);
artifact.files.forEach(function(file) {
self.logger.info('Saving file at '+file.name);
Expand Down
3 changes: 1 addition & 2 deletions src/shim/LayoutGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

var TEST_FIXTURE_DIR = '../../globals',
_ = require('lodash'),
R = require('ramda'),
path = require('path'),
utils = require('../utils'),
PluginShim = require('./PluginShim'),
Expand Down Expand Up @@ -34,7 +33,7 @@ LayoutGenerator.prototype.main = function(callback) {
}

// Fix any file names
R.values(self.blobClient.artifacts).forEach(function(artifact) {
Object.values(self.blobClient.artifacts).forEach(function(artifact) {
artifact.files.forEach(fixFilePath);
// Fix the require path for the unit test
var test = artifact.files.filter(function(file) {
Expand Down
22 changes: 9 additions & 13 deletions src/shim/PluginGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

var TEST_FIXTURE_DIR = '../../globals',
_ = require('lodash'),
R = require('ramda'),
path = require('path'),
utils = require('../utils'),
PluginShim = require('./PluginShim'),
Expand All @@ -26,31 +25,28 @@ var fixFilePath = function(file) {

// Make the src/plugins test/plugins directories as needed
PluginGenerator.prototype.main = function(callback) {
var self = this;
WebGMEPluginGenerator.prototype.main.call(this, function(e, result) {
WebGMEPluginGenerator.prototype.main.call(this, (e, result) => {
if (e) {
self.logger.error(e);
this.logger.error(e);
return callback(e);
}

// Fix any file names
R.values(self.blobClient.artifacts).forEach(function(artifact) {
Object.values(this.blobClient.artifacts).forEach(artifact => {
artifact.files.forEach(fixFilePath);
// Fix the require path for the unit test
var test = artifact.files.filter(function(file) {
return file.name.indexOf('test') === 0;
})[0];
const test = artifact.files
.find(file => file.name.startsWith('test'));
if (test) { // If they are generating test file
self.fixFixturePath(test);
this.fixFixturePath(test);
}

artifact.files.forEach(function(file) {
self.logger.info('Saving file at '+file.name);
});
artifact.files
.forEach(file => this.logger.info(`Saving file at ${file.name}`));
});

// Save all BlobClient Artifacts to the fs
utils.saveFilesFromBlobClient(self.blobClient);
utils.saveFilesFromBlobClient(this.blobClient);
callback();
});
};
Expand Down
5 changes: 1 addition & 4 deletions src/shim/PluginShim.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
var TEST_FIXTURE_DIR = '../../globals',
BlobClient = require('./blobClient'),
_ = require('lodash'),
path = require('path'),
utils = require('../utils'),
R = require('ramda'),
requirejs = require('requirejs');

utils.loadPaths(requirejs);
Expand All @@ -23,8 +21,7 @@ var PluginShim = function(plugin, logger, config) {
this.META = {};
};

_.extend(PluginShim.prototype,
PluginBase.prototype);
_.extend(PluginShim.prototype, PluginBase.prototype);

PluginShim.prototype.initialize = function(logger, blob) {
this.blobClient = blob;
Expand Down
3 changes: 1 addition & 2 deletions src/shim/RouterGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
'use strict';

var _ = require('lodash'),
R = require('ramda'),
utils = require('../utils'),
PluginShim = require('./PluginShim'),
requirejs = require('requirejs'),
Expand Down Expand Up @@ -44,7 +43,7 @@ RouterGenerator.prototype.main = function(callback) {
}

// Fix any file names
R.values(self.blobClient.artifacts).forEach(function(artifact) {
Object.values(self.blobClient.artifacts).forEach(function(artifact) {
artifact.files.forEach(function(file) {
fixFilePath(routerName, file);
self.logger.info('Saving file at '+file.name);
Expand Down
3 changes: 1 addition & 2 deletions src/shim/VisualizerGenerator.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
'use strict';

var _ = require('lodash'),
R = require('ramda'),
path = require('path'),
utils = require('../utils'),
PluginShim = require('./PluginShim'),
Expand Down Expand Up @@ -42,7 +41,7 @@ VisualizerGenerator.prototype.main = function(callback) {
}

// Fix any file names
R.values(self.blobClient.artifacts).forEach(function(artifact) {
Object.values(self.blobClient.artifacts).forEach(function(artifact) {
artifact.files.forEach(self._fixFilePaths.bind(self));

artifact.files.forEach(function(file) {
Expand Down
26 changes: 11 additions & 15 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ var _ = require('lodash'),
fs = require('fs'),
path = require('path'),
exists = require('exists-file'),
assert = require('assert'),
R = require('ramda');
assert = require('assert');

var getRootPath = function(startPath) {
// Walk back from current path until you find a webgme-setup.json file
Expand Down Expand Up @@ -188,11 +187,10 @@ var updateWebGMEConfig = function(startPath) {
* @return {String[]}
*/
var getPathsFromConfigGroup = function(config) {
return R.mapObj(function(componentType) { // ie, plugin/seed/etc OBJECT
return R.values(componentType).map(function(component) {
return component.src || component.path;
});
}, config);
return Object.values(config).map(componentType => // ie, plugin/seed/etc OBJECT
Object.values(componentType)
.map(component => component.src || component.path)
);
};

var unique = function(array) {
Expand All @@ -204,8 +202,7 @@ var unique = function(array) {
};

var getWebGMEConfigContent = function(startPath) {
var arrays,
config = getConfig(startPath),
var config = getConfig(startPath),
paths = {},
categories = ['components', 'dependencies'],
configGroupPaths = categories
Expand All @@ -216,13 +213,12 @@ var getWebGMEConfigContent = function(startPath) {

// Merge the arrays for each componentType
Object.keys(configGroupPaths[0]).forEach(function(type) {
arrays = configGroupPaths.map(function(group) {
// Remove duplicates
return unique(group[type]);
});
const configPaths = _.flatMap(
configGroupPaths,
group => unique(group[type])
);

paths[type] = arrays.reduce(R.concat) // Merge all paths
.map(R.replace.bind(R, /\\/g, '/')); // Convert to use '/' for path separator
paths[type] = configPaths.map(p => p.replace(/\\/g, '/')); // Convert to use '/' for path separator
});

// Update visualizers to use the 'panel' entry (if applicable)
Expand Down
6 changes: 1 addition & 5 deletions test/cli.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const {version} = require('../package.json');
var spawn = require('child_process').spawn,
path = require('path'),
fs = require('fs'),
R = require('ramda'),
assert = require('assert'),
utils = require(__dirname+'/res/utils'),
binPath = path.join(__dirname, '..', 'bin', 'webgme'),
Expand Down Expand Up @@ -148,10 +147,7 @@ describe('cli', function() {
var testFn = function(res, err, done) {
var contents = ['plugin', 'seed'];
assert.equal(res.indexOf('Usage'), -1);
contents.forEach(R.pipe(
res.indexOf.bind(res),
assert.notEqual.bind(assert, -1)
));
contents.forEach(content => assert(res.includes(content)));
done();
};
testCliCall(['ls'], testFn, done);
Expand Down