source: src/app/node_modules/cordova-android/bin/create@ 5aba41a

app-cordova
Last change on this file since 5aba41a was 3196285, checked in by Joachim Langenbach <joachim.langenbach@…>, 9 years ago

First step to cordova apps

  • Property mode set to 100755
File size: 2.5 KB
Line 
1#!/usr/bin/env node
2
3/*
4 Licensed to the Apache Software Foundation (ASF) under one
5 or more contributor license agreements. See the NOTICE file
6 distributed with this work for additional information
7 regarding copyright ownership. The ASF licenses this file
8 to you under the Apache License, Version 2.0 (the
9 "License"); you may not use this file except in compliance
10 with the License. You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing,
15 software distributed under the License is distributed on an
16 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 KIND, either express or implied. See the License for the
18 specific language governing permissions and limitations
19 under the License.
20*/
21var path = require('path');
22var ConfigParser = require('cordova-common').ConfigParser;
23var Api = require('./templates/cordova/Api');
24
25var argv = require('nopt')({
26 'help' : Boolean,
27 'cli' : Boolean,
28 'shared' : Boolean,
29 'link' : Boolean,
30 'activity-name' : [String, undefined]
31}, { 'd' : '--verbose' });
32
33if (argv.help || argv.argv.remain.length === 0) {
34 console.log('Usage: ' + path.relative(process.cwd(), path.join(__dirname, 'create')) + ' <path_to_new_project> <package_name> <project_name> [<template_path>] [--activity-name <activity_name>] [--link]');
35 console.log(' <path_to_new_project>: Path to your new Cordova Android project');
36 console.log(' <package_name>: Package name, following reverse-domain style convention');
37 console.log(' <project_name>: Project name');
38 console.log(' <template_path>: Path to a custom application template to use');
39 console.log(' --activity-name <activity_name>: Activity name');
40 console.log(' --link will use the CordovaLib project directly instead of making a copy.');
41 process.exit(1);
42}
43
44var config = new ConfigParser(path.resolve(__dirname, 'templates/project/res/xml/config.xml'));
45
46if (argv.argv.remain[1]) config.setPackageName(argv.argv.remain[1]);
47if (argv.argv.remain[2]) config.setName(argv.argv.remain[2]);
48if (argv['activity-name']) config.setName(argv['activity-name']);
49
50var options = {
51 link: argv.link || argv.shared,
52 customTemplate: argv.argv.remain[3],
53 activityName: argv['activity-name']
54};
55
56require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv);
57
58Api.createPlatform(argv.argv.remain[0], config, options).done();
Note: See TracBrowser for help on using the repository browser.