Merge pull request #8 from iurimatias/improve_config_file

improve config hash to fix issues requiring files in a specific order
This commit is contained in:
Iuri Matias 2015-06-04 07:20:57 -04:00
commit 84b77abce1
4 changed files with 58 additions and 49 deletions

View File

@ -1,53 +1,56 @@
module.exports = (grunt) -> module.exports = (grunt) ->
grunt.config.merge
files:
js:
src: [
"app/js/**/*.js"
]
css:
src: [
"app/css/**/*.css"
]
html:
src: [
"app/html/**/*.html"
]
contracts:
src: [
"app/contracts/**/*.sol"
]
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"
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 %>'
deploy:
contracts: '<%= files.contracts.src %>'
dest: 'generated/tmp/abi.js'
grunt.loadNpmTasks "embark-framework" grunt.loadNpmTasks "embark-framework"
grunt.initConfig(
@initEmbarkConfig(
files:
js:
src: [
"app/js/**/*.js"
]
css:
src: [
"app/css/**/*.css"
]
html:
src: [
"app/html/**/*.html"
]
contracts:
src: [
"app/contracts/**/*.sol"
]
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"
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 %>'
deploy:
contracts: '<%= files.contracts.src %>'
dest: 'generated/tmp/abi.js'
)
)
# loading external tasks (aka: plugins) # loading external tasks (aka: plugins)
# Loads all plugins that match "grunt-", in this case all of our current plugins # Loads all plugins that match "grunt-", in this case all of our current plugins
require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks) require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks)

View File

@ -27,6 +27,7 @@
"shelljs": "^0.4.0", "shelljs": "^0.4.0",
"string": "^3.1.1", "string": "^3.1.1",
"web3": "^0.4.3", "web3": "^0.4.3",
"wrench": "^1.5.8" "wrench": "^1.5.8",
"hashmerge": "^1.0.2"
} }
} }

View File

@ -25,7 +25,8 @@
"read-yaml": "^1.0.0", "read-yaml": "^1.0.0",
"shelljs": "^0.5.0", "shelljs": "^0.5.0",
"web3": "^0.4.3", "web3": "^0.4.3",
"wrench": "^1.5.8" "wrench": "^1.5.8",
"hashmerge": "^1.0.2"
}, },
"author": "Iuri Matias <iuri.matias@gmail.com>", "author": "Iuri Matias <iuri.matias@gmail.com>",
"contributors": [], "contributors": [],

View File

@ -1,6 +1,6 @@
module.exports = (grunt) -> module.exports = (grunt) ->
grunt.initConfig @embarkConfig =
files: files:
web3: web3:
"node_modules/embark-framework/js/web3.js" "node_modules/embark-framework/js/web3.js"
@ -96,3 +96,7 @@ module.exports = (grunt) ->
contracts: '<%= files.contracts.src %>' contracts: '<%= files.contracts.src %>'
dest: 'generated/tmp/abi.js' dest: 'generated/tmp/abi.js'
@initEmbarkConfig = (userConfig) =>
hashmerge = require('hashmerge')
hashmerge(@embarkConfig, userConfig)