diff --git a/lib/cmd.js b/lib/cmd.js index 8f350b72f..bdd64ac85 100644 --- a/lib/cmd.js +++ b/lib/cmd.js @@ -43,7 +43,8 @@ class Cmd { program .command('new [name]') .description('new application') - .action(function (name) { + .option('--simple', 'create a barebones project meant only for contract development') + .action(function (name, options) { if (name === undefined) { return promptly.prompt("Name your app (default is embarkDApp):", { default: "embarkDApp", @@ -56,13 +57,20 @@ class Cmd { err.retry(); } else { //slightly different assignment of name since it comes from child prompt - embark.generateTemplate('boilerplate', './', inputvalue); + if (options.simple) { + embark.generateTemplate('simple', './', inputvalue); + } else { + embark.generateTemplate('boilerplate', './', inputvalue); + } } }); } else { - embark.generateTemplate('boilerplate', './', name); + if (options.simple) { + embark.generateTemplate('simple', './', name); + } else { + embark.generateTemplate('boilerplate', './', name); + } } - }); } diff --git a/templates/simple/.gitignore b/templates/simple/.gitignore new file mode 100644 index 000000000..77bcafb1a --- /dev/null +++ b/templates/simple/.gitignore @@ -0,0 +1,5 @@ +.embark/ +node_modules/ +dist/ +config/production/password +config/livenet/password diff --git a/templates/simple/chains.json b/templates/simple/chains.json new file mode 100644 index 000000000..0967ef424 --- /dev/null +++ b/templates/simple/chains.json @@ -0,0 +1 @@ +{} diff --git a/templates/simple/contracts.json b/templates/simple/contracts.json new file mode 100644 index 000000000..41db174dd --- /dev/null +++ b/templates/simple/contracts.json @@ -0,0 +1,20 @@ +{ + "default": { + "versions": { + "web3.js": "1.0.0-beta", + "solc": "0.4.17" + }, + "deployment": { + "host": "localhost", + "port": 8545, + "type": "rpc" + }, + "dappConnection": [ + "$WEB3", + "http://localhost:8545" + ], + "gas": "auto", + "contracts": { + } + } +} diff --git a/templates/simple/contracts/.gitkeep b/templates/simple/contracts/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/templates/simple/embark.json b/templates/simple/embark.json new file mode 100644 index 000000000..1bf27d8f8 --- /dev/null +++ b/templates/simple/embark.json @@ -0,0 +1,7 @@ +{ + "contracts": ["contracts/**"], + "app": {}, + "buildDir": "build/", + "config": "./", + "plugins": {} +} diff --git a/templates/simple/package.json b/templates/simple/package.json new file mode 100644 index 000000000..46a574886 --- /dev/null +++ b/templates/simple/package.json @@ -0,0 +1,13 @@ +{ + "name": "%APP_NAME%", + "version": "0.0.1", + "description": "", + "scripts": { + "test": "embark test" + }, + "author": "", + "license": "ISC", + "homepage": "", + "devDependencies": { + } +} diff --git a/templates/simple/test/contract_spec.js b/templates/simple/test/contract_spec.js new file mode 100644 index 000000000..8c5ed27f9 --- /dev/null +++ b/templates/simple/test/contract_spec.js @@ -0,0 +1,29 @@ +//describe("SimpleStorage", function() { +// this.timeout(0); +// before(function(done) { +// this.timeout(0); +// var contractsConfig = { +// "SimpleStorage": { +// args: [100] +// } +// }; +// EmbarkSpec.deployAll(contractsConfig, () => { done() }); +// }); +// +// it("should set constructor value", function(done) { +// SimpleStorage.methods.storedData().call().then(function(result) { +// assert.equal(result, 100); +// done(); +// }); +// }); +// +// it("set storage value", function(done) { +// SimpleStorage.methods.set(150).send().then(function() { +// SimpleStorage.methods.get().call().then(function(result) { +// assert.equal(result, 150); +// done(); +// }); +// }); +// }); +// +//});