refactor(@embark/cmd-controller): re add cargo for file watcher (#1857)

This commit is contained in:
Jonathan Rainville 2019-09-03 14:03:29 -04:00 committed by Iuri Matias
parent 230fe592a6
commit 58ad62f32b
3 changed files with 8 additions and 1 deletions

View File

@ -80,7 +80,7 @@ export default class DeploymentChecks {
catch (err) {
return cb(err);
}
if (codeInChain.length > 3) { // it is "0x" or "0x0" for empty code, depending on web3 version
if (codeInChain.length > 3 && codeInChain.substring(2) === contract.runtimeBytecode) { // it is "0x" or "0x0" for empty code, depending on web3 version
contract.deployedAddress = trackedContract.address;
contract.log(contract.className.bold.cyan + __(" already deployed at ").green + contract.deployedAddress.bold.cyan);
params.shouldDeploy = false;

View File

@ -164,6 +164,8 @@ describe('embark.deploymentChecks', function () {
});
});
it("should not deploy if contract is tracked, but bytecode exists on chain", async function () {
trackingFunctions._web3.eth.getCode = () => "0x0123";
params.contract.runtimeBytecode = '0123';
return deploymentChecks.checkIfAlreadyDeployed(params, (err, params) => {
expect(err).to.be(null);
expect(params.shouldDeploy).to.be(false);
@ -180,6 +182,8 @@ describe('embark.deploymentChecks', function () {
it("should update tracked contract in chains.json when contract.track !== false", async function () {
const trackAndSaveContract = sinon.stub(trackingFunctions, "trackAndSaveContract");
const {contract} = params;
trackingFunctions._web3.eth.getCode = () => "0x0123";
params.contract.runtimeBytecode = '0123';
return deploymentChecks.checkIfAlreadyDeployed(params, (err, params) => {
expect(err).to.be(null);
expect(params.shouldDeploy).to.be(false);

View File

@ -3,6 +3,7 @@ let SolcW = require('./solcW.js');
const path = require('path');
import { __ } from 'embark-i18n';
import {normalizePath} from 'embark-utils';
const cloneDeep = require('lodash.clonedeep');
class Solidity {
@ -197,6 +198,8 @@ class Solidity {
let input = {};
let originalFilepath = {};
contractFiles = cloneDeep(contractFiles);
async.waterfall([
function prepareInput(callback) {
async.each(contractFiles,