From b5d8df5efd4a5ef06ee611b7a3708cc9210c0529 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Sat, 13 Aug 2016 11:58:03 -0400 Subject: [PATCH] convert boiletplates to new structure --- boilerplate/.gitignore | 3 +- boilerplate/Gruntfile.coffee | 117 ------------------ boilerplate/app/{html => }/index.html | 0 boilerplate/config/blockchain.yml | 38 ------ boilerplate/config/chains/development.json | 1 - boilerplate/config/contracts.json | 6 + boilerplate/config/contracts.yml | 2 - .../config/development/blockchain.json | 9 ++ boilerplate/config/development/contracts.json | 8 ++ .../genesis.json} | 0 boilerplate/config/{ => development}/password | 0 boilerplate/config/server.yml | 2 - boilerplate/embark.json | 9 ++ boilerplate/embark.yml | 5 - boilerplate/package.json | 16 +-- boilerplate/tasks/server.coffee | 22 ---- boilerplate/test/contract_spec.js | 1 + {boilerplate => demo/.embark}/chains.json | 0 demo/app/{html => }/index.html | 0 demo/config/blockchain.yml | 37 ------ demo/config/chains/development.json | 1 - demo/config/contracts.json | 12 +- demo/config/contracts.yml | 8 -- demo/config/development/blockchain.json | 9 ++ demo/config/development/contracts.json | 13 ++ .../genesis.json} | 5 +- demo/config/{ => development}/password | 0 demo/config/server.yml | 2 - 28 files changed, 70 insertions(+), 256 deletions(-) delete mode 100644 boilerplate/Gruntfile.coffee rename boilerplate/app/{html => }/index.html (100%) delete mode 100644 boilerplate/config/blockchain.yml delete mode 100644 boilerplate/config/chains/development.json create mode 100644 boilerplate/config/contracts.json delete mode 100644 boilerplate/config/contracts.yml create mode 100644 boilerplate/config/development/blockchain.json create mode 100644 boilerplate/config/development/contracts.json rename boilerplate/config/{genesis/dev_genesis.json => development/genesis.json} (100%) rename boilerplate/config/{ => development}/password (100%) delete mode 100644 boilerplate/config/server.yml create mode 100644 boilerplate/embark.json delete mode 100644 boilerplate/embark.yml delete mode 100644 boilerplate/tasks/server.coffee rename {boilerplate => demo/.embark}/chains.json (100%) rename demo/app/{html => }/index.html (100%) delete mode 100644 demo/config/blockchain.yml delete mode 100644 demo/config/chains/development.json delete mode 100644 demo/config/contracts.yml create mode 100644 demo/config/development/blockchain.json create mode 100644 demo/config/development/contracts.json rename demo/config/{genesis/dev_genesis.json => development/genesis.json} (63%) rename demo/config/{ => development}/password (100%) delete mode 100644 demo/config/server.yml diff --git a/boilerplate/.gitignore b/boilerplate/.gitignore index 418d4a6f..9517c949 100644 --- a/boilerplate/.gitignore +++ b/boilerplate/.gitignore @@ -1,2 +1,3 @@ +.embark/ node_modules/ -config/chains/development.json +dist/ diff --git a/boilerplate/Gruntfile.coffee b/boilerplate/Gruntfile.coffee deleted file mode 100644 index 0a427736..00000000 --- a/boilerplate/Gruntfile.coffee +++ /dev/null @@ -1,117 +0,0 @@ -module.exports = (grunt) -> - - grunt.option 'stack', true - grunt.loadTasks "tasks" - grunt.loadTasks "node_modules/embark-framework/grunt-embark/tasks" - - grunt.initConfig( - files: - web3: - "node_modules/embark-framework/js/web3.js" - - js: - src: [ - "app/js/**/*.js" - ] - - css: - src: [ - "app/css/**/*.css" - ] - - html: - src: [ - "app/html/**/*.html" - ] - - coffee: - dest: "generated/dapp/compiled-coffee" - compiled: [ - "generated/dapp/compiled-coffee/app.coffee" - "generated/dapp/compiled-coffee/**/*.js" - ] - - contracts: - src: [ - "app/contracts/**/*.sol" - "app/contracts/**/*.se" - ] - - coffee: - compile: - expand: true - cwd: 'coffee' - src: '**/*.coffee' - dest: '<%= files.coffee.dest %>' - ext: '.js' - - concat: - app: - src: ["<%= files.web3 %>", 'generated/tmp/abi.js', "<%= files.js.src %>", "<%= files.coffee.compiled %>"] - dest: "generated/dapp/js/app.min.js" - css: - src: "<%= files.css.src %>" - dest: "generated/dapp/css/app.min.css" - - watch: - options: - livereload: true - - html: - files: ["<%= files.html.src %>"] - tasks: ["copy"] - - js: - files: ["<%= files.js.src %>"] - tasks: ["concat"] - - css: - files: ["<%= files.css.src %>"] - tasks: ["concat"] - - coffee: - files: ["coffee/**/*.coffee"] - tasks: ["coffee", "concat"] - - contracts: - files: ["<%= files.contracts.src %>"] - tasks: ["deploy", "concat", "copy"] - - config: - files: ["config/blockchain.yml", "config/contracts.yml"] - tasks: ["deploy", "concat", "copy"] - - copy: - html: - files: - "generated/dapp/index.html" : "<%= files.html.src %>" - "dist/dapp/index.html" : "<%= files.html.src %>" - css: - files: - "dist/dapp/css/app.min.css" : "<%= files.css.src %>" - contracts: - files: - "dist/contracts/": '<%= files.contracts.src %>' - - uglify: - dist: - src: "<%= concat.app.dest %>" # input from the concat process - dest: "dist/dapp/js/app.min.js" - - clean: - workspaces: ["dist", "generated"] - - deploy: - contracts: '<%= files.contracts.src %>' - dest: 'generated/tmp/abi.js' - ) - - # loading external tasks (aka: plugins) - # Loads all plugins that match "grunt-", in this case all of our current plugins - require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks) - - env = grunt.option('env') - - grunt.registerTask "deploy", ["coffee", "deploy_contracts:"+env, "concat", "copy", "server", "watch"] - grunt.registerTask "build", ["clean", "deploy_contracts:"+env, "coffee", "concat", "uglify", "copy"] - diff --git a/boilerplate/app/html/index.html b/boilerplate/app/index.html similarity index 100% rename from boilerplate/app/html/index.html rename to boilerplate/app/index.html diff --git a/boilerplate/config/blockchain.yml b/boilerplate/config/blockchain.yml deleted file mode 100644 index 4a94a057..00000000 --- a/boilerplate/config/blockchain.yml +++ /dev/null @@ -1,38 +0,0 @@ -development: - rpc_host: localhost - rpc_port: 8101 - rpc_whitelist: "*" - minerthreads: 1 - genesis_block: config/genesis/dev_genesis.json - datadir: /tmp/embark - chains: config/chains/development.json - mine_when_needed: true - gas_limit: 500000 - gas_price: 10000000000000 - console: false - account: - init: true - password: config/password -staging: - testnet: true - rpc_host: localhost - rpc_port: 8101 - rpc_whitelist: "*" - datadir: default - network_id: 0 - deploy_timeout: 45 - console: true - account: - init: false - address: -production: - rpc_host: localhost - rpc_port: 8101 - rpc_whitelist: "*" - datadir: default - network_id: 1 - console: true - account: - init: false - address: - diff --git a/boilerplate/config/chains/development.json b/boilerplate/config/chains/development.json deleted file mode 100644 index 0967ef42..00000000 --- a/boilerplate/config/chains/development.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/boilerplate/config/contracts.json b/boilerplate/config/contracts.json new file mode 100644 index 00000000..b12546f0 --- /dev/null +++ b/boilerplate/config/contracts.json @@ -0,0 +1,6 @@ +{ + "default": { + "contracts": { + } + } +} diff --git a/boilerplate/config/contracts.yml b/boilerplate/config/contracts.yml deleted file mode 100644 index 56addd58..00000000 --- a/boilerplate/config/contracts.yml +++ /dev/null @@ -1,2 +0,0 @@ -development: -staging: diff --git a/boilerplate/config/development/blockchain.json b/boilerplate/config/development/blockchain.json new file mode 100644 index 00000000..c92f43aa --- /dev/null +++ b/boilerplate/config/development/blockchain.json @@ -0,0 +1,9 @@ +{ + "development": { + "rpcHost": "localhost", + "rpcPort": 8101, + "account": { + "password": "config/development/password" + } + } +} diff --git a/boilerplate/config/development/contracts.json b/boilerplate/config/development/contracts.json new file mode 100644 index 00000000..da851c9a --- /dev/null +++ b/boilerplate/config/development/contracts.json @@ -0,0 +1,8 @@ +{ + "development": { + "gasLimit": 500000, + "gasPrice": 10000000000000, + "contracts": { + } + } +} diff --git a/boilerplate/config/genesis/dev_genesis.json b/boilerplate/config/development/genesis.json similarity index 100% rename from boilerplate/config/genesis/dev_genesis.json rename to boilerplate/config/development/genesis.json diff --git a/boilerplate/config/password b/boilerplate/config/development/password similarity index 100% rename from boilerplate/config/password rename to boilerplate/config/development/password diff --git a/boilerplate/config/server.yml b/boilerplate/config/server.yml deleted file mode 100644 index 2b9fa001..00000000 --- a/boilerplate/config/server.yml +++ /dev/null @@ -1,2 +0,0 @@ -host: localhost -port: 8000 diff --git a/boilerplate/embark.json b/boilerplate/embark.json new file mode 100644 index 00000000..a73e949f --- /dev/null +++ b/boilerplate/embark.json @@ -0,0 +1,9 @@ +{ + "app": { + "contracts": ['app/contracts/**'], + "css": ['app/css/**'], + "js": ['app/js/**'], + "main": 'app/index.html' + }, + "config": "config/" +} diff --git a/boilerplate/embark.yml b/boilerplate/embark.yml deleted file mode 100644 index b47e72d2..00000000 --- a/boilerplate/embark.yml +++ /dev/null @@ -1,5 +0,0 @@ -type: "grunt" #other options: meteor, manual -#contracts: ["app/contracts/**/*.sol", "app/contracts/**/*.se"] -#output: "src/embark.js" -#blockchainConfig: "config/blockchain.yml" -#contractsConfig: "config/contracts.yml" diff --git a/boilerplate/package.json b/boilerplate/package.json index 66225974..3a99f6f8 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,19 +10,7 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "^1.2.0", - "grunt-contrib-clean": "^0.6.0", - "grunt-contrib-coffee": "^0.13.0", - "grunt-contrib-concat": "^0.5.1", - "grunt-contrib-copy": "^0.8.0", - "grunt-contrib-uglify": "^0.9.1", - "grunt-contrib-watch": "^0.6.1", - "grunt": "^0.4.5", - "grunt-cli": "^0.1.13", - "matchdep": "^0.3.0", - "mocha": "^2.2.5", - "express": "^4.12.3", - "read-yaml": "^1.0.0", - "compression": "^1.4.3" + "embark-framework": "~/Projects/embark-framework", + "mocha": "^2.2.5" } } diff --git a/boilerplate/tasks/server.coffee b/boilerplate/tasks/server.coffee deleted file mode 100644 index 5bbb67c7..00000000 --- a/boilerplate/tasks/server.coffee +++ /dev/null @@ -1,22 +0,0 @@ -module.exports = (grunt) -> - express = require('express') - compression = require('compression') - readYaml = require('read-yaml') - - grunt.registerTask "server", "static file development server", => - serverConfig = readYaml.sync("config/server.yml") - - webPort = serverConfig.port || 8000 - webHost = serverConfig.host || 'localhost' - webRoot = "generated/dapp" - - app = express() - app.use(compression()) - app.use(express.static("" + (process.cwd()) + "/" + webRoot)) - app.listen(webPort, webHost) - - grunt.log.writeln("Running web server on port http://#{webHost}:#{webPort}") - - return app - - diff --git a/boilerplate/test/contract_spec.js b/boilerplate/test/contract_spec.js index 5d9987df..5c4a3255 100644 --- a/boilerplate/test/contract_spec.js +++ b/boilerplate/test/contract_spec.js @@ -13,6 +13,7 @@ describe("MyContract", function() { }); }); + // example usage //it("should set constructor value", function(done) { // SimpleStorage.storedData(function(err, result) { // assert.equal(result.toNumber(), 100); diff --git a/boilerplate/chains.json b/demo/.embark/chains.json similarity index 100% rename from boilerplate/chains.json rename to demo/.embark/chains.json diff --git a/demo/app/html/index.html b/demo/app/index.html similarity index 100% rename from demo/app/html/index.html rename to demo/app/index.html diff --git a/demo/config/blockchain.yml b/demo/config/blockchain.yml deleted file mode 100644 index 924dc35a..00000000 --- a/demo/config/blockchain.yml +++ /dev/null @@ -1,37 +0,0 @@ -development: - rpc_host: localhost - rpc_port: 8101 - rpc_whitelist: "*" - minerthreads: 1 - genesis_block: config/genesis/dev_genesis.json - datadir: /tmp/embark - chains: config/chains/development.json - mine_when_needed: true - gas_limit: 500000 - gas_price: 10000000000000 - console: false - account: - init: true - password: config/password -staging: - testnet: true - rpc_host: localhost - rpc_port: 8101 - rpc_whitelist: "*" - datadir: default - network_id: 0 - deploy_timeout: 45 - console: true - account: - init: false - address: -production: - rpc_host: localhost - rpc_port: 8101 - rpc_whitelist: "*" - datadir: default - network_id: 1 - console: true - account: - init: false - address: diff --git a/demo/config/chains/development.json b/demo/config/chains/development.json deleted file mode 100644 index 0967ef42..00000000 --- a/demo/config/chains/development.json +++ /dev/null @@ -1 +0,0 @@ -{} diff --git a/demo/config/contracts.json b/demo/config/contracts.json index 6dc28c05..45f32dc5 100644 --- a/demo/config/contracts.json +++ b/demo/config/contracts.json @@ -1,7 +1,11 @@ { - "SimpleStorage": { - "args": [ - 100 - ] + "default": { + "contracts": { + "SimpleStorage": { + "args": [ + 100 + ] + } + } } } diff --git a/demo/config/contracts.yml b/demo/config/contracts.yml deleted file mode 100644 index 2b6d25d6..00000000 --- a/demo/config/contracts.yml +++ /dev/null @@ -1,8 +0,0 @@ -development: - SimpleStorage: - args: - - 100 -staging: - SimpleStorage: - args: - - 100 diff --git a/demo/config/development/blockchain.json b/demo/config/development/blockchain.json new file mode 100644 index 00000000..c92f43aa --- /dev/null +++ b/demo/config/development/blockchain.json @@ -0,0 +1,9 @@ +{ + "development": { + "rpcHost": "localhost", + "rpcPort": 8101, + "account": { + "password": "config/development/password" + } + } +} diff --git a/demo/config/development/contracts.json b/demo/config/development/contracts.json new file mode 100644 index 00000000..65392e5c --- /dev/null +++ b/demo/config/development/contracts.json @@ -0,0 +1,13 @@ +{ + "development": { + "gasLimit": 500000, + "gasPrice": 10000000000000, + "contracts": { + "SimpleStorage": { + "args": [ + 100 + ] + } + } + } +} diff --git a/demo/config/genesis/dev_genesis.json b/demo/config/development/genesis.json similarity index 63% rename from demo/config/genesis/dev_genesis.json rename to demo/config/development/genesis.json index 9f60d776..9f2d1562 100644 --- a/demo/config/genesis/dev_genesis.json +++ b/demo/config/development/genesis.json @@ -1,10 +1,11 @@ { "nonce": "0x0000000000000042", - "difficulty": "0x40000", + "difficulty": "0x0", "alloc": { + "0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"} }, "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", - "coinbase": "0x0000000000000000000000000000000000000000", + "coinbase": "0x3333333333333333333333333333333333333333", "timestamp": "0x00", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "extraData": "0x", diff --git a/demo/config/password b/demo/config/development/password similarity index 100% rename from demo/config/password rename to demo/config/development/password diff --git a/demo/config/server.yml b/demo/config/server.yml deleted file mode 100644 index 2b9fa001..00000000 --- a/demo/config/server.yml +++ /dev/null @@ -1,2 +0,0 @@ -host: localhost -port: 8000