Skip to content

Commit

Permalink
Adding Android support to Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
David Long committed Jan 27, 2012
1 parent 7e9b6ce commit 8c92ee6
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions lib/ti/templates/rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ namespace :build do
task :iphone do
build
end

desc "Build the app for Android"
task :android do
build({ :device => 'android' })
end

desc "Recreate build folder"
task :new do
Expand Down Expand Up @@ -84,8 +89,14 @@ end
def build(options={})
return "Broken" unless compile
options[:device] ||= 'iphone'
puts "Building with Titanium with Ti... (DEVICE_TYPE:#{options[:device]})"
FileUtils.mkdir_p "#{PROJECT_ROOT}/#{PROJECT_NAME}/build/iphone/"
sh %Q{bash -c "#{TI_BUILD} run #{PROJECT_ROOT}/ #{IPHONE_SDK_VERSION} #{APP_ID} #{APP_NAME} #{APP_DEVICE}" \
if options[:device] == 'android'
sdk = ANDROID_SDK_VERSION
builder = "#{TI_ANDROID_DIR}/builder.py"
elsif options[:device].match /^i/
sdk = IPHONE_SDK_VERSION
builder = "#{TI_IPHONE_DIR}/builder.py"
end
puts "Building with Titanium... (DEVICE_TYPE: #{options[:device]})".blue
sh %Q{bash -c "#{builder} run #{PROJECT_ROOT}/ #{sdk} #{APP_ID} #{APP_NAME} #{APP_DEVICE} " \
| perl -pe 's/^\\[DEBUG\\].*$/\\e[35m$&\\e[0m/g;s/^\\[INFO\\].*$/\\e[36m$&\\e[0m/g;s/^\\[WARN\\].*$/\\e[33m$&\\e[0m/g;s/^\\[ERROR\\].*$/\\e[31m$&\\e[0m/g;'}
end

0 comments on commit 8c92ee6

Please sign in to comment.