From 707738c3ee14edd094f91c0723fb642c9972058c Mon Sep 17 00:00:00 2001 From: Dave Johnson Date: Mon, 28 Jun 2010 16:02:10 -0700 Subject: [PATCH] added target to the droidgap script and updated the readme and getting started wiki page --- README.md | 3 ++- droidgap | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ba2244dd..33fab581 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,10 @@ Getting Started with PhoneGap/Android 1. From the root of this repo run the following command to generate a new PhoneGap/Android app:
    
-    ./droidgap [android_sdk_path] [name] [package_name] [www] [path]
+    ./droidgap [android_sdk_path] [target] [name] [package_name] [www] [path]
 
     android_sdk_path ... The path to your Android SDK install.
+    target ......................The target version of the Android platform (3, 4, 6, 7, 8 correspond to 1.5, 1.6, 2.0.1, 2.1, 2.2).
     name ............... The name of your application.
     package_name ....... The name of your package (For example: com.nitobi.demo)
     www ................ The path to your www folder. (Wherein your HTML, CSS and JS app is.)
diff --git a/droidgap b/droidgap
index 18ea2b6e..af27e1eb 100755
--- a/droidgap
+++ b/droidgap
@@ -3,10 +3,10 @@ require 'fileutils'
 
 # ./droidgap /Users/brianleroux/Code/android-sdk-mac MyApp com.westcoastlogic example /Users/brianleroux/Desktop/MyApp
 class Build
-  attr_reader :android_sdk_path, :name, :pkg, :www, :path
+  attr_reader :android_sdk_path, :name, :pkg, :www, :path, :target_id
   
   def initialize(*a)
-    @android_sdk_path, @name, @pkg, @www, @path = a
+    @android_sdk_path, @target, @name, @pkg, @www, @path = a
     @android_dir = File.expand_path(File.dirname(__FILE__))
     @framework_dir = File.join(@android_dir, "framework")
   end
@@ -44,9 +44,8 @@ class Build
   # TODO fix 'android' shell call so that it works on Windows. Can't prepend android command with path to it.
   def create_android
     android_exec = File.join(@android_sdk_path, "tools", "android");
-    target_id = 5 
     puts "Creating Android project for target level #{ target_id }"
-    `android create project -t #{ target_id } -k #{ @pkg } -a #{ @name } -n #{ @name } -p #{ @path }`
+    `android create project -t #{ @target_id } -k #{ @pkg } -a #{ @name } -n #{ @name } -p #{ @path }`
   end
   
   def include_www