{ "id": "132321", "key": "TIMOB-17227", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-08-29T08:09:37.000+0000", "created": "2014-06-26T23:40:15.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "cli", "ft", "qe-3.3.0", "usability" ], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [ { "id": "39907", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "132208", "key": "TIMOB-17208", "fields": { "summary": "CLI: CLI crashes when \"ti build -d\" and \"ti build -A\" command is run without path values", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "38682", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "121788", "key": "TIMOB-15608", "fields": { "summary": "CLI: Passing empty values in to iOS build options returns an error", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "updated": "2014-09-14T20:13:46.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "13103", "name": "CLI", "description": "Node-based command line interface" } ], "description": "{code}\r\n -d, --project-dir the directory containing the project [default: .]\r\n{code}\r\nWhen running \r\n{code}\r\nti build -d\r\n{code}\r\nthe output in the console is:\r\n{code}\r\n[ERROR] TypeError: Arguments to path.join must be strings\r\n at path.js:360:15\r\n at Array.filter (native)\r\n at exports.join (path.js:358:36)\r\n at conf.options.appc.util.mix.project-dir.callback (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/cli/commands/build.js:101:52)\r\n at Context. (/usr/local/lib/node_modules/titanium/lib/context.js:597:31)\r\n at Array.forEach (native)\r\n at Context.setArg (/usr/local/lib/node_modules/titanium/lib/context.js:576:35)\r\n at Context. (/usr/local/lib/node_modules/titanium/lib/context.js:675:9)\r\n at Context.parse (/usr/local/lib/node_modules/titanium/lib/context.js:772:6)\r\n at processConf (/usr/local/lib/node_modules/titanium/lib/context.js:364:21)\r\n---------------------------------------------\r\n at run (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/node-appc/lib/subprocess.js:59:8)\r\n at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/iphone/cli/lib/detect.js:415:9\r\n at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:511:21\r\n at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:227:13\r\n at /Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:111:13\r\n at Array.forEach (native)\r\n at _each (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:32:24)\r\n at async.each (/Users/oromero/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.v20140626144112/node_modules/async/lib/async.js:110:9)\r\n{code}", "attachment": [], "flagged": false, "summary": "CLI: Passing empty option value, building the project returns Error", "creator": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "oromero", "key": "oromero", "displayName": "Olga Romero", "active": true, "timeZone": "America/Los_Angeles" }, "environment": null, "comment": { "comments": [ { "id": "319756", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "[~fmiao] You are correct, {{\\-d}} should display the same error as {{\\-\\-project\\-dir}}.\r\n\r\nThe problem stems from {{context.js}}, but that's because of a feature, not a bug. The CLI supports flags and options. Flags are in the format {{\\-\\-flag\\-name}} and when encountered, the CLI treats this as {{\\-\\-flag\\-name true}}. Options are in the format {{\\-\\-option\\-name somevalue}}. Because the CLI parser doesn't know of something is a flag or option, it treats them as flags. That means if you specify {{\\-\\-option\\-name}} without a subsequent value, it will set the option value to {{true}}. This herein lies the problem. This is by design.\r\n\r\nSo, while this isn't great, we have a solution. For every option, we simply need to check if the value is a boolean. All option values should be strings even if it is a number or boolean string. So, \"hello world\", \"123\", \"true\" are all valid option values. The option callbacks and validators will need to properly parse the values from the string format.\r\n\r\nAs an example, here's what you need to do:\r\n\r\n{code}\r\n'some-option': {\r\n validate: function (value, callback) {\r\n if (typeof value === 'boolean') {\r\n return callback(true);\r\n }\r\n callback(null, value);\r\n }\r\n}\r\n{code}\r\n\r\nFor a real world example, look at the options in the iOS build script: https://github.com/appcelerator/titanium_mobile/blame/master/iphone/cli/commands/_build.js#L349-L351.\r\n\r\nYou can see I added a bunch of them in this commit: https://github.com/appcelerator/titanium_mobile/commit/5ed0879a77d98cfcce35404a6be098d378224fd3. You just need to find the remaining options that are missing this, add them, and test.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2014-08-21T19:09:56.000+0000", "updated": "2014-08-21T19:09:56.000+0000" }, { "id": "319863", "author": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "body": "[~fmiao] On a Mac, if you do {{\\-\\-}}, it automatically turns it into an \"mdash\". Since an mdash is not a dash, and probably is accidental, we treat {{\\-\\-}} and mdashes the same.", "updateAuthor": { "name": "cbarber", "key": "cbarber", "displayName": "Chris Barber", "active": true, "timeZone": "America/Chicago" }, "created": "2014-08-22T05:05:07.000+0000", "updated": "2014-08-22T05:05:07.000+0000" }, { "id": "320098", "author": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "body": "PR Master: https://github.com/appcelerator/titanium_mobile/pull/5983\r\n\r\nFunctional Test:\r\n1. Create an app:\r\n{code} \r\nti create -t app -d . -n true -u http:// --id com.timob.test\r\n{code}\r\n2. Build the app:\r\n{code}\r\nti build -d \r\n//or\r\nti build --project-dir\r\n{code}\r\nFollowing error message should be shown:\r\n{code}\r\n[ERROR] Invalid project directory \"\" because tiapp.xml not found\r\n{code}\r\n3. Build the app again by passing a value to the option\r\n{code}\r\n// In this case the project happened to be name 'true'\r\nti build -d true\r\n// or\r\nti build --project-dir true\r\n{code}\r\nThe build process should run without error.", "updateAuthor": { "name": "fmiao", "key": "fmiao", "displayName": "Feon Sua Xin Miao", "active": true, "timeZone": "America/Vancouver" }, "created": "2014-08-25T08:47:15.000+0000", "updated": "2014-08-29T08:05:52.000+0000" }, { "id": "321398", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified fix on:\r\n\r\nMac OSX 10.9.4\r\nAppcelerator Studio, build: 3.4.0.201408291834\r\nTitanium SDK build: 3.4.0.v20140829184521 \r\nTitanium CLI, build: 3.4.0-dev\r\nAlloy: 1.5.0-dev\r\n\r\n\r\nCreated a new app and attempted to build using the ti build -project-dir command, after asking for the platform to target it showed the error as expected. I then built and passed in a value and the build process ran without error. The same is shown with the ti build -d command", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-09-02T18:54:30.000+0000", "updated": "2014-09-02T20:09:03.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }