Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

create 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/usr/bin/env node
  2. /*
  3. Licensed to the Apache Software Foundation (ASF) under one
  4. or more contributor license agreements. See the NOTICE file
  5. distributed with this work for additional information
  6. regarding copyright ownership. The ASF licenses this file
  7. to you under the Apache License, Version 2.0 (the
  8. "License"); you may not use this file except in compliance
  9. with the License. You may obtain a copy of the License at
  10. http://www.apache.org/licenses/LICENSE-2.0
  11. Unless required by applicable law or agreed to in writing,
  12. software distributed under the License is distributed on an
  13. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  14. KIND, either express or implied. See the License for the
  15. specific language governing permissions and limitations
  16. under the License.
  17. */
  18. // var path = require('path');
  19. // var create = require('./lib/create');
  20. // var args = process.argv;
  21. // // Support basic help commands
  22. // if(args.length < 3 || (args[2] == '--help' || args[2] == '/?' || args[2] == '-h' ||
  23. // args[2] == 'help' || args[2] == '-help' || args[2] == '/help')) {
  24. // console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name>');
  25. // console.log(' <path_to_new_project>: Path to your new Cordova Browser project');
  26. // console.log(' <package_name>: Package name, following reverse-domain style convention');
  27. // console.log(' <project_name>: Project name');
  28. // process.exitCode = 1;
  29. // } else {
  30. // create.createProject(args[2], args[3], args[4], args[5]);
  31. // }
  32. /*
  33. * create a Cordova project
  34. *
  35. * USAGE
  36. * ./create <path_to_new_project> <package_name> <project_name>
  37. *
  38. * EXAMPLE
  39. * ./create ~/Desktop/radness org.apache.cordova.radness Radness
  40. */
  41. var path = require('path');
  42. var ConfigParser = require('cordova-common').ConfigParser;
  43. var Api = require('./template/cordova/Api');
  44. var argv = require('nopt')({
  45. 'help' : Boolean,
  46. 'cli' : Boolean,
  47. 'shared' : Boolean, // alias for --link
  48. 'link' : Boolean
  49. }, { 'd' : '--verbose' });
  50. var projectPath = argv.argv.remain[0];
  51. if (argv.help || !projectPath) {
  52. console.log('Usage: $0 [--link] [--cli] <path_to_new_project> <package_name> <project_name> [<project_template_dir>]');
  53. console.log(' --link (optional): Link directly against the shared copy of the CordovaLib instead of a copy of it.');
  54. console.log(' --cli (optional): Use the CLI-project template.');
  55. console.log(' <path_to_new_project>: Path to your new Cordova iOS project');
  56. console.log(' <package_name>: Package name, following reverse-domain style convention');
  57. console.log(' <project_name>: Project name');
  58. console.log(' <project_template_dir>: Path to project template (override).');
  59. process.exit(0);
  60. }
  61. else {
  62. var configPath = path.resolve(__dirname, 'template/config.xml');
  63. var config = new ConfigParser(configPath);
  64. // apply overrides (package and project names
  65. if (argv.argv.remain[1]) {
  66. config.setPackageName(argv.argv.remain[1]);
  67. }
  68. if (argv.argv.remain[2]) {
  69. config.setName(argv.argv.remain[2]);
  70. }
  71. var options = {
  72. cli: argv.cli,
  73. link: argv.link || argv.shared,
  74. customTemplate: argv.argv.remain[3],
  75. };
  76. Api.createPlatform(projectPath, config, options);
  77. }