From f853657f838e5dbcf0ce0a4a9b434564820aaf4f Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Thu, 4 Jun 2015 07:12:00 -0400 Subject: [PATCH] improve config hash to fix issues requiring files in a specific order --- boilerplate/Gruntfile.coffee | 95 +++++++++++++++++++----------------- boilerplate/package.json | 3 +- package.json | 3 +- tasks/_gruntfile.coffee | 6 ++- 4 files changed, 58 insertions(+), 49 deletions(-) diff --git a/boilerplate/Gruntfile.coffee b/boilerplate/Gruntfile.coffee index 6000e1fc..43bfd86c 100644 --- a/boilerplate/Gruntfile.coffee +++ b/boilerplate/Gruntfile.coffee @@ -1,53 +1,56 @@ 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.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) # Loads all plugins that match "grunt-", in this case all of our current plugins require('matchdep').filterAll('grunt-*').forEach(grunt.loadNpmTasks) diff --git a/boilerplate/package.json b/boilerplate/package.json index 3a58328d..80fe87bc 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -27,6 +27,7 @@ "shelljs": "^0.4.0", "string": "^3.1.1", "web3": "^0.4.3", - "wrench": "^1.5.8" + "wrench": "^1.5.8", + "hashmerge": "^1.0.2" } } diff --git a/package.json b/package.json index accca0f7..559affe3 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "read-yaml": "^1.0.0", "shelljs": "^0.5.0", "web3": "^0.4.3", - "wrench": "^1.5.8" + "wrench": "^1.5.8", + "hashmerge": "^1.0.2" }, "author": "Iuri Matias ", "contributors": [], diff --git a/tasks/_gruntfile.coffee b/tasks/_gruntfile.coffee index 652571a4..f8c8f94b 100644 --- a/tasks/_gruntfile.coffee +++ b/tasks/_gruntfile.coffee @@ -1,6 +1,6 @@ module.exports = (grunt) -> - grunt.initConfig + @embarkConfig = files: web3: "node_modules/embark-framework/js/web3.js" @@ -96,3 +96,7 @@ module.exports = (grunt) -> contracts: '<%= files.contracts.src %>' dest: 'generated/tmp/abi.js' + @initEmbarkConfig = (userConfig) => + hashmerge = require('hashmerge') + hashmerge(@embarkConfig, userConfig) +