@@ -51,31 +51,80 @@ program.command('deploy [env]').description('deploy contracts').action(function(
5151
5252program . command ( 'build [env]' ) . description ( 'build dapp' ) . action ( function ( env_ ) {
5353 var env = env_ || 'development' ;
54- run ( "grunt clean" ) ;
55- run ( "grunt deploy_contracts:" + env ) ;
56- run ( 'grunt build:' + env ) ;
54+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
55+
56+ if ( embarkConfig . type === "grunt" ) {
57+ run ( "grunt clean" ) ;
58+ run ( "grunt deploy_contracts:" + env ) ;
59+ run ( 'grunt build:' + env ) ;
60+ }
61+ else if ( embarkConfig . type === "meteor" ) {
62+ //deploy
63+ run ( "meteor-build-client ./build -p ''" ) ;
64+ }
5765} ) ;
5866
5967program . command ( 'ipfs [env]' ) . description ( 'build dapp and make it available in ipfs' ) . action ( function ( env_ ) {
6068 var env = env_ || 'development' ;
61- run ( "grunt clean" )
62- run ( "grunt deploy_contracts:" + env )
63- run ( 'grunt build:' + env )
64- run ( 'grunt ipfs:' + env )
69+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
70+
71+ if ( embarkConfig . type === "grunt" ) {
72+ run ( "grunt clean" )
73+ run ( "grunt deploy_contracts:" + env )
74+ run ( 'grunt build:' + env )
75+ run ( 'grunt ipfs:' + env )
76+ }
77+ else if ( embarkConfig . type === "meteor" ) {
78+ //deploy
79+ //build
80+ Embark = require ( 'embark-framework' )
81+ Embark . release . ipfs ( "build/" )
82+ }
83+ else {
84+ console . log ( "command not available in manual mode yet" ) ;
85+ }
6586} ) ;
6687
6788program . command ( 'run [env]' ) . description ( 'run dapp' ) . action ( function ( env_ ) {
6889 var env = env_ || 'development' ;
69- run ( 'grunt deploy:' + env ) ;
90+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
91+
92+ if ( embarkConfig . type === "grunt" ) {
93+ run ( 'grunt deploy:' + env ) ;
94+ }
95+ else {
96+ console . log ( "command not available in meteor or manual mode yet" ) ;
97+ }
7098} ) ;
7199
72100program . command ( 'spec' ) . description ( 'run specs' ) . action ( function ( ) {
73- run ( 'jasmine' ) ;
101+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
102+
103+ if ( embarkConfig . type === "grunt" ) {
104+ run ( 'jasmine' ) ;
105+ }
106+ else {
107+ console . log ( "command not available in meteor or manual mode yet" ) ;
108+ }
74109} ) ;
75110
76111program . command ( 'blockchain [env]' ) . description ( 'run blockchain' ) . action ( function ( env_ ) {
77112 var env = env_ || 'development' ;
78- run ( 'grunt blockchain:' + env ) ;
113+ var embarkConfig = readYaml . sync ( "./embark.yml" ) ;
114+
115+ if ( embarkConfig . type === "grunt" ) {
116+ run ( 'grunt blockchain:' + env ) ;
117+ }
118+ else {
119+ Embark . init ( )
120+ Embark . blockchainConfig . loadConfigFile ( embarkConfig . blockchainConfig )
121+ Embark . contractsConfig . loadConfigFile ( embarkConfig . contractsConfig )
122+
123+ //TODO: better with --exec, but need to fix console bug first
124+ wrench . copyDirSyncRecursive ( __dirname + "/../js" , "/tmp" , { forceDelete : true } ) ;
125+
126+ Embark . startBlockchain ( env , true ) ;
127+ }
79128} ) ;
80129
81130program . command ( 'demo' ) . description ( 'create a working dapp with a SimpleStorage contract' ) . action ( function ( ) {
@@ -93,6 +142,14 @@ program.command('demo').description('create a working dapp with a SimpleStorage
93142 console . log ( '\n\ninit complete' ) ;
94143} ) ;
95144
145+ program . command ( 'meteor_demo' ) . description ( 'create a working meteor dapp with a SimpleStorage contract' ) . action ( function ( ) {
146+ var boilerPath = path . join ( __dirname + '/../demo_meteor' ) ;
147+
148+ var targetDir = "./embark_demo" ;
149+ wrench . copyDirSyncRecursive ( boilerPath , targetDir ) ;
150+ console . log ( '\n\ninit complete' ) ;
151+ } ) ;
152+
96153program . parse ( process . argv )
97154
98155if ( ! process . argv . slice ( 2 ) . length ) {
0 commit comments