mirror of https://github.com/embarklabs/embark.git
refactor(@embark/cmd-controller): re add cargo for file watcher (#1857)
This commit is contained in:
parent
230fe592a6
commit
58ad62f32b
|
@ -80,7 +80,7 @@ export default class DeploymentChecks {
|
||||||
catch (err) {
|
catch (err) {
|
||||||
return cb(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.deployedAddress = trackedContract.address;
|
||||||
contract.log(contract.className.bold.cyan + __(" already deployed at ").green + contract.deployedAddress.bold.cyan);
|
contract.log(contract.className.bold.cyan + __(" already deployed at ").green + contract.deployedAddress.bold.cyan);
|
||||||
params.shouldDeploy = false;
|
params.shouldDeploy = false;
|
||||||
|
|
|
@ -164,6 +164,8 @@ describe('embark.deploymentChecks', function () {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
it("should not deploy if contract is tracked, but bytecode exists on chain", async 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) => {
|
return deploymentChecks.checkIfAlreadyDeployed(params, (err, params) => {
|
||||||
expect(err).to.be(null);
|
expect(err).to.be(null);
|
||||||
expect(params.shouldDeploy).to.be(false);
|
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 () {
|
it("should update tracked contract in chains.json when contract.track !== false", async function () {
|
||||||
const trackAndSaveContract = sinon.stub(trackingFunctions, "trackAndSaveContract");
|
const trackAndSaveContract = sinon.stub(trackingFunctions, "trackAndSaveContract");
|
||||||
const {contract} = params;
|
const {contract} = params;
|
||||||
|
trackingFunctions._web3.eth.getCode = () => "0x0123";
|
||||||
|
params.contract.runtimeBytecode = '0123';
|
||||||
return deploymentChecks.checkIfAlreadyDeployed(params, (err, params) => {
|
return deploymentChecks.checkIfAlreadyDeployed(params, (err, params) => {
|
||||||
expect(err).to.be(null);
|
expect(err).to.be(null);
|
||||||
expect(params.shouldDeploy).to.be(false);
|
expect(params.shouldDeploy).to.be(false);
|
||||||
|
|
|
@ -3,6 +3,7 @@ let SolcW = require('./solcW.js');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
import { __ } from 'embark-i18n';
|
import { __ } from 'embark-i18n';
|
||||||
import {normalizePath} from 'embark-utils';
|
import {normalizePath} from 'embark-utils';
|
||||||
|
const cloneDeep = require('lodash.clonedeep');
|
||||||
|
|
||||||
class Solidity {
|
class Solidity {
|
||||||
|
|
||||||
|
@ -197,6 +198,8 @@ class Solidity {
|
||||||
let input = {};
|
let input = {};
|
||||||
let originalFilepath = {};
|
let originalFilepath = {};
|
||||||
|
|
||||||
|
contractFiles = cloneDeep(contractFiles);
|
||||||
|
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
function prepareInput(callback) {
|
function prepareInput(callback) {
|
||||||
async.each(contractFiles,
|
async.each(contractFiles,
|
||||||
|
|
Loading…
Reference in New Issue