support both meteor and grunt config files
This commit is contained in:
parent
9a4e62072f
commit
1f03a4e962
28
bin/embark
28
bin/embark
|
@ -6,6 +6,7 @@ var wrench = require('wrench');
|
||||||
var grunt = require('grunt');
|
var grunt = require('grunt');
|
||||||
require('shelljs/global');
|
require('shelljs/global');
|
||||||
var readYaml = require('read-yaml');
|
var readYaml = require('read-yaml');
|
||||||
|
var Embark = require('embark-framework');
|
||||||
|
|
||||||
var run = function(cmd) {
|
var run = function(cmd) {
|
||||||
if (exec(cmd).code != 0) {
|
if (exec(cmd).code != 0) {
|
||||||
|
@ -30,23 +31,22 @@ program.command('new [name]').description('New application').action(function(nam
|
||||||
console.log('\n\ninit complete');
|
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 env = env_ || 'development';
|
||||||
var embarkConfig = readYaml.sync("./embark.yml");
|
var embarkConfig = readYaml.sync("./embark.yml");
|
||||||
|
|
||||||
contractFiles = grunt.file.expand(embarkConfig.contracts);
|
if (embarkConfig.type === "grunt") {
|
||||||
destFile = embarkConfig.output
|
run("grunt deploy_contracts:" + env);
|
||||||
Embark = require('embark-framework')
|
}
|
||||||
Embark.init()
|
else {
|
||||||
Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig)
|
contractFiles = grunt.file.expand(embarkConfig.contracts);
|
||||||
Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig)
|
destFile = embarkConfig.output
|
||||||
abi = Embark.deployContracts(env, contractFiles, destFile)
|
Embark.init()
|
||||||
grunt.file.write(destFile, abi);
|
Embark.blockchainConfig.loadConfigFile(embarkConfig.blockchainConfig)
|
||||||
});
|
Embark.contractsConfig.loadConfigFile(embarkConfig.contractsConfig)
|
||||||
|
abi = Embark.deployContracts(env, contractFiles, destFile)
|
||||||
program.command('deploy [env]').description('deploy contracts').action(function(env_) {
|
grunt.file.write(destFile, abi);
|
||||||
var env = env_ || 'development';
|
}
|
||||||
run("grunt deploy_contracts:" + env);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
program.command('build [env]').description('build dapp').action(function(env_) {
|
program.command('build [env]').description('build dapp').action(function(env_) {
|
||||||
|
|
Loading…
Reference in New Issue