updates to output and rmoved uniq package name

This commit is contained in:
brianleroux 2010-08-31 15:36:09 -07:00
parent 5a90792e0d
commit 6cd1d8113e
2 changed files with 11 additions and 17 deletions

View File

@ -1,17 +1,4 @@
# ProjectName
# |
# |-tmp ......... Temporary directory for generated projects to launch into emulators or devices. Ignore.
# | '-android ... A generated Android project.
# |
# |-opt ......... Optional platform specific code. Plugins install native code here.
# | |-android ... Java files
# | '-iphone .... Objective C
# |
# |-bin ......... Generated applications.
# | '-android ... project.apk
# |
# '-www ......... html, css and javascript (optional config.xml for additional properties)
#
# Creates a new PhoneGap/Android project from ./example
class Generate
def initialize(name)
if name.nil?
@ -21,5 +8,6 @@ class Generate
from = File.join ROOT, "example"
to = File.join FileUtils.pwd, name
FileUtils.cp_r from, to
puts "Generated #{ to }"
end
end

View File

@ -17,6 +17,7 @@ class Package
copy_libs
add_name_to_strings
write_java
msg
end
@ -30,10 +31,10 @@ class Package
# setup default vars
@name = path.split("/").last
@path = File.join(path, '..', "#{ name }-android") # File.join(path, "tmp", "android")
@www = path # File.join(path, 'www')
@path = File.join(path, '..', "#{ name }-android")
@www = path
@name = path.split('/').last
@pkg = "com.phonegap.tmp#{ Time.now.usec }" # ensure a unique pkg
@pkg = "com.phonegap.#{ name }"
# android sdk discovery ... could be better
@android_sdk_path = Dir.getwd[0,1] != "/" ? `android-sdk-path.bat android.bat`.gsub('\\tools','').gsub('\\', '\\\\\\\\') : `which android`.gsub('/tools/android','')
@ -202,5 +203,10 @@ class Package
FileUtils.mkdir_p(code_dir)
open(File.join(code_dir, "#{ @name.gsub(' ','') }.java"),'w') { |f| f.puts j.gsub(' ','') }
end
# friendly output for now
def msg
puts "Created #{ @path }"
end
#
end