Merge branch 'develop' of github.com:iurimatias/embark-framework into develop

This commit is contained in:
Iuri Matias 2017-03-09 07:10:31 -05:00
commit 6b6b26a6b3
16 changed files with 63 additions and 16 deletions

1
.gitignore vendored
View File

@ -12,3 +12,4 @@ test_app/.embark/development/
test_app/config/production/password test_app/config/production/password
test_app/node_modules/ test_app/node_modules/
test_app/chains.json test_app/chains.json
.idea

View File

@ -21,6 +21,7 @@ module.exports = (grunt) ->
mochaTest: mochaTest:
test: test:
src: ['test/**/*.js'] src: ['test/**/*.js']
jshint: jshint:
all: ['bin/embark', 'lib/**/*.js', 'js/mine.js', 'js/embark.js'] all: ['bin/embark', 'lib/**/*.js', 'js/mine.js', 'js/embark.js']

View File

@ -6,6 +6,6 @@
</head> </head>
<body> <body>
<h3>Welcome to Embark!</h3> <h3>Welcome to Embark!</h3>
<p>See the <a href="https://github.com/iurimatias/embark-framework/wiki">Wiki</a> to see what you can do with Embark!</p> <p>See the <a href="http://embark.readthedocs.io/en/latest/index.html" target="_blank">Embark's documentation</a> to see what you can do with Embark!</p>
</body> </body>
</html> </html>

View File

@ -5,6 +5,7 @@ var web3 = EmbarkSpec.web3;
//describe("SimpleStorage", function() { //describe("SimpleStorage", function() {
// before(function(done) { // before(function(done) {
// this.timeout(0);
// var contractsConfig = { // var contractsConfig = {
// "SimpleStorage": { // "SimpleStorage": {
// args: [100, '0x123'] // args: [100, '0x123']

View File

