use module command to get solc version
This commit is contained in:
parent
c7f8698e58
commit
2f3abc37b7
|
@ -1,7 +1,6 @@
|
|||
let utils = require('../../utils/utils.js');
|
||||
let solcProcess;
|
||||
let compilerLoaded = false;
|
||||
var Npm = require('../../pipeline/npm.js');
|
||||
let currentSolcVersion = require('../../../package.json').dependencies.solc;
|
||||
|
||||
class SolcW {
|
||||
|
@ -27,17 +26,17 @@ class SolcW {
|
|||
|
||||
this.events.request("version:get:solc", function(solcVersion) {
|
||||
self.logger.info("detected version is " + solcVersion);
|
||||
if (self.solcVersion === currentSolcVersion) {
|
||||
if (solcVersion === currentSolcVersion) {
|
||||
solcProcess.send({action: 'loadCompiler', solcLocation: 'solc'});
|
||||
} else {
|
||||
let npm = new Npm({logger: self.logger});
|
||||
npm.getPackageVersion('solc', solcVersion, false, false, function(err, location) {
|
||||
self.events.request("version:getPackage:solc", solcVersion, function(err, location) {
|
||||
if (err) {
|
||||
return done(err);
|
||||
}
|
||||
let requirePath = utils.joinPath(process.env.PWD, location);
|
||||
solcProcess.send({action: 'loadCompiler', solcLocation: requirePath});
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
var Npm = require('../pipeline/npm.js');
|
||||
|
||||
class LibraryManager {
|
||||
|
||||
|
@ -11,7 +12,8 @@ class LibraryManager {
|
|||
this.determineVersions();
|
||||
|
||||
this.registerCommands();
|
||||
this.listenToCommands();
|
||||
this.listenToCommandsToGetVersions();
|
||||
this.listenToCommandsToGetLibrary();
|
||||
}
|
||||
|
||||
determineVersions() {
|
||||
|
@ -40,7 +42,7 @@ class LibraryManager {
|
|||
});
|
||||
}
|
||||
|
||||
listenToCommands() {
|
||||
listenToCommandsToGetVersions() {
|
||||
const self = this;
|
||||
for (let libName in this.versions) {
|
||||
let lib = self.versions[libName];
|
||||
|
@ -50,6 +52,14 @@ class LibraryManager {
|
|||
}
|
||||
}
|
||||
|
||||
listenToCommandsToGetLibrary() {
|
||||
let libName = "solc";
|
||||
let npm = new Npm({logger: this.embark.logger});
|
||||
this.embark.events.setCommandHandler('version:getPackage:' + libName, (version, cb) => {
|
||||
npm.getPackageVersion('solc', version, false, false, cb);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = LibraryManager;
|
||||
|
|
|
@ -14,7 +14,6 @@ var solcVersion = "0.4.17";
|
|||
|
||||
var TestEvents = {
|
||||
request: (cmd, cb) => {
|
||||
console.log("hello!");
|
||||
cb(solcVersion)
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue