18
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Titanium CLI まとめ

Posted at

普段良く使うTitanium CLIのコマンドをメモしておきます。

CLI インストール

TitaniumにはAlloyというMVCフレームワークがあるので、
WEBエンジニアは取っ付きやすいと思います。
普段Alloyで開発しているので、こちらもインストールしていきます。

$ npm install -g titanium
$ npm install -g alloy

$ ti -v
3.3.0

$ alloy -v
1.4.1

セットアップ+SDKインストール

# セットアップ
$ titanium setup
# 以下のようにtitaniumをtiに省略しても実行できます
$ ti setup

# SDKのインストール
$ ti sdk install

# SDKの確認
$ ti sdk list
Titanium Command-Line Interface, CLI version 3.3.0, Titanium SDK version 3.3.0.GA
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.

Please report bugs to http://jira.appcelerator.org/

SDK Install Locations:
   /Library/Application Support/Titanium
   /Users/hogehoge/Library/Application Support/Titanium [default]
 
Installed SDKs:
   3.3.0.GA [selected]  /Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.3.0.GA
   3.2.3.GA             /Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.2.3.GA
   3.2.0.GA             /Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.2.0.GA
   3.1.1.GA             /Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.1.1.GA
   3.1.0.GA             /Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.1.0.GA
   3.0.0.GA             /Users/hogehoge/Library/Application Support/Titanium/mobilesdk/osx/3.0.0.GA


# 設定の確認
$ ti info

プロジェクトの作成

$ ti create --type=app --name=appname --id=com.domain.appname --platforms=android,ipad,iphone,mobileweb --url=http://appname.com
$ cd appname
$ alloy new
       .__  .__                
_____  |  | |  |   ____ ___.__.
\__  \ |  | |  |  /  _ <   |  |
 / __ \|  |_|  |_(  <_> )___  |
(____  /____/____/\____// ____|
     \/                 \/
Alloy 1.4.1 by Appcelerator. The MVC app framework for Titanium.

[INFO] Deployed ti.alloy plugin to plugins/ti.alloy/plugin.py
[INFO] Deployed ti.alloy hook to plugins/ti.alloy/hooks/alloy.js
[INFO] Installed "ti.alloy" plugin to tiapp.xml
[INFO] Generated new project at: app

iPhoneシミュレータにビルド

$ ti build -p iphone

iPhone端末にビルド

$ ti build -p iphone -T device 

AppStore用にビルド

/dist/appname.ipaファイルが作られる

$ ti build -p iphone -T dist-appstore 

Android端末にビルド

/build/android/bin/appname.apkファイルが作られる

$ ti build -p android -T device

TiShadowのインストール

コードの変更が即時反映されるので、毎回ビルドしなくても確認できるようになります。ただし、serviceが動かない、modelが使えないなど幾つか問題があるので、プロジェクトの初期で画面のUIを設定する際に使ってます。

$  npm install -g tishadow

シュミレータ上でTiShadowビルド

※端末も同じく device の後ろに --shadowをつければ使えます。

$ ti build -p iphone --shadow

余談

androidのエミュレータはGenymotionを使うのがいいです。
デフォルトはビルドが遅すぎてイライラしてしまうので
http://www.genymotion.com/

18
19
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
18
19

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?