embark-area-51/lib/versions/library_manager.js
2017-12-30 15:52:51 -05:00

38 lines
948 B
JavaScript

class LibraryManager {
constructor(options) {
this.plugins = options.plugins;
this.config = options.config;
this.contractsConfig = this.config.contractsConfig;
this.embark = this.plugins.createPlugin('libraryManager', {});
this.registerCommands();
}
registerCommands() {
const self = this;
this.embark.registerConsoleCommand((cmd, _options) => {
if (cmd === "versions") {
let solcVersionInConfig = self.contractsConfig.versions.solc;
let web3VersionInConfig = self.contractsConfig.versions["web3.js"];
let ipfsApiVersion = require('../../package.json').dependencies["ipfs-api"];
let text = [
'versions in use:',
'solc: ' + solcVersionInConfig,
'web3.js: ' + web3VersionInConfig,
'ipfs-api: ' + ipfsApiVersion
];
return text.join('\n');
}
return false;
});
}
}
module.exports = LibraryManager;