りゅーねんせんにん

留年しまくってる学生が書いているブログ。プログラミングから逃げたけどまた立ち向かっている。

Windows7にTitaniumをインストールする

Titanium Studioを使わずコマンドラインからTitaniumをインストールする

実行環境

node.jsの設定

node.jsをインストール

npmコマンドを使いたいのでnode.jsをここからダウンロード
Windowsの64bitなのでnode-v0.10.28-x64.msiをダウンロードからのインストール

nodistをインストール

ここの「Download ZIP」からzipファイルをダウンロード
解凍後,任意の場所に置く
今回はC:\Program Filesの下にフォルダ名を「nodist」に直して設置した
f:id:blog_taro:20140609094808p:plain
システムのプロパティからPATHを通す

その後コマンドプロンプトから以下を実行

>nodist update
(アップデート内容が流れる)

Installing latest stable version...
0.10.28

>nodist -v
0.4.8

>nodist stable
0.10.28

>node -v
v0.10.28

バージョンを指定してインストールしたい(version 0.10.2をインストールする)場合は

>nodist + v0.10.2

以上,node.jsの設定終わり

Titaniumの設定

Titaniumのインストール

>npm install titanium -g
(インストール内容が流れる)

titanium@3.2.3 C:\Users\PC名\AppData\Roaming\npm\node_modules\titanium
├── sprintf@0.1.3
├── longjohn@0.2.4
├── colors@0.6.2
├── humanize@0.0.9
├── async@0.2.10
├── wrench@1.5.8
├── semver@2.2.1
├── fields@0.1.12 (keypress@0.1.0)
├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10)
├── winston@0.6.2 (cycle@1.0.3, eyes@0.1.8, stack-trace@0.0.9, async@0.1.22,pkginfo@0.2.3, request@2.9.203)
├── moment@2.4.0
├── temp@0.6.0 (osenv@0.0.3, rimraf@2.1.4)
├── request@2.27.0 (json-stringify-safe@5.0.0, aws-sign@0.3.0, forever-agent@0.5.2, qs@0.6.6, tunnel-agent@0.3.0, oauth-sign@0.3.0, cookie-jar@0.3.0, mime@1.2.11, node-uuid@1.4.1, hawk@1.0.0, form-data@0.1.3, http-signature@0.10.0)
├── node-appc@0.2.1 (diff@1.0.8, xmldom@0.1.19, node-uuid@1.4.1, semver@2.1.0, adm-zip@0.4.4, dox@0.4.4, uglify-js@2.3.6)
└── jade@0.35.0 (character-parser@1.2.0, commander@2.0.0, mkdirp@0.3.5, transformers@2.1.0, constantinople@1.0.2, with@1.1.1, monocle@1.1.50)

以上でTitanium CLIが使えるようになった
(2014年06月09日時点でのCLIバージョンは3.2.3)

Titanium CLIのバージョン確認

>titanium -v
3.2.3

Titanium SDKのバージョン確認

>titanium sdk list
Titanium Command-Line Interface, CLI version 3.2.3
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.

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

No Titanium SDKs are installed

You can download the latest Titanium SDK by running: titanium sdk install

Titanium SDKが入っていないようなのでインストール

Titanium SDKのインストール

>titanium sdk install
Titanium Command-Line Interface, CLI version 3.2.3
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.

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

Username: 任意のユーザ名
Password: 任意のパスワード

New version available! 3.2.3.GA

Downloading http://api.appcelerator.com/p/v1/release-download?token=94GkvF44
  100% [========================================] 0.1s

Extracting SDK to C:\ProgramData\Titanium
  100% [========================================] 0.0s

Setting Titanium SDK 3.2.3.GA as the default.

Titanium SDK 3.2.3.GA successfully installed!

Username,Passwordはここで登録したメールアドレスとパスワードを入力する

もう一度SDKのバージョン確認をする

>titanium sdk list
Titanium Command-Line Interface, CLI version 3.2.3, Titanium SDK version 3.2.3.GA
Copyright (c) 2012-2014, Appcelerator, Inc.  All Rights Reserved.

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

SDKCLI共にバージョン3.2.3が入っていることが確認できた

alloyの導入

alloyのインストール

>npm -g install alloy
(インストール内容が流れる)

alloy@1.3.1 C:\Users\PC名\AppData\Roaming\npm\node_modules\alloy
├── commander@0.6.1
├── colors@0.6.0-1
├── wrench@1.3.9
├── pkginfo@0.2.2
├── xmldom@0.1.13
├── xml2tss@0.0.5 (xml2js@0.2.8)
├── source-map@0.1.9 (amdefine@0.1.0)
├── uglify-js@2.2.5 (optimist@0.3.7)
└── jsonlint@1.5.1 (nomnom@1.7.0, JSV@4.0.2)

alloyのバージョン確認

>alloy -v
1.3.1

動作確認

プロジェクトの作成

>ti create -p android -n hellotitanium --id com.example.hellotitanium -d ./

alloyの適用

>cd hellotitanium
>alloy new

ビルド

今回はTiShadowを使ってビルドを行う
別のコマンドプロンプトを立ち上げて

>tishadow server
[DEBUG] TiShadow server started. Go to http://localhost:3000
[DEBUG] A socket connected
[INFO] [android, 4.0.4, 192.168.1.3] Connected

接続している実機が確認できた
次は先ほどのプロジェクトを開いているフォルダで

>tishadow run

実行結果

f:id:blog_taro:20140609121612p:plain
背景はシルバーに,最初の文字をHello,Titaniumに変更してみた
Hello, Titaniumの文字がめっちゃ小さいけどこれで完了

まとめ

Titanium Studioを入れると一括でやってくれることを自分で設定すると手間に感じてしまった
自動でやってくれるって便利
でも1から自分で設定するとどのソフトウェアが入ったのか,どんな効果があるのか理解しやすいからいいかな?たぶn

参考にさせていただいたサイト

node.jsをインストールしてみた(Windows) | Tips Note