diff --git a/.gitignore b/.gitignore index 75be4c5f7..162b9c4d7 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ test_app/.embark/development/ test_app/config/production/password test_app/node_modules/ test_app/chains.json +.idea \ No newline at end of file diff --git a/Gruntfile.coffee b/Gruntfile.coffee index 24f23def8..f645af422 100644 --- a/Gruntfile.coffee +++ b/Gruntfile.coffee @@ -21,6 +21,7 @@ module.exports = (grunt) -> mochaTest: test: src: ['test/**/*.js'] + jshint: all: ['bin/embark', 'lib/**/*.js', 'js/mine.js', 'js/embark.js'] diff --git a/boilerplate/app/index.html b/boilerplate/app/index.html index 3585f0803..8068e7c7b 100644 --- a/boilerplate/app/index.html +++ b/boilerplate/app/index.html @@ -6,6 +6,6 @@

Welcome to Embark!

-

See the Wiki to see what you can do with Embark!

+

See the Embark's documentation to see what you can do with Embark!

diff --git a/boilerplate/test/contract_spec.js b/boilerplate/test/contract_spec.js index ec1b87383..e732155dc 100644 --- a/boilerplate/test/contract_spec.js +++ b/boilerplate/test/contract_spec.js @@ -5,6 +5,7 @@ var web3 = EmbarkSpec.web3; //describe("SimpleStorage", function() { // before(function(done) { +// this.timeout(0); // var contractsConfig = { // "SimpleStorage": { // args: [100, '0x123'] diff --git a/demo/app/js/index.js b/demo/app/js/index.js index cd5863c79..8b3f1bb35 100644 --- a/demo/app/js/index.js +++ b/demo/app/js/index.js @@ -93,7 +93,7 @@ $(document).ready(function() { if (err) { $("#communication .error").show(); $("#communication-controls").hide(); -+ $("#status-communication").addClass('status-offline'); + $("#status-communication").addClass('status-offline'); } else { EmbarkJS.Messages.setProvider('whisper'); $("#status-communication").addClass('status-online'); diff --git a/demo/test/simple_storage_spec.js b/demo/test/simple_storage_spec.js index 83ad1610f..b2d3cb178 100644 --- a/demo/test/simple_storage_spec.js +++ b/demo/test/simple_storage_spec.js @@ -5,6 +5,7 @@ var web3 = EmbarkSpec.web3; describe("SimpleStorage", function() { before(function(done) { + this.timeout(0); var contractsConfig = { "SimpleStorage": { args: [100] diff --git a/lib/cmd.js b/lib/cmd.js index a3440b974..b60ac4ff4 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -33,10 +33,11 @@ Cmd.prototype.newApp = function() { .description('new application') .action(function(name, options) { if (name === undefined) { + console.log("please specify your app Name".red); console.log("e.g embark new MyApp".green); console.log("e.g embark new --help for more information".green); - process.exit(code); + process.exit(9); } self.Embark.generateTemplate('boilerplate', './', name); }); @@ -120,7 +121,7 @@ Cmd.prototype.test = function() { .command('test') .description('run tests') .action(function() { - shelljs.exec('mocha test/ --no-timeouts'); + shelljs.exec('mocha test'); }); }; diff --git a/lib/core/engine.js b/lib/core/engine.js index 872d8fc7a..ad248a7c6 100644 --- a/lib/core/engine.js +++ b/lib/core/engine.js @@ -9,12 +9,13 @@ var ServicesMonitor = require('./services.js'); var Pipeline = require('../pipeline/pipeline.js'); var Server = require('../pipeline/server.js'); var Watch = require('../pipeline/watch.js'); +var version = require('../../package.json').version; var Engine = function(options) { this.env = options.env; this.embarkConfig = options.embarkConfig; this.interceptLogs = options.interceptLogs; - this.version = "2.4.0"; + this.version = version; }; Engine.prototype.init = function(_options) { diff --git a/lib/core/services.js b/lib/core/services.js index a04f672eb..90fb5e0b8 100644 --- a/lib/core/services.js +++ b/lib/core/services.js @@ -70,18 +70,23 @@ ServicesMonitor.prototype.check = function() { body += d; }); res.on('end', function() { - var parsed = JSON.parse(body); - if(parsed.Version){ - result.push(("IPFS " + parsed.Version).green); + try{ + var parsed = JSON.parse(body); + if(parsed.Version){ + result.push(("IPFS " + parsed.Version).green); + } + else{ + result.push("IPFS".green); + } } - else{ - result.push("IPFS".green); + catch (e){ + result.push("IPFS".red); } callback(null, result); }); res.on('error', function(err) { self.logger.trace("Check IPFS version error: " + err); - result.push("IPFS".green); + result.push("IPFS".red); callback(null, result); }); }); diff --git a/lib/dashboard/monitor.js b/lib/dashboard/monitor.js index 5468128ba..210fa7cec 100644 --- a/lib/dashboard/monitor.js +++ b/lib/dashboard/monitor.js @@ -2,9 +2,10 @@ var blessed = require("blessed"); var CommandHistory = require('./command_history.js'); +var version = require('../../package.json').version; function Dashboard(options) { - var title = (options && options.title) || "Embark 2.4.0"; + var title = (options && options.title) || "Embark " + version; this.env = options.env; this.console = options.console; this.history = new CommandHistory(); diff --git a/lib/index.js b/lib/index.js index 97877acb5..6b358d23b 100644 --- a/lib/index.js +++ b/lib/index.js @@ -22,10 +22,11 @@ var IPFS = require('./upload/ipfs.js'); var Swarm = require('./upload/swarm.js'); var Cmd = require('./cmd.js'); +var version = require('../package.json').version; var Embark = { - version: '2.4.0', + version: version, process: function(args) { var cmd = new Cmd(Embark); diff --git a/test/abi.js b/test/abi.js index 4d2533ba3..e54798b2f 100644 --- a/test/abi.js +++ b/test/abi.js @@ -5,7 +5,7 @@ var assert = require('assert'); // TODO: instead 'eval' the code with a fake web3 object // and check the generate code interacts as expected describe('embark.ABIGenerator', function() { - + this.timeout(0); describe('#generateProvider', function() { var generator = new ABIGenerator({blockchainConfig: {rpcHost: 'somehost', rpcPort: '1234'}, contractsManager: {}}); diff --git a/test/cmd.js b/test/cmd.js new file mode 100644 index 000000000..8b64a97dd --- /dev/null +++ b/test/cmd.js @@ -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(); + }); + }); +}); \ No newline at end of file diff --git a/test/compiler.js b/test/compiler.js index c44d3ed9b..9cbd1126a 100644 --- a/test/compiler.js +++ b/test/compiler.js @@ -12,6 +12,8 @@ describe('embark.Compiler', function() { var compiler = new Compiler({logger: new TestLogger({})}); describe('#compile_solidity', function() { + this.timeout(0); + 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"}]}; diff --git a/test/console.js b/test/console.js index a1d987e12..a0f9d6e29 100644 --- a/test/console.js +++ b/test/console.js @@ -2,10 +2,11 @@ var Console = require('../lib/dashboard/console.js'); var Plugins = require('../lib/core/plugins.js'); var assert = require('assert'); +var version = require('../package.json').version; describe('embark.Console', function() { 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() { @@ -14,7 +15,7 @@ describe('embark.Console', function() { it('it should provide a help text', function(done) { console.executeCmd('help', function(output) { 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:'); done(); }); diff --git a/test/contracts.js b/test/contracts.js index 873383a19..57b65bcf3 100644 --- a/test/contracts.js +++ b/test/contracts.js @@ -9,6 +9,7 @@ var readFile = function(file) { }; describe('embark.Contratcs', function() { + describe('simple', function() { var contractsManager = new ContractsManager({ contractFiles: [