From 1f03a4e962711121b2e034a0f5847da3d9f04e80 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Tue, 7 Jul 2015 07:17:13 -0400 Subject: [PATCH] support both meteor and grunt config files --- bin/embark | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/bin/embark b/bin/embark index 5b027321..9910ae16 100644 --- a/bin/embark +++ b/bin/embark @@ -6,6 +6,7 @@ var wrench = require('wrench'); var grunt = require('grunt'); require('shelljs/global'); var readYaml = require('read-yaml'); +var Embark = require('embark-framework'); var run = function(cmd) { if (exec(cmd).code != 0) { @@ -30,23 +31,22 @@ program.command('new [name]').description('New application').action(function(nam console.log('\n\ninit complete'); }); -program.command('meteor [env]').description('experimental meteor cmd').action(function(env_) { +program.command('deploy [env]').description('deploy contracts').action(function(env_) { var env = env_ || 'development'; var embarkConfig = readYaml.sync("./embark.yml"); - contractFiles = grunt.file.expand(embarkConfig.contracts); - destFile = embarkConfig.output - Embark = require('embark-framework') - Embark.init() - Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig) - Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig) - abi = Embark.deployContracts(env, contractFiles, destFile) - grunt.file.write(destFile, abi); -}); - -program.command('deploy [env]').description('deploy contracts').action(function(env_) { - var env = env_ || 'development'; - run("grunt deploy_contracts:" + env); + if (embarkConfig.type === "grunt") { + run("grunt deploy_contracts:" + env); + } + else { + contractFiles = grunt.file.expand(embarkConfig.contracts); + destFile = embarkConfig.output + Embark.init() + Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig) + Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig) + abi = Embark.deployContracts(env, contractFiles, destFile) + grunt.file.write(destFile, abi); + } }); program.command('build [env]').description('build dapp').action(function(env_) {