add --simple option

This commit is contained in:
Iuri Matias 2018-03-29 19:42:47 -04:00
parent a8e22ec45c
commit 4c82f309e0
8 changed files with 87 additions and 4 deletions

View File

@ -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);
}
}
});
}

5
templates/simple/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
.embark/
node_modules/
dist/
config/production/password
config/livenet/password

View File

@ -0,0 +1 @@
{}

View File

@ -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": {
}
}
}

View File

View File

@ -0,0 +1,7 @@
{
"contracts": ["contracts/**"],
"app": {},
"buildDir": "build/",
"config": "./",
"plugins": {}
}

View File

@ -0,0 +1,13 @@
{
"name": "%APP_NAME%",
"version": "0.0.1",
"description": "",
"scripts": {
"test": "embark test"
},
"author": "",
"license": "ISC",
"homepage": "",
"devDependencies": {
}
}

View File

@ -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();
// });
// });
// });
//
//});