move tasks, package.json
This commit is contained in:
parent
1722368979
commit
e5ab65d8de
22
package.json
22
package.json
|
@ -1,2 +1,24 @@
|
|||
{
|
||||
"name": "grunt-embark",
|
||||
"version": "0.0.1",
|
||||
"description": "",
|
||||
"main": "Gruntfile.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"homepage": "",
|
||||
"dependencies": {
|
||||
"embark-framework": "/Users/iurimatias/Projects/embark-framework",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
module.exports = (grunt) ->
|
||||
|
||||
@embarkConfig =
|
||||
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"
|
||||
]
|
||||
|
||||
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: ["<%= concat.css.src %>"]
|
||||
tasks: ["concat"]
|
||||
|
||||
coffee:
|
||||
files: ["coffee/**/*.coffee"]
|
||||
tasks: ["coffee", "concat"]
|
||||
|
||||
contracts:
|
||||
files: ["<%= files.contracts.src %>"]
|
||||
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'
|
||||
|
||||
@initEmbarkConfig = (userConfig) =>
|
||||
hashmerge = require('hashmerge')
|
||||
hashmerge(@embarkConfig, userConfig)
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
module.exports = (grunt) ->
|
||||
|
||||
grunt.registerTask "blockchain", "deploy ethereum node", (env_) =>
|
||||
env = env_ || "development"
|
||||
Embark = require('embark-framework')
|
||||
Embark.init()
|
||||
Embark.blockchainConfig.loadConfigFile('config/blockchain.yml')
|
||||
Embark.startBlockchain(env)
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
module.exports = (grunt) ->
|
||||
web3 = require('web3')
|
||||
readYaml = require('read-yaml');
|
||||
|
||||
grunt.registerTask "deploy_contracts", "deploy code", (env_) =>
|
||||
env = env_ || "development"
|
||||
contractFiles = grunt.file.expand(grunt.config.get("deploy.contracts"));
|
||||
destFile = grunt.config.get("deploy.dest");
|
||||
|
||||
Embark = require('embark-framework')
|
||||
Embark.init()
|
||||
Embark.blockchainConfig.loadConfigFile('config/blockchain.yml')
|
||||
Embark.contractsConfig.loadConfigFile('config/contracts.yml')
|
||||
#abi = Embark.deployContracts(env, contractFiles, destFile)
|
||||
abi = Embark.deployContracts(env, contractFiles, destFile)
|
||||
grunt.file.write(destFile, abi);
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
module.exports = (grunt) ->
|
||||
|
||||
grunt.registerTask "ipfs", "distribute into ipfs", (env_) =>
|
||||
env = env_ || "development"
|
||||
Embark = require('embark-framework')
|
||||
Embark.release.ipfs("dist/dapp/")
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
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
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
module.exports = (grunt) ->
|
||||
|
||||
grunt.registerTask "deploy", ["coffee", "deploy_contracts", "concat", "copy", "server", "watch"]
|
||||
grunt.registerTask "build", ["clean", "deploy_contracts", "coffee", "concat", "uglify", "copy"]
|
||||
|
Loading…
Reference in New Issue