merged with phonegap
This commit is contained in:
commit
5690b10635
13
README.md
13
README.md
@ -34,16 +34,19 @@ $ npm install -g ios-deploy
|
||||
-L, --justlaunch just launch the app and exit lldb
|
||||
-v, --verbose enable verbose output
|
||||
-m, --noinstall directly start debugging without app install (-d not required)
|
||||
-p, --port <number> port used for device, default: 12345
|
||||
-r, --uninstall uninstall the app before install (do not use with -m; app cache and data are cleared)
|
||||
-p, --port <number> port used for device, default: 12345
|
||||
-r, --uninstall uninstall the app before install (do not use with -m; app cache and data are cleared)
|
||||
-1, --bundle_id <bundle id> specify bundle id for list and upload
|
||||
-l, --list list files
|
||||
-o, --upload <file> upload file
|
||||
-w, --download download app tree
|
||||
-2, --to <target pathname> use together with up/download file/tree. specify target
|
||||
-V, --version print the executable version
|
||||
-D, --mkdir <dir> make directory on device
|
||||
-R, --rm <path> remove file or directory on device (directories must be empty)
|
||||
-V, --version print the executable version
|
||||
-e, --exists check if the app with given bundle_id is installed or not
|
||||
|
||||
|
||||
## Examples
|
||||
|
||||
The commands below assume that you have an app called `my.app` with bundle id `bundle.id`. Substitute where necessary.
|
||||
@ -59,7 +62,7 @@ The commands below assume that you have an app called `my.app` with bundle id `b
|
||||
|
||||
// Upload a file to your app's Documents folder
|
||||
ios-deploy --bundle_id 'bundle.id' --upload test.txt --to Documents/test.txt
|
||||
|
||||
|
||||
// Download your app's Documents, Library and tmp folders
|
||||
ios-deploy --bundle_id 'bundle.id' --download --to MyDestinationFolder
|
||||
|
||||
@ -68,7 +71,7 @@ The commands below assume that you have an app called `my.app` with bundle id `b
|
||||
|
||||
// deploy and debug your app to a connected device, uninstall the app first
|
||||
ios-deploy --uninstall --debug --bundle my.app
|
||||
|
||||
|
||||
// check whether an app by bundle id exists on the device (check return code `echo $?`)
|
||||
ios-deploy --exists --bundle_id com.apple.mobilemail
|
||||
|
||||
|
61
ios-deploy.c
61
ios-deploy.c
@ -16,7 +16,7 @@
|
||||
#include <netinet/tcp.h>
|
||||
#include "MobileDevice.h"
|
||||
|
||||
#define APP_VERSION "1.5.1"
|
||||
#define APP_VERSION "1.5.2"
|
||||
#define PREP_CMDS_PATH "/tmp/fruitstrap-lldb-prep-cmds-"
|
||||
#define LLDB_SHELL "lldb -s " PREP_CMDS_PATH
|
||||
/*
|
||||
@ -435,6 +435,18 @@ CFStringRef get_device_full_name(const AMDeviceRef device) {
|
||||
fprintCFSTR(stdout, CFSTR("Device Name:[%@]\n"), device_name);
|
||||
if (model_name != NULL)
|
||||
fprintCFSTR(stdout, CFSTR("Model Name:[%@]\n"), model_name);
|
||||
char *devName = MYCFStringCopyUTF8String(device_name);
|
||||
printf("Device Name:[%s]\n",devName);
|
||||
CFShow(device_name);
|
||||
printf("\n");
|
||||
free(devName);
|
||||
|
||||
char *mdlName = MYCFStringCopyUTF8String(model_name);
|
||||
printf("Model Name:[%s]\n",mdlName);
|
||||
printf("MM: [%s]\n",CFStringGetCStringPtr(model_name, kCFStringEncodingUTF8));
|
||||
CFShow(model_name);
|
||||
printf("\n");
|
||||
free(mdlName);
|
||||
}
|
||||
|
||||
if(device_name != NULL && model_name != NULL)
|
||||
@ -1464,6 +1476,33 @@ void upload_file(AMDeviceRef device) {
|
||||
free(file_content);
|
||||
}
|
||||
|
||||
void make_directory(AMDeviceRef device) {
|
||||
service_conn_t houseFd = start_house_arrest_service(device);
|
||||
|
||||
afc_file_ref file_ref;
|
||||
|
||||
afc_connection afc_conn;
|
||||
afc_connection* afc_conn_p = &afc_conn;
|
||||
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
|
||||
|
||||
assert(AFCDirectoryCreate(afc_conn_p, target_filename) == 0);
|
||||
assert(AFCConnectionClose(afc_conn_p) == 0);
|
||||
}
|
||||
|
||||
void remove_path(AMDeviceRef device) {
|
||||
service_conn_t houseFd = start_house_arrest_service(device);
|
||||
|
||||
afc_file_ref file_ref;
|
||||
|
||||
afc_connection afc_conn;
|
||||
afc_connection* afc_conn_p = &afc_conn;
|
||||
AFCConnectionOpen(houseFd, 0, &afc_conn_p);
|
||||
|
||||
|
||||
assert(AFCRemovePath(afc_conn_p, target_filename) == 0);
|
||||
assert(AFCConnectionClose(afc_conn_p) == 0);
|
||||
}
|
||||
|
||||
void handle_device(AMDeviceRef device) {
|
||||
//if (found_device)
|
||||
// return; // handle one device only
|
||||
@ -1498,7 +1537,11 @@ void handle_device(AMDeviceRef device) {
|
||||
} else if (strcmp("upload", command) == 0) {
|
||||
upload_file(device);
|
||||
} else if (strcmp("download", command) == 0) {
|
||||
download_tree(device);
|
||||
download_tree(device);
|
||||
} else if (strcmp("mkdir", command) == 0) {
|
||||
make_directory(device);
|
||||
} else if (strcmp("rm", command) == 0) {
|
||||
remove_path(device);
|
||||
} else if (strcmp("exists", command) == 0) {
|
||||
exit(app_exists(device));
|
||||
}
|
||||
@ -1681,6 +1724,8 @@ void usage(const char* app) {
|
||||
" -o, --upload <file> upload file\n"
|
||||
" -w, --download download app tree\n"
|
||||
" -2, --to <target pathname> use together with up/download file/tree. specify target\n"
|
||||
" -D, --mkdir <dir> make directory on device\n"
|
||||
" -R, --rm <path> remove file or directory on device (directories must be empty)\n"
|
||||
" -V, --version print the executable version \n"
|
||||
" -e, --exists check if the app with given bundle_id is installed or not \n",
|
||||
app);
|
||||
@ -1712,6 +1757,8 @@ int main(int argc, char *argv[]) {
|
||||
{ "upload", required_argument, NULL, 'o'},
|
||||
{ "download", optional_argument, NULL, 'w'},
|
||||
{ "to", required_argument, NULL, '2'},
|
||||
{ "mkdir", required_argument, NULL, 'D'},
|
||||
{ "rm", required_argument, NULL, 'R'},
|
||||
{ "exists", no_argument, NULL, 'e'},
|
||||
{ NULL, 0, NULL, 0 },
|
||||
};
|
||||
@ -1789,6 +1836,16 @@ int main(int argc, char *argv[]) {
|
||||
command = "download";
|
||||
list_root = optarg;
|
||||
break;
|
||||
case 'D':
|
||||
command_only = true;
|
||||
target_filename = optarg;
|
||||
command = "mkdir";
|
||||
break;
|
||||
case 'R':
|
||||
command_only = true;
|
||||
target_filename = optarg;
|
||||
command = "rm";
|
||||
break;
|
||||
case 'e':
|
||||
command_only = true;
|
||||
command = "exists";
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ios-deploy",
|
||||
"version": "1.5.1",
|
||||
"version": "1.5.2",
|
||||
"description": "launch iOS apps iOS devices from the command line (Xcode 6)",
|
||||
"main": "ios-deploy",
|
||||
"scripts": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user