mirror of https://github.com/embarklabs/embark.git
fixes for the test_dapp to work
This commit is contained in:
parent
e049b459c8
commit
d33425fb4c
|
@ -383,24 +383,48 @@ class CodeGenerator {
|
|||
}
|
||||
|
||||
generateSymlink(target, name, callback) {
|
||||
const symlinkDir = this.fs.dappPath(this.embarkConfig.generationDir, constants.dappArtifacts.symlinkDir);
|
||||
this.fs.mkdirp(symlinkDir, (err) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
const symlinkDest = utils.joinPath(symlinkDir, name).replace(/\\/g, '/');
|
||||
this.fs.remove(symlinkDest, (err) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
this.fs.symlink(path.dirname(target), symlinkDest, 'junction', (err) => {
|
||||
async.waterfall([
|
||||
// Make directory
|
||||
next => {
|
||||
const symlinkDir = this.fs.dappPath(this.embarkConfig.generationDir, constants.dappArtifacts.symlinkDir);
|
||||
this.fs.mkdirp(symlinkDir, (err) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
return next(err);
|
||||
}
|
||||
callback(null, symlinkDest);
|
||||
next(null, utils.joinPath(symlinkDir, name).replace(/\\/g, '/'));
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
// Remove old symlink because they are not overwritable
|
||||
(symlinkDest, next) => {
|
||||
this.fs.remove(symlinkDest, (err) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
next(null, symlinkDest);
|
||||
});
|
||||
},
|
||||
// Make target a directory as files don't work on Windows
|
||||
(symlinkDest, next) => {
|
||||
this.fs.stat(target, (err, stats) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
let finalTarget = target;
|
||||
if (stats.isFile()) {
|
||||
finalTarget = path.dirname(target);
|
||||
}
|
||||
next(null, symlinkDest, finalTarget);
|
||||
});
|
||||
},
|
||||
(symlinkDest, finalTarget, next) => {
|
||||
this.fs.symlink(finalTarget, symlinkDest, 'junction', (err) => {
|
||||
if (err) {
|
||||
return next(err);
|
||||
}
|
||||
next(null, symlinkDest);
|
||||
});
|
||||
}
|
||||
], callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -356,12 +356,11 @@ class Pipeline {
|
|||
importsList["Embark/contracts/" + contract.className] = contractPath;
|
||||
|
||||
// add the contract to the exports list to support alternate import syntax
|
||||
importsHelperFile.write(`"${contract.className}": require('./${contract.className}').default`);
|
||||
if (idx < contracts.length - 1) importsHelperFile.write(',\n'); // add a comma if we have more contracts to add
|
||||
importsHelperFile.write(`"${contract.className}": require('./${contract.className}').default,\n`);
|
||||
eachCb();
|
||||
});
|
||||
}, () => {
|
||||
importsHelperFile.write('\n}'); // close the module.exports = {}
|
||||
importsHelperFile.write('\n};'); // close the module.exports = {}
|
||||
importsHelperFile.close(next); // close the write stream
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { Component } from 'react';
|
||||
import SimpleStorage from 'Embark/contracts/SimpleStorage';
|
||||
import SimpleStorage from '../../embarkArtifacts/contracts/SimpleStorage';
|
||||
window.SimpleStorage = SimpleStorage;
|
||||
|
||||
class App extends Component {
|
||||
action() {
|
||||
console.log("calling...")
|
||||
console.log("calling...");
|
||||
SimpleStorage.methods.get().call(function(err, value) {
|
||||
alert(value);
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
|
@ -1,28 +1,18 @@
|
|||
/*globals $, SimpleStorage, document*/
|
||||
|
||||
import React, { Component } from 'react';
|
||||
/*global web3*/
|
||||
import React from 'react';
|
||||
import EmbarkJS from 'Embark/EmbarkJS';
|
||||
import SimpleStorage from 'Embark/contracts/SimpleStorage';
|
||||
import Test from 'Embark/contracts/Test';
|
||||
//import Assert from 'Embark/contracts/Assert';
|
||||
import {SimpleStorage, Test, SimpleStorageTest} from '../../embarkArtifacts/contracts';
|
||||
import config from '../../embarkArtifacts/config/blockchain';
|
||||
|
||||
import SimpleStorageTest from 'Embark/contracts/SimpleStorageTest';
|
||||
window.SimpleStorageTest = SimpleStorageTest
|
||||
window.SimpleStorageTest = SimpleStorageTest;
|
||||
|
||||
import ReactDOM from 'react-dom';
|
||||
|
||||
//import $ from './_vendor/jquery.min';
|
||||
import $ from 'jquery';
|
||||
//import 'bootstrap';
|
||||
import 'bootstrap/dist/css/bootstrap.css';
|
||||
import 'bootstrap/dist/css/bootstrap-theme.css';
|
||||
//import 'bootstrap/dist/css/bootstrap.min.css';
|
||||
import 'bootstrap/dist/js/bootstrap.min.js';
|
||||
|
||||
//import 'react-bootstrap/dist/react-bootstrap.min.js';
|
||||
|
||||
import { Navbar, Jumbotron, Button } from 'react-bootstrap';
|
||||
|
||||
window.EmbarkJS = EmbarkJS;
|
||||
window.SimpleStorage = SimpleStorage;
|
||||
window.Test = Test;
|
||||
|
@ -44,6 +34,12 @@ var addToLog = function(id, txt) {
|
|||
// Blockchain example
|
||||
// ===========================
|
||||
$(document).ready(function() {
|
||||
EmbarkJS.Blockchain.connect(config, (err) => {
|
||||
if (err) {
|
||||
console.error(err);
|
||||
}
|
||||
});
|
||||
|
||||
console.log([1,2,3].map(v => v + 1));
|
||||
|
||||
$("#blockchain button.set").click(function() {
|
||||
|
@ -144,7 +140,7 @@ $(document).ready(function() {
|
|||
$("#communication .error").hide();
|
||||
$("#communication .errorVersion").hide();
|
||||
if (EmbarkJS.Messages.providerName === 'whisper') {
|
||||
EmbarkJS.Messages.getWhisperVersion(function(err, version) {
|
||||
EmbarkJS.Messages.getWhisperVersion(function(err, _version) {
|
||||
if (err) {
|
||||
$("#communication .error").show();
|
||||
$("#communication-controls").hide();
|
||||
|
|
|
@ -1,12 +1,7 @@
|
|||
import $ from 'jquery';
|
||||
import AlreadyDeployedToken from 'Embark/contracts/AlreadyDeployedToken';
|
||||
import AnotherStorage from 'Embark/contracts/AnotherStorage';
|
||||
import async from 'async';
|
||||
import MyToken from 'Embark/contracts/MyToken';
|
||||
import MyToken2 from 'Embark/contracts/MyToken2';
|
||||
import SimpleStorage from 'Embark/contracts/SimpleStorage';
|
||||
import Token from 'Embark/contracts/Token';
|
||||
|
||||
import {AlreadyDeployedToken, AnotherStorage, MyToken, MyToken2, SimpleStorage, Token} from '../../embarkArtifacts/contracts';
|
||||
import async from 'async';
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue