vwfCli.js 1.1 KB

12345678910111213141516171819202122232425262728
  1. var fs = require( 'fs-extra' ),
  2. path = require( 'path' );
  3. var create = function( applicationPath ) {
  4. if ( fs.existsSync ( applicationPath ) ) {
  5. return false;
  6. }
  7. fs.mkdirpSync( applicationPath );
  8. var home = ( process.env.HOME || process.env.USERPROFILE );
  9. var vwfHome = path.join( home, ".vwf" );
  10. if ( fs.existsSync( path.join( process.cwd(), "support/cli/sample_app/" ) ) ) {
  11. fs.copySync( path.join( process.cwd(), "support/cli/sample_app/" ), applicationPath );
  12. } else if ( fs.existsSync( path.join( vwfHome, "support/cli/sample_app/" ) ) ) {
  13. fs.copySync( path.join( vwfHome, "support/cli/sample_app/" ), applicationPath );
  14. } else if ( process.env.VWF_DIR && fs.existsSync( path.join( process.env.VWF_DIR, "support/cli/sample_app/" ) ) ) {
  15. fs.copySync( path.join( process.env.VWF_DIR, "support/cli/sample_app/" ), applicationPath );
  16. } else {
  17. consoleError( "Could not find VWF support files." );
  18. return false;
  19. }
  20. return true;
  21. }
  22. module.exports.create = create;