Project: titanium
Issue TIMOB-17699: CLI: Running "ti build -p iOS -T simulator --no-prompt" command outside project directory throws error 'cannot read property deployment-targets of undefined'.
Description: Running "ti build -p iOS -T simulator --no-prompt" command outside the project directory throws error instead of giving proper error message for required fields. This is a regression.With CLI 3.3.0 and Titanium SDK 3.3.0.GA, command gives the proper error message for the missing parameter instead of throwing an error. [ERROR] Invalid "--project-dir" value "." STEPS TO REPRODUCE:- 1. Open a terminal window 2. Create a project in the workspace and don't cd to the project. 3. Run "ti build -p ios -T simulator --no-prompt" command outside the project directory. EXPECTED RESULT 3. The CLI should give proper message for the required missing parameter instead of throwing an error 'cannot read property deployment-targets of undefined'. ACTUAL RESULT 4. The CLI throws an error 'Cannot read property 'deployment-targets' of undefined' instead of giving proper error message to user for required missing parameter. {code} KAGRAWAL-MBP:~ kagrawal$ ti build -p ios -T simulator --no-prompt Titanium Command-Line Interface, CLI version 3.4.0-rc3, Titanium SDK version 3.4.0.v20140915175720 Copyright (c) 2012-2014, Appcelerator, Inc. All Rights Reserved. Please report bugs to http://jira.appcelerator.org/ /usr/local/lib/node_modules/titanium/node_modules/longjohn/dist/longjohn.js:185 throw e; ^ TypeError: Cannot read property 'deployment-targets' of undefined at iOSBuilder.getDeviceFamily (/Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/iphone/cli/commands/_build.js:239:37) at callback.options.device-id.verifyIfRequired (/Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/iphone/cli/commands/_build.js:570:29) at CLI. (/usr/local/lib/node_modules/titanium/lib/cli.js:606:16) at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:551:21 at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:227:13 at iterate (/usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:134:13) at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:145:25 at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:229:17 at /usr/local/lib/node_modules/titanium/node_modules/async/lib/async.js:556:34 at CLI. (/usr/local/lib/node_modules/titanium/lib/cli.js:664:9) --------------------------------------------- at Object.run (/Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/node_modules/node-appc/lib/subprocess.js:59:8) at async.eachSeries.cache (/Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/node_modules/ioslib/lib/simulator.js:186:21) at iterate (/Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/node_modules/ioslib/node_modules/async/lib/async.js:149:13) at /Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/node_modules/ioslib/node_modules/async/lib/async.js:160:25 at /Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/node_modules/ioslib/lib/simulator.js:227:7 at ChildProcess. (/Users/kagrawal/Library/Application Support/Titanium/mobilesdk/osx/3.4.0.v20140915175720/node_modules/node-appc/lib/subprocess.js:60:3) at EventEmitter.emit (events.js:98:17) KAGRAWAL-MBP:~ kagrawal$ {code}
Story points: 3