TitaniumDeveloperでプロジェクトを作るところは省きます。
アプリケーション名は「Sample」と仮定し、rubygemsのtwitterを使ってみます。
$ cd Sample/Resources $ bundle init
Sample/Resources直下にGemfileがあると思うのでそれを編集。
「gem twitter」を追加します
# A sample Gemfile source "http://rubygems.org" # gem "rails" gem "twitter" # この行を追加
実際にライブラリを取得し「vendor/bundle」以下に保存。
$ bundle install --path vendor/bundle # 関連するライブラリなども一緒に取得
sample.rbに以下のコードを追加(gemのパスを追加)。
バージョンのところは各自修正が必要です(この場合は1.9.1)。
require 'rubygems' begin root = File.expand_path(File.dirname(Titanium.App.getPath)) rescue root = File.dirname(__FILE__) end gem_path = File.join(root, '../', 'Resources', 'vendor', 'bundle', 'ruby', '1.9.1') Gem.use_paths(gem_path) require 'twitter' # 〜
これでOK(のはず…)。