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