mirror of
https://github.com/apache/cordova-android.git
synced 2025-03-04 00:13:20 +08:00
merged dave
This commit is contained in:
parent
83070fc4ea
commit
f818f9bda9
@ -19,7 +19,7 @@ Generate.new(ARGV[1]) if ARGV.first == 'gen'
|
||||
Create.new(ARGV[1]) if ARGV.first == 'create'
|
||||
|
||||
# droidgap run [optional directory]
|
||||
Run.new(ARGV[1]) if ARGV.first == 'run'
|
||||
Run.new if ARGV.first == 'run'
|
||||
|
||||
# droidgap update [params]
|
||||
Update.new if ARGV.first == 'update'
|
||||
|
33
lib/run.rb
33
lib/run.rb
@ -4,34 +4,27 @@
|
||||
#
|
||||
# A handy machine that does the following:
|
||||
#
|
||||
# - packages www to a valid android project in tmp/android
|
||||
# - builds tmp/android project into an apk
|
||||
# - installs apk onto first device found
|
||||
# - runs ant_debug
|
||||
# - if there is no device attached it will start an emulator with the first avd found
|
||||
# - TODO install apk into now running emulator... need to find way to wait for it to have started
|
||||
# - TODO if no avds present it will attempt to create one
|
||||
# - runs ant_install
|
||||
#
|
||||
class Run
|
||||
# if no path is supplied uses current directory for project
|
||||
def initialize(path)
|
||||
puts 'packaging www as phonegap/android project in ./tmp/android...'
|
||||
path = FileUtils.pwd if path.nil? || path == ""
|
||||
@pkg = Package.new(path)
|
||||
@apk = File.join(@pkg.path, "bin", "#{ @pkg.name.gsub(' ','') }-debug.apk")
|
||||
build_apk
|
||||
first_device.nil? ? start_emulator : install_to_device
|
||||
def initialize
|
||||
@path = FileUtils.pwd
|
||||
build
|
||||
start_emulator if first_device.nil?
|
||||
install
|
||||
end
|
||||
|
||||
def build_apk
|
||||
puts 'building apk...'
|
||||
Dir.chdir(@pkg.path)
|
||||
`ant debug;`
|
||||
def build
|
||||
Dir.chdir(@path)
|
||||
`ant debug`
|
||||
end
|
||||
|
||||
def install_to_device
|
||||
puts 'installing to device...'
|
||||
Dir.chdir(@pkg.path)
|
||||
`ant install;`
|
||||
def install
|
||||
Dir.chdir(@path)
|
||||
`ant install`
|
||||
end
|
||||
|
||||
def start_emulator
|
||||
|
Loading…
Reference in New Issue
Block a user