fixing package management test
This commit is contained in:
parent
e1a9023bb2
commit
1b6d747dbd
|
@ -1 +0,0 @@
|
|||
{}
|
|
@ -3,6 +3,8 @@
|
|||
let utils = require('../utils/utils.js');
|
||||
let fs = require('../core/fs.js');
|
||||
|
||||
let PluginManager = require('live-plugin-manager').PluginManager;
|
||||
|
||||
class Npm {
|
||||
|
||||
constructor(options) {
|
||||
|
@ -45,7 +47,23 @@ class Npm {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
downloadFromNpm(registryJSON, packageName, version, returnContent, callback) {
|
||||
let packageDirectory = './.embark/versions/' + packageName + '/' + version + '/';
|
||||
|
||||
let manager = new PluginManager({pluginsPath: packageDirectory});
|
||||
|
||||
this.logger.info("downloading " + packageName + " " + version + "....");
|
||||
manager.install(packageName, version).then((result) => {
|
||||
if (returnContent) {
|
||||
callback(null , fs.readFileSync(result.mainFile).toString());
|
||||
} else {
|
||||
callback(null , result.location);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
old_downloadFromNpm(registryJSON, packageName, version, returnContent, callback) {
|
||||
let tarball = registryJSON.dist.tarball;
|
||||
|
||||
let packageDirectory = './.embark/versions/' + packageName + '/' + version + '/';
|
||||
|
@ -79,19 +97,19 @@ class Npm {
|
|||
let npmRegistry = "https://registry.npmjs.org/" + packageName + "/" + version;
|
||||
let packageDirectory = './.embark/versions/' + packageName + '/' + version + '/';
|
||||
|
||||
if (fs.existsSync(packageDirectory) && fs.existsSync(packageDirectory + "package.json")) {
|
||||
let content;
|
||||
if (getFromGit && returnContent) {
|
||||
let distFile = packageDirectory + packageName + ".js";
|
||||
content = fs.readFileSync(distFile).toString();
|
||||
} else if (returnContent) {
|
||||
let distFile = packageDirectory + returnContent;
|
||||
content = fs.readFileSync(distFile).toString();
|
||||
} else {
|
||||
content = packageDirectory;
|
||||
}
|
||||
return callback(null, content);
|
||||
}
|
||||
//if (fs.existsSync(packageDirectory) && fs.existsSync(packageDirectory + "package.json")) {
|
||||
// let content;
|
||||
// if (getFromGit && returnContent) {
|
||||
// let distFile = packageDirectory + packageName + ".js";
|
||||
// content = fs.readFileSync(distFile).toString();
|
||||
// } else if (returnContent) {
|
||||
// let distFile = packageDirectory + returnContent;
|
||||
// content = fs.readFileSync(distFile).toString();
|
||||
// } else {
|
||||
// content = packageDirectory;
|
||||
// }
|
||||
// return callback(null, content);
|
||||
//}
|
||||
|
||||
utils.httpsGet(npmRegistry, function (err, body) {
|
||||
if (err) {
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
"globule": "^1.1.0",
|
||||
"http-shutdown": "^1.2.0",
|
||||
"ipfs-api": "17.2.4",
|
||||
"live-plugin-manager": "^0.11.0",
|
||||
"merge": "^1.2.0",
|
||||
"mocha": "^2.2.5",
|
||||
"orbit-db": "^0.17.3",
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
pragma solidity ^0.4.17;
|
||||
pragma solidity ^0.4.18;
|
||||
contract AnotherStorage {
|
||||
address public simpleStorageAddress;
|
||||
address simpleStorageAddress2;
|
||||
|
|
|
@ -15,8 +15,7 @@
|
|||
"buildDir": "dist/",
|
||||
"config": "config/",
|
||||
"versions": {
|
||||
"solc": "0.4.18",
|
||||
"ipfs-api": "17.2.6"
|
||||
"solc": "0.4.18"
|
||||
},
|
||||
"plugins": {
|
||||
"embark-service": {}
|
||||
|
|
Loading…
Reference in New Issue