tn

Titanium CLI hook that makes 'ti build' a lot smarter!

TiNy CLI

TiNy is a hook for the Titanium CLI's build command that allows you to do the same using less keystrokes. It has built-in recipes, but also allows you to compose and save your own recipes.

WARNING: Version 2.0 is a complete rewrite with lots of breaking changes!

Quick Start

  1. Install TiNy via NPM:

    sudo npm install -g tn --unsafe-perm

    You need --unsafe-perm to allow TiNy to hook into the Titanium CLI.

  2. If for some reason hooking into the Titanium CLI still failed, use the TiNY CLI for this:

    tn install
  3. Build a project to the iPad simulator using the built-in default ipad recipe:

    ti build --ipad
    ti b --ipad
    ti --ipad
    ti ipad

    NOTE: All of the above do the same. The first 3 use the recipe as a flag/option. The second one uses one of the command aliases. TiNy will assume the build command if the first argument is a flag/option like the 3rd example. The last one shows you can also use a recipe as a command.

  4. Compose a custom recipes mixing others (--ah) and an option value (%s):

    tn save ci \
    -b \
    --pp-uuid 37304C9F-B2E0-490A-9800-0448A33BECE9 \
    --distribution-name "Jeff Haynie (E8978765FC)" \
    --ah \
    --installr --installr-release-notes %s
  5. Ship it:

    ti ci "a great update"

New since 2.0.0 are command aliasses for all of the Titanium CLI's commands. A nice bonus so you can run ti i instead of ti info. If ti is followed by an option or flag TiNy assumes the build command so that ti b --ipad can be just ti --ipad.

aliascommand
bbuild
clclean
cfconfig
crcreate
hhelp
iinfo
lilogin
lologout
mmodule
plplugin
prproject
sdsdk
susetup
ststatus

A recipe is simply a flag or option that stands for a group of other arguments, which may in turn include other recipes. There are built-in recipes, but you can also add your own or override built-ins.

  • List all recipes: tn list

Colors will show you which recipes are built-in, user and user-overrides.

Most recipes are flags, but a receipe can also be an option. If a recipe is followed by an argument value, TiNy assumes the recipe to be an option and replace any occurences of %s in the recipe with the value. See step 4 of the Quick Start for an example.

These are the current built-in recipes. If you have handy custom recipes you think everybody should have, please send a PR or open a ticket to have them added to the built-ins.

  • NOTE: Don't forget that since 2.0 you need ti --[name].
namerecipe
android--platform android
blackberry--platform blackberry
ios--platform ios
mobileweb--platform mobileweb
tizen--platform tizen
ipad--device-family ipad
iphone--device-family iphone
ip--iphone
universal--device-family universal
uni--universal
appstore--ios --target dist-appstore
as--appstore
playstore--android --target dist-playstore
play--playstore
ps--playstore
distribute--blackberry --target distribute
dist--distribute
adhoc--ios --target dist-adhoc
ah--adhoc
emulator--target emulator
emu--emulator
simulator--target simulator
sim--simulator
device--target device
ioses--ios --device --device-id all
droid--android --device
desktop-output-dir ~/Desktop
ip7--sim-version 7.1 --sim-type iphone
ip6--sim-version 6.1 --sim-type iphone
ipad7--sim-version 7.1 --sim-type ipad
ipad6--sim-version 6.1 --sim-type ipad
key-password--key-password %s --key-password %s --platform android
android-sdk--android-sdk %s --platform android
avd-abi--avd-abi %s --platform android
keystore--keystore %s --platform android
alias--alias %s --platform android
store-password--store-password %s --platform android
avd-skin--avd-skin %s --platform android
ip-address--ip-address %s --platform blackberry
debug-token--debug-token %s --platform blackberry
keystore-password--keystore-password %s --platform blackberry
ndk--ndk %s --platform blackberry
password--password %s --platform blackberry
force-copy--force-copy --platform ios
force-copy-all--force-copy-all --platform ios
retina--retina --platform ios
sim-64bit--sim-64bit --platform ios
sim-focus--sim-focus --platform ios
tall--tall --retina --platform ios
device-family--device-family %s --platform ios
ios-version--ios-version %s --platform ios
pp-uuid--pp-uuid %s --platform ios
distribution-name--distribution-name %s --platform ios
sim-version--sim-version %s --target simulator --platform ios
keychain--keychain %s --platform ios
developer-name--developer-name %s --target device --platform ios
sim-type--sim-type %s --target simulator --platform ios

The user recipes are stored in ~/.tn.json and override built-in recipes sharing the same name. Use the TiNy CLI to edit them:

tn save ios --target android # overrides the built-in ios-recipe
tn rename ios confusing      # restores the built-in ios-recipe
tn remove confusing          # deletes the confusing custom recipe
tn reset                     # deletes the ~/.tn.json file

You can generate user recipes for all connected devices, emulators and simulators by running tn generate. This will automatically create new recipes like:

  iphone-5s: --platform ios --target simulator --device-id 2592EB13-534C-4E05-8D58-110D0261BDE3
  iphone-5s-ios71: --platform ios --target simulator --device-id 2AE900F4-4349-4AD9-9AC4-CFD881BD5877
  iphone-fokke: --platform ios --target device --device-id daf492502fffe744842280370ed6dcc740eda657
  samsung-galaxy-s4-43-api-18-1080x1920: --platform android --target emulator --device-id "Samsung Galaxy S4 - 4.3 - API 18 - 1080x1920"

Project recipes override both user and built-in recipes. The are stored in the current working directory in a file called tn.json. To edit this file instead of the global user file add project before the save, rename, remove and reset commands:

tn project save ios --target android # overrides the built-in (and custom) ios-recipe
tn project rename ios confusing      # restores the built-in (or custom) ios-recipe
tn project remove confusing          # deletes the confusing custom recipe
tn project reset                     # deletes the tn.json file

Any recipe can be used as a command as well. Like the Quick Start shows you can do ti ipad instead of ti --ipad. If the first argument is a valid recipe name TiNy will turn it into a flag/option and continue as normal.

Add --skip to skip TiNy's magic.

If you want to know exactly what TiNy is doing, e.g. when you're composing a new recipe, you can enable verbose-mode by passing --verbose as one of the arguments. Apart from showing how TiNy cooks the end-result, it will also pause before actually executing it, asking if you want to save it as a recipe, just run it or exit.

TiNy will convert abbreviations (-T) to their full names (--target). It needs to this for the next feature.

TiNy will resolve any duplicate options and flags in order of appearance.

Two other commands only briefly mentioned in the Quick Start are for installing (tn install) and uninstalling (tn uninstall) TiNy as a hook for the Titanium CLI. These are executed automatically when you install or uninstall TiNy over NPM.

  • Restore some of the smarts lost in the 2.0 rewrite.
  • Add more built-in recipes.
  • 2.2.0: Adds generating device/emulator/simulator recipes (tn generate).
  • 2.1.0: Re-introduces command recipes (and fixes postinstall for npm link).
  • 2.0.0: Rewrite using traditional flags/options format for recipes.
  • 1.0.0: Rewrite dropping support for T=emulator and T:emulator notations.
  • 0.1.0: Original version.

When you find issues, please report them. Be sure to include all of the output from the gittio command that didn't work as expected. Also please check if there's not already in issue for it.

Copyright 2013-2014 Fokke Zandbergen

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.