[TIMOB-10772] CLI: "project" command
GitHub Issue | n/a |
---|---|
Type | Sub-task |
Priority | High |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2012-09-17T23:35:20.000+0000 |
Affected Version/s | Release 3.0.0 |
Fix Version/s | Release 3.0.0, Sprint 2012-19 JS, 2012 Sprint 19 |
Components | CLI |
Labels | n/a |
Reporter | Chris Barber |
Assignee | Chris Barber |
Created | 2012-09-04T17:44:22.000+0000 |
Updated | 2017-03-08T00:40:10.000+0000 |
Description
A command that allows you to easily add and edit the tiapp.xml. The keys should be well defined (i.e. deployments, etc).
NOTE: Not all tiapp.xml options should be exposed.
Some keys must trigger an action such as when setting a deployment-target, we need to non-destructively (i.e. check destination does not already exist) copy that deployment-target's resources into the project's Resources dir. We need an optional --template option with a default value "default". This is only used when setting the "deployment-targets" so we know which files to copy.
Model this command after the "config" command in the "titanium" repo.
If --dir is not specified, set the dir to '.' and then check if dir is a Titanium project (i.e. contains a tiapp.xml).
Validate everything: project dir, tiapp.xml exists, tiapp parses correctly, key name, template exists (only copy if exists), source files, destination dir, etc).
This command will need to be done in the titanium_mobile/support/cli/commands/project.js file. Use the super neato tiapp.xml library in titanium-sdk:
// please remember to convert all indent spaces to tabs
var ti = require('titanium-sdk'),
path = require('path');
exports.validate = function (logger, config, cli) {
cli.argv.dir = ti.validateProjectDir(logger, cli.argv.dir);
};
exports.run = function (logger, config, cli) {
var tiapp = new ti.tiappxml(path.join(cli.argv.dir, 'tiapp.xml'));
// check cli.argv._ to see how many args are passed in. check config command for example.
// if no args, show all keys.
// if one arg, validate key name, then show just that one arg's value (no key, no quotes)
// if two args, set the value, save the file, perform any special actions
};
Examples:
list all keys
> titanium project --dir /path/to/project
id = "ti.testapp"
name = "testapp"
version = "1.0"
publisher = "not specified"
description = "not specified"
sdk-version = "3.0.0"
deployment-targets = "android,iphone,mobileweb"
get some values
> titanium project sdk-version --dir /path/to/project
3.0.0
set some values
> titanium project description "My first app" --dir /path/to/project
Description saved
> titanium project deployment-targets android,iphone,mobileweb --dir /path/to/project
Deployment Targets saved
Pull Requests: https://github.com/appcelerator/titanium_mobile/pull/2977 https://github.com/appcelerator/node-appc/pull/2
Closing ticket as resolved.