mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 12:03:28 +08:00
updates to output and rmoved uniq package name
This commit is contained in:
parent
5a90792e0d
commit
6cd1d8113e
@ -1,17 +1,4 @@
|
|||||||
# ProjectName
|
# Creates a new PhoneGap/Android project from ./example
|
||||||
# |
|
|
||||||
# |-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)
|
|
||||||
#
|
|
||||||
class Generate
|
class Generate
|
||||||
def initialize(name)
|
def initialize(name)
|
||||||
if name.nil?
|
if name.nil?
|
||||||
@ -21,5 +8,6 @@ class Generate
|
|||||||
from = File.join ROOT, "example"
|
from = File.join ROOT, "example"
|
||||||
to = File.join FileUtils.pwd, name
|
to = File.join FileUtils.pwd, name
|
||||||
FileUtils.cp_r from, to
|
FileUtils.cp_r from, to
|
||||||
|
puts "Generated #{ to }"
|
||||||
end
|
end
|
||||||
end
|
end
|
@ -17,6 +17,7 @@ class Package
|
|||||||
copy_libs
|
copy_libs
|
||||||
add_name_to_strings
|
add_name_to_strings
|
||||||
write_java
|
write_java
|
||||||
|
msg
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -30,10 +31,10 @@ class Package
|
|||||||
|
|
||||||
# setup default vars
|
# setup default vars
|
||||||
@name = path.split("/").last
|
@name = path.split("/").last
|
||||||
@path = File.join(path, '..', "#{ name }-android") # File.join(path, "tmp", "android")
|
@path = File.join(path, '..', "#{ name }-android")
|
||||||
@www = path # File.join(path, 'www')
|
@www = path
|
||||||
@name = path.split('/').last
|
@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 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','')
|
@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)
|
FileUtils.mkdir_p(code_dir)
|
||||||
open(File.join(code_dir, "#{ @name.gsub(' ','') }.java"),'w') { |f| f.puts j.gsub(' ','') }
|
open(File.join(code_dir, "#{ @name.gsub(' ','') }.java"),'w') { |f| f.puts j.gsub(' ','') }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# friendly output for now
|
||||||
|
def msg
|
||||||
|
puts "Created #{ @path }"
|
||||||
|
end
|
||||||
#
|
#
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user