From 9579ea3b914d705769b5cd8d4fe91bb35f6bb34c Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 14 Jul 2015 19:43:21 -0400 Subject: [PATCH] remove grunt; use grunt plugin --- bin/embark | 2 +- boilerplate/Gruntfile.coffee | 130 ++++++++++++++++++++++++----------- boilerplate/package.json | 3 +- package.json | 2 +- tasks/_gruntfile.coffee | 102 --------------------------- tasks/blockchain.coffee | 9 --- tasks/deploy.coffee | 17 ----- tasks/ipfs.coffee | 7 -- tasks/server.coffee | 21 ------ tasks/tasks.coffee | 5 -- 10 files changed, 93 insertions(+), 205 deletions(-) delete mode 100644 tasks/_gruntfile.coffee delete mode 100644 tasks/blockchain.coffee delete mode 100644 tasks/deploy.coffee delete mode 100644 tasks/ipfs.coffee delete mode 100644 tasks/server.coffee delete mode 100644 tasks/tasks.coffee diff --git a/bin/embark b/bin/embark index 366aa22b..a370d9b7 100644 --- a/bin/embark +++ b/bin/embark @@ -15,7 +15,7 @@ var run = function(cmd) { } program - .version('0.5.0') + .version('0.6.0') program.command('new [name]').description('New application').action(function(name) { if (name === undefined) { diff --git a/boilerplate/Gruntfile.coffee b/boilerplate/Gruntfile.coffee index 43bfd86c..d6f56819 100644 --- a/boilerplate/Gruntfile.coffee +++ b/boilerplate/Gruntfile.coffee @@ -1,54 +1,102 @@ module.exports = (grunt) -> - grunt.loadNpmTasks "embark-framework" + grunt.loadNpmTasks "grunt-embark" grunt.initConfig( - @initEmbarkConfig( - files: - js: - src: [ - "app/js/**/*.js" - ] + files: + web3: + "node_modules/embark-framework/js/web3.js" - css: - src: [ - "app/css/**/*.css" - ] + js: + src: [ + "app/js/**/*.js" + ] - html: - src: [ - "app/html/**/*.html" - ] + css: + src: [ + "app/css/**/*.css" + ] - contracts: - src: [ - "app/contracts/**/*.sol" - ] + html: + src: [ + "app/html/**/*.html" + ] - 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" + coffee: + dest: "generated/dapp/compiled-coffee" + compiled: [ + "generated/dapp/compiled-coffee/app.coffee" + "generated/dapp/compiled-coffee/**/*.js" + ] - 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 %>' + contracts: + src: [ + "app/contracts/**/*.sol" + ] - deploy: - contracts: '<%= files.contracts.src %>' - dest: 'generated/tmp/abi.js' - ) + 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' ) # loading external tasks (aka: plugins) diff --git a/boilerplate/package.json b/boilerplate/package.json index c3af2fe4..79f289bd 100644 --- a/boilerplate/package.json +++ b/boilerplate/package.json @@ -10,7 +10,8 @@ "license": "ISC", "homepage": "", "devDependencies": { - "embark-framework": "iurimatias/embark-framework#develop", + "embark-framework": "/Users/iurimatias/Projects/embark-framework", + "grunt-embark": "/Users/iurimatias/Projects/grunt-embark", "grunt-contrib-clean": "^0.6.0", "grunt-contrib-coffee": "^0.13.0", "grunt-contrib-concat": "^0.5.1", diff --git a/package.json b/package.json index f5343263..46af2d2d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "embark-framework", - "version": "0.5.0", + "version": "0.6.0", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" diff --git a/tasks/_gruntfile.coffee b/tasks/_gruntfile.coffee deleted file mode 100644 index f8c8f94b..00000000 --- a/tasks/_gruntfile.coffee +++ /dev/null @@ -1,102 +0,0 @@ -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) - diff --git a/tasks/blockchain.coffee b/tasks/blockchain.coffee deleted file mode 100644 index 4cc574cc..00000000 --- a/tasks/blockchain.coffee +++ /dev/null @@ -1,9 +0,0 @@ -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) - diff --git a/tasks/deploy.coffee b/tasks/deploy.coffee deleted file mode 100644 index 8b92e293..00000000 --- a/tasks/deploy.coffee +++ /dev/null @@ -1,17 +0,0 @@ -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); - diff --git a/tasks/ipfs.coffee b/tasks/ipfs.coffee deleted file mode 100644 index f2b4dc2d..00000000 --- a/tasks/ipfs.coffee +++ /dev/null @@ -1,7 +0,0 @@ -module.exports = (grunt) -> - - grunt.registerTask "ipfs", "distribute into ipfs", (env_) => - env = env_ || "development" - Embark = require('embark-framework') - Embark.release.ipfs("dist/dapp/") - diff --git a/tasks/server.coffee b/tasks/server.coffee deleted file mode 100644 index dfe607c8..00000000 --- a/tasks/server.coffee +++ /dev/null @@ -1,21 +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 - diff --git a/tasks/tasks.coffee b/tasks/tasks.coffee deleted file mode 100644 index 209bafa2..00000000 --- a/tasks/tasks.coffee +++ /dev/null @@ -1,5 +0,0 @@ -module.exports = (grunt) -> - - grunt.registerTask "deploy", ["coffee", "deploy_contracts", "concat", "copy", "server", "watch"] - grunt.registerTask "build", ["clean", "deploy_contracts", "coffee", "concat", "uglify", "copy"] -