Closed ghost closed 6 years ago
Locate the relevant box.js
file, for example:
P:\sand\truffle\dependencies\truffle-core\node_modules\truffle-box\box.js
Replace unbox/sanbox code with this one:
unbox: function(sourceDir, destination, options) {
options = options || {};
options.logger = options.logger || {log: function() {}}
return Promise.resolve()
.then(function() {
options.logger.log("Copy " + sourceDir + ' ==> ' + destination);
//return utils.downloadBox(url, destination)
var unbox = require('./lib/utils/unbox');
return unbox.copyTempIntoDestination(sourceDir, destination);
})
.then(function() {
options.logger.log("Unpacking...");
return utils.unpackBox(destination);
})
.then(function(boxConfig) {
options.logger.log("Setting up...");
return utils.setupBox(boxConfig, destination)
})
.then(function(boxConfig) {
return boxConfig;
});
},
sandbox: function(name, callback) {
var self = this;
if (typeof name === "function") {
callback = name;
name = "default";
}
tmp.dir(function(err, dir, cleanupCallback) {
if (err) {
return callback(err);
}
self.unbox("../truffle-init-" + name, dir)
.then(function() {
var config = Config.load(path.join(dir, "truffle.js"), {});
callback(null, config);
})
.catch(callback);
});
}
Get a local copy of the truffle-init-default
cd truffle\dependencies
git clone https://github.com/trufflesuite/truffle-init-default.git
run the truffle-core test as usual, no changes needed.
follow-up: #117
Box.sandbox() is directly coupled to github, the "boxes" (project templates) are downloaded from there.
It should be possibly to load boxes from the local file-system (e.g. offline-work, test-sequences etc.).
This should be either implemented directly into truffle-box, or as a quick workaround for the current problems within #87.