Simplifies launching Titanium apps to the simulator/emulator by allowing the use of aliases rather than UDIDs / emulator names.
Turns this:
ti build -p ios -C 779CA28E-FE7D-4B2F-AF49-48CBCBC7B8D5
Into this:
ti build -p ios -C ipad_2
Generically:
ti build -p <platform> -C <alias>
You can even ommit the platform and SimpleSim will try to detect it based on the emulator/simulator
ti build -C <alias>
Install from NPM or clone the repo and install from your local directory.
# preferred
[sudo] npm install -g simplesim
# or non-globally
npm install simplesim
# generate the aliases and install the CLI plug-in
# if installed globally
simplesim generate
# if installed non-globally
node <install_dir>/index.js generate
The list of device aliases is saved to the ~/.titanium/simplesim.json file. You're welcome to edit that file to create custom or more mnemonic aliases. But keep in mind that you will need to update the aliases list every time you update Xcode or add/remove an Android AVD which will overwrite any customizations you make.
Commands:
// get help output
simplesim
simplesim -h
simplesim --help
// generate the list of aliases and install the CLI plug-in
simplesim generate
simplesim -g
simplesim --generate-aliases
// alternatively, omit the geny_ or avd_ prefixes
simplesim generate --no-prefix
simplesim -g --no-prefix
simplesim --generate-aliases --no-prefix
// list the aliases without rebuilding
simplesim list
simplesim --list
simplesim -l
// get version info
simplesim --version
simplesim -v
To uninstall SimpleSim:
# First, remove the CLI hook and config file
simplesim uninstall
# Second, remove SimpleSim itself
sudo npm r -g simplesim
Manual method:
npm r
as shown above.SimpleSim has two parts: a script to build a list of aliases for UDIDs / AVD names, and a CLI plug-in. The alias-building script uses the ti info
command to retrieve the details from your Titanium configuration. It parses the results and writes them to a JSON file in the .titanium folder in your home directory.
The CLI plug-in hooks into the CLI at the cli:go
step, which is before the CLI arguments are parsed. It looks for the required -C
(or --device-id
) argument. If found, it looks up the argument's value in the JSON file. If there's a match, that's substituted for the original value of the argument and the build proceeds. If there's not a match (like if you entered an actual UDID), SimpleSim gives up and the build procees.
So far, tested on OS X only, with working Xcode and Android configurations. Needs to be tested on Windows and with incomplete configurations (e.g. OS X w/out Android set up).
The MIT License (MIT)
Copyright (c) 2014 Tim Poulsen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.