@@ -14,8 +14,18 @@ var run = function(cmd) {
1414 }
1515}
1616
17+ var deploy = fnction ( embarkConfig ) {
18+ contractFiles = grunt . file . expand ( embarkConfig . contracts ) ;
19+ destFile = embarkConfig . output
20+ Embark . init ( )
21+ Embark . blockchainConfig . loadConfigFile ( embarkConfig . blockchainConfig )
22+ Embark . contractsConfig . loadConfigFile ( embarkConfig . contractsConfig )
23+ abi = Embark . deployContracts ( env , contractFiles , destFile )
24+ grunt . file . write ( destFile , abi ) ;
25+ }
26+
1727program
18- . version ( '0.5 .0' )
28+ . version ( '0.6 .0' )
1929
2030program . command ( 'new [name]' ) . description ( 'New application' ) . action ( function ( name ) {
2131 if ( name === undefined ) {
@@ -39,43 +49,87 @@ program.command('deploy [env]').description('deploy contracts').action(function(
3949 run ( "grunt deploy_contracts:" + env ) ;
4050 }
4151 else {
42- contractFiles = grunt . file . expand ( embarkConfig . contracts ) ;
43- destFile = embarkConfig . output
44- Embark . init ( )
45- Embark . blockchainConfig . loadConfigFile ( embarkConfig . blockchainConfig )
46- Embark . contractsConfig . loadConfigFile ( embarkConfig . contractsConfig )
47- abi = Embark . deployContracts ( env , contractFiles , destFile )
48- grunt . file . write ( destFile , abi ) ;
52+ deploy ( ) ;
4953 }
5054} ) ;
5155
5256program . command ( 'build [env]' ) . description ( 'build dapp' ) . action ( function ( env_ ) {
5357 var env = env_ || 'development' ;
54- run ( "grunt clean" ) ;
55- run ( "grunt deploy_contracts:" + env ) ;
56- run ( 'grunt build:' + env ) ;
58+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
59+
60+ if ( embarkConfig . type === "grunt" ) {
61+ run ( "grunt clean" ) ;
62+ run ( "grunt deploy_contracts:" + env ) ;
63+ run ( 'grunt build:' + env ) ;
64+ }
65+ else if ( embarkConfig . type === "meteor" ) {
66+ deploy ( ) ;
67+ run ( "meteor-build-client ./build -p ''" ) ;
68+ }
5769} ) ;
5870
5971program . command ( 'ipfs [env]' ) . description ( 'build dapp and make it available in ipfs' ) . action ( function ( env_ ) {
6072 var env = env_ || 'development' ;
61- run ( "grunt clean" )
62- run ( "grunt deploy_contracts:" + env )
63- run ( 'grunt build:' + env )
64- run ( 'grunt ipfs:' + env )
73+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
74+
75+ if ( embarkConfig . type === "grunt" ) {
76+ run ( "grunt clean" )
77+ run ( "grunt deploy_contracts:" + env )
78+ run ( 'grunt build:' + env )
79+ run ( 'grunt ipfs:' + env )
80+ }
81+ else if ( embarkConfig . type === "meteor" ) {
82+ deploy ( ) ;
83+ run ( "meteor-build-client ./build -p ''" ) ;
84+ Embark . release . ipfs ( "build/" )
85+ }
86+ else {
87+ console . log ( "command not available in manual mode yet" ) ;
88+ }
6589} ) ;
6690
6791program . command ( 'run [env]' ) . description ( 'run dapp' ) . action ( function ( env_ ) {
6892 var env = env_ || 'development' ;
69- run ( 'grunt deploy:' + env ) ;
93+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
94+
95+ if ( embarkConfig . type === "grunt" ) {
96+ run ( 'grunt deploy:' + env ) ;
97+ }
98+ else {
99+ console . log ( "command not available in meteor or manual mode yet" ) ;
100+ console . log ( "try instead embark run" ) ;
101+ }
70102} ) ;
71103
72104program . command ( 'spec' ) . description ( 'run specs' ) . action ( function ( ) {
73- run ( 'jasmine' ) ;
105+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
106+
107+ if ( embarkConfig . type === "grunt" ) {
108+ run ( 'jasmine' ) ;
109+ }
110+ else {
111+ console . log ( "command not available in meteor or manual mode yet" ) ;
112+ console . log ( "note: you can use embark tests with any framework" ) ;
113+ }
74114} ) ;
75115
76116program . command ( 'blockchain [env]' ) . description ( 'run blockchain' ) . action ( function ( env_ ) {
77117 var env = env_ || 'development' ;
78- run ( 'grunt blockchain:' + env ) ;
118+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
119+
120+ if ( embarkConfig . type === "grunt" ) {
121+ run ( 'grunt blockchain:' + env ) ;
122+ }
123+ else {
124+ Embark . init ( )
125+ Embark . blockchainConfig . loadConfigFile ( embarkConfig . blockchainConfig )
126+ Embark . contractsConfig . loadConfigFile ( embarkConfig . contractsConfig )
127+
128+ //TODO: better with --exec, but need to fix console bug first
129+ wrench . copyDirSyncRecursive ( __dirname + "/../js" , "/tmp" , { forceDelete : true } ) ;
130+
131+ Embark . startBlockchain ( env , true ) ;
132+ }
79133} ) ;
80134
81135program . command ( 'demo' ) . description ( 'create a working dapp with a SimpleStorage contract' ) . action ( function ( ) {
@@ -93,6 +147,14 @@ program.command('demo').description('create a working dapp with a SimpleStorage
93147 console . log ( '\n\ninit complete' ) ;
94148} ) ;
95149
150+ program . command ( 'meteor_demo' ) . description ( 'create a working meteor dapp with a SimpleStorage contract' ) . action ( function ( ) {
151+ var boilerPath = path . join ( __dirname + '/../demo_meteor' ) ;
152+
153+ var targetDir = "./embark_demo" ;
154+ wrench . copyDirSyncRecursive ( boilerPath , targetDir ) ;
155+ console . log ( '\n\ninit complete' ) ;
156+ } ) ;
157+
96158program . parse ( process . argv )
97159
98160if ( ! process . argv . slice ( 2 ) . length ) {
0 commit comments