convert boiletplates to new structure

This commit is contained in:
Iuri Matias 2016-08-13 11:58:03 -04:00
parent 22f7e6d6d4
commit b5d8df5efd
28 changed files with 70 additions and 256 deletions

View File

@ -1,2 +1,3 @@
.embark/
node_modules/ node_modules/
config/chains/development.json dist/

View File

@ -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"]

View File

@ -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:

View File

@ -1 +0,0 @@
{}

View File

@ -0,0 +1,6 @@
{
"default": {
"contracts": {
}
}
}

View File

@ -1,2 +0,0 @@
development:
staging:

View File

@ -0,0 +1,9 @@
{
"development": {
"rpcHost": "localhost",
"rpcPort": 8101,
"account": {
"password": "config/development/password"
}
}
}

View File

@ -0,0 +1,8 @@
{
"development": {
"gasLimit": 500000,
"gasPrice": 10000000000000,
"contracts": {
}
}
}

View File

@ -1,2 +0,0 @@
host: localhost
port: 8000

9
boilerplate/embark.json Normal file
View File

@ -0,0 +1,9 @@
{
"app": {
"contracts": ['app/contracts/**'],
"css": ['app/css/**'],
"js": ['app/js/**'],
"main": 'app/index.html'
},
"config": "config/"
}

View File

@ -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"

View File

@ -10,19 +10,7 @@
"license": "ISC", "license": "ISC",
"homepage": "", "homepage": "",
"devDependencies": { "devDependencies": {
"embark-framework": "^1.2.0", "embark-framework": "~/Projects/embark-framework",
"grunt-contrib-clean": "^0.6.0", "mocha": "^2.2.5"
"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"
} }
} }

View File

@ -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

View File

@ -13,6 +13,7 @@ describe("MyContract", function() {
}); });
}); });
// example usage
//it("should set constructor value", function(done) { //it("should set constructor value", function(done) {
// SimpleStorage.storedData(function(err, result) { // SimpleStorage.storedData(function(err, result) {
// assert.equal(result.toNumber(), 100); // assert.equal(result.toNumber(), 100);

View File

@ -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:

View File

@ -1 +0,0 @@
{}

View File

@ -1,7 +1,11 @@
{ {
"SimpleStorage": { "default": {
"args": [ "contracts": {
100 "SimpleStorage": {
] "args": [
100
]
}
}
} }
} }

View File

@ -1,8 +0,0 @@
development:
SimpleStorage:
args:
- 100
staging:
SimpleStorage:
args:
- 100

View File

@ -0,0 +1,9 @@
{
"development": {
"rpcHost": "localhost",
"rpcPort": 8101,
"account": {
"password": "config/development/password"
}
}
}

View File

@ -0,0 +1,13 @@
{
"development": {
"gasLimit": 500000,
"gasPrice": 10000000000000,
"contracts": {
"SimpleStorage": {
"args": [
100
]
}
}
}
}

View File

@ -1,10 +1,11 @@
{ {
"nonce": "0x0000000000000042", "nonce": "0x0000000000000042",
"difficulty": "0x40000", "difficulty": "0x0",
"alloc": { "alloc": {
"0x3333333333333333333333333333333333333333": {"balance": "15000000000000000000"}
}, },
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000", "mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000", "coinbase": "0x3333333333333333333333333333333333333333",
"timestamp": "0x00", "timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000", "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x", "extraData": "0x",

View File

@ -1,2 +0,0 @@
host: localhost
port: 8000