@ -93,7 +93,7 @@ $(document).ready(function() {
if (err) { if (err) {
$("#communication .error").show(); $("#communication .error").show();
$("#communication-controls").hide(); $("#communication-controls").hide();
+ $("#status-communication").addClass('status-offline'); $("#status-communication").addClass('status-offline');
} else { } else {
EmbarkJS.Messages.setProvider('whisper'); EmbarkJS.Messages.setProvider('whisper');
$("#status-communication").addClass('status-online'); $("#status-communication").addClass('status-online');

View File

@ -5,6 +5,7 @@ var web3 = EmbarkSpec.web3;
describe("SimpleStorage", function() { describe("SimpleStorage", function() {
before(function(done) { before(function(done) {
this.timeout(0);
var contractsConfig = { var contractsConfig = {
"SimpleStorage": { "SimpleStorage": {
args: [100] args: [100]

View File

@ -33,10 +33,11 @@ Cmd.prototype.newApp = function() {
.description('new application') .description('new application')
.action(function(name, options) { .action(function(name, options) {
if (name === undefined) { if (name === undefined) {
console.log("please specify your app Name".red); console.log("please specify your app Name".red);
console.log("e.g embark new MyApp".green); console.log("e.g embark new MyApp".green);
console.log("e.g embark new --help for more information".green); console.log("e.g embark new --help for more information".green);
process.exit(code); process.exit(9);
} }
self.Embark.generateTemplate('boilerplate', './', name); self.Embark.generateTemplate('boilerplate', './', name);
}); });
@ -120,7 +121,7 @@ Cmd.prototype.test = function() {
.command('test') .command('test')
.description('run tests') .description('run tests')
.action(function() { .action(function() {
shelljs.exec('mocha test/ --no-timeouts'); shelljs.exec('mocha test');
}); });
}; };

View File

@ -9,12 +9,13 @@ var ServicesMonitor = require('./services.js');
var Pipeline = require('../pipeline/pipeline.js'); var Pipeline = require('../pipeline/pipeline.js');
var Server = require('../pipeline/server.js'); var Server = require('../pipeline/server.js');
var Watch = require('../pipeline/watch.js'); var Watch = require('../pipeline/watch.js');
var version = require('../../package.json').version;
var Engine = function(options) { var Engine = function(options) {
this.env = options.env; this.env = options.env;
this.embarkConfig = options.embarkConfig; this.embarkConfig = options.embarkConfig;
this.interceptLogs = options.interceptLogs; this.interceptLogs = options.interceptLogs;
this.version = "2.4.0"; this.version = version;
}; };
Engine.prototype.init = function(_options) { Engine.prototype.init = function(_options) {

View File

@ -70,18 +70,23 @@ ServicesMonitor.prototype.check = function() {
body += d; body += d;
}); });
res.on('end', function() { res.on('end', function() {
var parsed = JSON.parse(body); try{
if(parsed.Version){ var parsed = JSON.parse(body);
result.push(("IPFS " + parsed.Version).green); if(parsed.Version){
result.push(("IPFS " + parsed.Version).green);
}
else{
result.push("IPFS".green);
}
} }
else{ catch (e){
result.push("IPFS".green); result.push("IPFS".red);
} }
callback(null, result); callback(null, result);
}); });
res.on('error', function(err) { res.on('error', function(err) {
self.logger.trace("Check IPFS version error: " + err); self.logger.trace("Check IPFS version error: " + err);
result.push("IPFS".green); result.push("IPFS".red);
callback(null, result); callback(null, result);
}); });
}); });

View File

@ -2,9 +2,10 @@
var blessed = require("blessed"); var blessed = require("blessed");
var CommandHistory = require('./command_history.js'); var CommandHistory = require('./command_history.js');
var version = require('../../package.json').version;
function Dashboard(options) { function Dashboard(options) {
var title = (options && options.title) || "Embark 2.4.0"; var title = (options && options.title) || "Embark " + version;
this.env = options.env; this.env = options.env;
this.console = options.console; this.console = options.console;
this.history = new CommandHistory(); this.history = new CommandHistory();

View File

@ -22,10 +22,11 @@ var IPFS = require('./upload/ipfs.js');
var Swarm = require('./upload/swarm.js'); var Swarm = require('./upload/swarm.js');
var Cmd = require('./cmd.js'); var Cmd = require('./cmd.js');
var version = require('../package.json').version;
var Embark = { var Embark = {
version: '2.4.0', version: version,
process: function(args) { process: function(args) {
var cmd = new Cmd(Embark); var cmd = new Cmd(Embark);

View File

@ -5,7 +5,7 @@ var assert = require('assert');
// TODO: instead 'eval' the code with a fake web3 object // TODO: instead 'eval' the code with a fake web3 object
// and check the generate code interacts as expected // and check the generate code interacts as expected
describe('embark.ABIGenerator', function() { describe('embark.ABIGenerator', function() {
this.timeout(0);
describe('#generateProvider', function() { describe('#generateProvider', function() {
var generator = new ABIGenerator({blockchainConfig: {rpcHost: 'somehost', rpcPort: '1234'}, contractsManager: {}}); var generator = new ABIGenerator({blockchainConfig: {rpcHost: 'somehost', rpcPort: '1234'}, contractsManager: {}});

30
test/cmd.js Normal file
View File

@ -0,0 +1,30 @@
var Embark = require('../lib/index');
var Cmd = require('../lib/cmd');
describe('embark.Cmd', function () {
var cmd = new Cmd(Embark);
describe('#new', function () {
it('it should not create an app without a name', function (done) {
cmd.newApp(undefined, function (output) {
var lines = output.split('\n');
assert.equal(lines[0], 'please specify your app Name');
assert.equal(lines[1], 'e.g embark new MyApp');
assert.equal(lines[2], 'e.g embark new --help for more information');
});
done();
});
it('it should create an app with a name', function (done) {
var appname = 'deleteapp';
cmd.newApp(appname, function (output) {
var lines = output.split('\n');
assert.equal(lines[0], 'Initializing Embark Template....');
assert.equal(lines[1], 'Installing packages.. this can take a few seconds');
assert.equal(lines[2], 'Init complete');
assert.equal(lines[3], 'App ready at ./' + appname);
});
done();
});
});
});

View File

@ -12,6 +12,8 @@ describe('embark.Compiler', function() {
var compiler = new Compiler({logger: new TestLogger({})}); var compiler = new Compiler({logger: new TestLogger({})});
describe('#compile_solidity', function() { describe('#compile_solidity', function() {
this.timeout(0);
var expectedObject = {}; var expectedObject = {};
expectedObject["SimpleStorage"] = {"code":"606060405234610000576040516020806100f083398101604052515b60008190555b505b60bf806100316000396000f300606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe703903500077220029","realRuntimeBytecode": "606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820","runtimeBytecode":"606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe703903500077220029","swarmHash": "a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe70390350007722","gasEstimates":{"creation":[20131,38200],"external":{"get()":269,"set(uint256)":20163,"storedData()":224},"internal":{}},"functionHashes":{"get()":"6d4ce63c","set(uint256)":"60fe47b1","storedData()":"2a1afcd9"},"abiDefinition":[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"payable":false,"type":"constructor"}]}; expectedObject["SimpleStorage"] = {"code":"606060405234610000576040516020806100f083398101604052515b60008190555b505b60bf806100316000396000f300606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe703903500077220029","realRuntimeBytecode": "606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820","runtimeBytecode":"606060405263ffffffff60e060020a6000350416632a1afcd98114603657806360fe47b11460525780636d4ce63c146061575b6000565b346000576040607d565b60408051918252519081900360200190f35b34600057605f6004356083565b005b346000576040608c565b60408051918252519081900360200190f35b60005481565b60008190555b50565b6000545b905600a165627a7a72305820a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe703903500077220029","swarmHash": "a250be048d43f54e9afbb37211dc73ba843d23b95863b60afe70390350007722","gasEstimates":{"creation":[20131,38200],"external":{"get()":269,"set(uint256)":20163,"storedData()":224},"internal":{}},"functionHashes":{"get()":"6d4ce63c","set(uint256)":"60fe47b1","storedData()":"2a1afcd9"},"abiDefinition":[{"constant":true,"inputs":[],"name":"storedData","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"x","type":"uint256"}],"name":"set","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"retVal","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[{"name":"initialValue","type":"uint256"}],"payable":false,"type":"constructor"}]};

View File

@ -2,10 +2,11 @@
var Console = require('../lib/dashboard/console.js'); var Console = require('../lib/dashboard/console.js');
var Plugins = require('../lib/core/plugins.js'); var Plugins = require('../lib/core/plugins.js');
var assert = require('assert'); var assert = require('assert');
var version = require('../package.json').version;
describe('embark.Console', function() { describe('embark.Console', function() {
var plugins = new Plugins({plugins: {}}); var plugins = new Plugins({plugins: {}});
var console = new Console({plugins: plugins, version: '2.3.1'}); var console = new Console({plugins: plugins, version: version});
describe('#executeCmd', function() { describe('#executeCmd', function() {
@ -14,7 +15,7 @@ describe('embark.Console', function() {
it('it should provide a help text', function(done) { it('it should provide a help text', function(done) {
console.executeCmd('help', function(output) { console.executeCmd('help', function(output) {
var lines = output.split('\n'); var lines = output.split('\n');
assert.equal(lines[0], 'Welcome to Embark 2.3.1'); assert.equal(lines[0], 'Welcome to Embark ' + version);
assert.equal(lines[2], 'possible commands are:'); assert.equal(lines[2], 'possible commands are:');
done(); done();
}); });

View File

@ -9,6 +9,7 @@ var readFile = function(file) {
}; };
describe('embark.Contratcs', function() { describe('embark.Contratcs', function() {
describe('simple', function() { describe('simple', function() {
var contractsManager = new ContractsManager({ var contractsManager = new ContractsManager({
contractFiles: [ contractFiles: [