move development server to boilerplate

This commit is contained in:
Iuri Matias 2015-07-22 22:32:30 -04:00
parent 0e43d903e6
commit b44eb14028
2 changed files with 26 additions and 0 deletions

View File

@ -1,6 +1,7 @@
module.exports = (grunt) ->
grunt.loadNpmTasks "grunt-embark"
grunt.loadTasks "tasks"
grunt.initConfig(
files:
@ -103,3 +104,6 @@ module.exports = (grunt) ->
# Loads all plugins that match "grunt-", in this case all of our current plugins
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks)
grunt.registerTask "deploy", ["coffee", "deploy_contracts", "concat", "copy", "server", "watch"]
grunt.registerTask "build", ["clean", "deploy_contracts", "coffee", "concat", "uglify", "copy"]

View File

@ -0,0 +1,22 @@
module.exports = (grunt) ->
express = require('express')
compress = require('compress')
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