forked from deadprogram/phonegap-android
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a51f053
commit a9911bb
Showing
5 changed files
with
38 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,34 @@ | ||
# | ||
# Run | ||
# --- | ||
# | ||
# 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 | ||
# - attaches a logger to catch output from console.log statements | ||
# | ||
class Run | ||
|
||
def apk | ||
Package.new(args).run | ||
# if no path is supplied uses current directory for project | ||
def initialize(path) | ||
@pkg = Package.new(path) | ||
@apk = File.join(@pkg.path, "bin", "#{ @pkg.name }-debug.apk") | ||
|
||
build | ||
install | ||
end | ||
|
||
def jar | ||
`ant jar` | ||
end | ||
|
||
def list | ||
`adb devices` | ||
# creates tmp/android/bin/project.apk | ||
def build | ||
`cd #{ @pkg.path }; ant debug` | ||
end | ||
|
||
# installs apk to first device found | ||
def install | ||
`apk -s 0123456789012 install phonegap.apk` | ||
end | ||
|
||
def log | ||
|
||
@device = `adb devices`.split("\n")[1] | ||
raise "Unable to run! No devices found." if @device.nil? | ||
@device.gsub!("\tdevice",'') | ||
puts `adb -s #{ @device } install -r #{ @apk }` | ||
end | ||
end |
Binary file not shown.