Skip to content

Commit 8e13f31

Browse files
committed
begin restructuring for cli scripts
1 parent 327eecb commit 8e13f31

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+4792
-0
lines changed

Diff for: .gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ xcuserdata
1717
/dist/
1818
/Markdown_1.0.1/
1919
Markdown_*.zip
20+
example

Diff for: bin/BOOM

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#! /bin/sh
2+
# this one is for steve jobs
3+
./bin/create && ./bin/debug && say 'boom' && ./bin/log

Diff for: build.sh renamed to bin/_build.sh

File renamed without changes.
File renamed without changes.

Diff for: update_test.sh renamed to bin/_update_test.sh

File renamed without changes.

Diff for: bin/create

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#! /bin/sh
2+
#
3+
# create a phonegap/ios project
4+
#
5+
# USAGE
6+
# ./create [path package name]
7+
#
8+
# EXAMPLE
9+
# ./create ~/Desktop/radness com.phonegap.radness Radness
10+
#
11+
set -e
12+
13+
PROJECT_PATH=${1:-"./example"}
14+
PACKAGE=${2:-"com.phonegap.example"}
15+
ACTIVITY=${3:-"PhoneGapExample"}
16+
17+
# clobber any existing example
18+
if [ $# -eq 0 ]
19+
then
20+
rm -rf $PROJECT_PATH
21+
fi
22+
23+
# copy the bitch in; and then rough it up
24+
cp -r ./bin/templates/project $PROJECT_PATH
25+
26+
# I've tried to be thorough in my documentation of the manual actions below...
27+
# on first brush it would seem that the right solution would be to brute force
28+
# recurse the directory tree renaming instances of __ID__ and __TESTING__ ...however this is a little blunt
29+
# and while so the below is too being very manual it was/is easier to test, fucking manually, and sort out the automation
30+
31+
# rename the folders/files:
32+
#
33+
# - ./__TESTING__.xcodeproj/
34+
# - ./__TESTING__/
35+
# - ./__TESTING__/__TESTING__-info.plist
36+
# - ./__TESTING__/__TESTING__-Prefix.plist
37+
mv $PROJECT_PATH/__TESTING__.xcodeproj $PROJECT_PATH/$ACTIVITY.xcodeproj
38+
mv $PROJECT_PATH/__TESTING__ $PROJECT_PATH/$ACTIVITY
39+
mv $PROJECT_PATH/$ACTIVITY/__TESTING__-info.plist $PROJECT_PATH/$ACTIVITY/$ACTIVITY-info.plist
40+
mv $PROJECT_PATH/$ACTIVITY/__TESTING__-Prefix.pch $PROJECT_PATH/$ACTIVITY/$ACTIVITY-Prefix.pch
41+
42+
# lets store a reference to the root
43+
R=$PROJECT_PATH/$ACTIVITY
44+
45+
# replace __TESTING__ and --ID-- with ACTIVITY and ID strings, respectively, in:
46+
#
47+
# - ./__TESTING__.xcodeproj/project.pbxproj
48+
# - ./__TESTING__/Classes/AppDelegate.h
49+
# - ./__TESTING__/Classes/AppDelegate.m
50+
# - ./__TESTING__/Resources/main.m
51+
# - ./__TESTING__/Resources/__TESTING__-info.plist
52+
# - ./__TESTING__/Resources/__TESTING__-Prefix.plist
53+
54+
./bin/replaces $R.xcodeproj/project.pbxproj __TESTING__ $ACTIVITY
55+
./bin/replaces $R/Classes/AppDelegate.h __TESTING__ $ACTIVITY
56+
./bin/replaces $R/Classes/AppDelegate.m __TESTING__ $ACTIVITY
57+
./bin/replaces $R/main.m __TESTING__ $ACTIVITY
58+
./bin/replaces $R/$ACTIVITY-info.plist __TESTING__ $ACTIVITY
59+
./bin/replaces $R/$ACTIVITY-Prefix.pch __TESTING__ $ACTIVITY
60+
61+
./bin/replaces $R/$ACTIVITY-info.plist --ID-- $PACKAGE

Diff for: bin/replaces

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#! /bin/sh
2+
#
3+
# USAGE
4+
# ./replaces path from to
5+
#
6+
# EXAMPLE
7+
# ./replaces ./foo.txt FOO BAR
8+
#
9+
sed "s/$2/$3/g" $1 > tmpFile ; mv tmpFile $1

Diff for: bin/templates/project/__TESTING__.xcodeproj/project.pbxproj

+448
Large diffs are not rendered by default.
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// AppDelegate.h
3+
// __TESTING__
4+
//
5+
// Created by Brian LeRoux on 11-08-24.
6+
// Copyright Nitobi Software 2011. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
#ifdef PHONEGAP_FRAMEWORK
11+
#import <PhoneGap/PhoneGapDelegate.h>
12+
#else
13+
#import "PhoneGapDelegate.h"
14+
#endif
15+
16+
@interface AppDelegate : PhoneGapDelegate {
17+
18+
NSString* invokeString;
19+
}
20+
21+
// invoke string is passed to your app on launch, this is only valid if you
22+
// edit __TESTING__.plist to add a protocol
23+
// a simple tutorial can be found here :
24+
// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html
25+
26+
@property (copy) NSString* invokeString;
27+
28+
@end
29+
+112
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
//
2+
// AppDelegate.m
3+
// __TESTING__
4+
//
5+
// Created by Brian LeRoux on 11-08-24.
6+
// Copyright Nitobi Software 2011. All rights reserved.
7+
//
8+
9+
#import "AppDelegate.h"
10+
#ifdef PHONEGAP_FRAMEWORK
11+
#import <PhoneGap/PhoneGapViewController.h>
12+
#else
13+
#import "PhoneGapViewController.h"
14+
#endif
15+
16+
@implementation AppDelegate
17+
18+
@synthesize invokeString;
19+
20+
- (id) init
21+
{
22+
/** If you need to do any extra app-specific initialization, you can do it here
23+
* -jm
24+
**/
25+
return [super init];
26+
}
27+
28+
/**
29+
* This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up)
30+
*/
31+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
32+
{
33+
34+
NSArray *keyArray = [launchOptions allKeys];
35+
if ([launchOptions objectForKey:[keyArray objectAtIndex:0]]!=nil)
36+
{
37+
NSURL *url = [launchOptions objectForKey:[keyArray objectAtIndex:0]];
38+
self.invokeString = [url absoluteString];
39+
NSLog(@"__TESTING__ launchOptions = %@",url);
40+
}
41+
42+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
43+
}
44+
45+
// this happens while we are running ( in the background, or from within our own app )
46+
// only valid if __TESTING__.plist specifies a protocol to handle
47+
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
48+
{
49+
// must call super so all plugins will get the notification, and their handlers will be called
50+
// super also calls into javascript global function 'handleOpenURL'
51+
return [super application:application handleOpenURL:url];
52+
}
53+
54+
-(id) getCommandInstance:(NSString*)className
55+
{
56+
/** You can catch your own commands here, if you wanted to extend the gap: protocol, or add your
57+
* own app specific protocol to it. -jm
58+
**/
59+
return [super getCommandInstance:className];
60+
}
61+
62+
/**
63+
Called when the webview finishes loading. This stops the activity view and closes the imageview
64+
*/
65+
- (void)webViewDidFinishLoad:(UIWebView *)theWebView
66+
{
67+
// only valid if __TESTING__.plist specifies a protocol to handle
68+
if(self.invokeString)
69+
{
70+
// this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready
71+
NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString];
72+
[theWebView stringByEvaluatingJavaScriptFromString:jsString];
73+
}
74+
return [ super webViewDidFinishLoad:theWebView ];
75+
}
76+
77+
- (void)webViewDidStartLoad:(UIWebView *)theWebView
78+
{
79+
return [ super webViewDidStartLoad:theWebView ];
80+
}
81+
82+
/**
83+
* Fail Loading With Error
84+
* Error - If the webpage failed to load display an error with the reason.
85+
*/
86+
- (void)webView:(UIWebView *)theWebView didFailLoadWithError:(NSError *)error
87+
{
88+
return [ super webView:theWebView didFailLoadWithError:error ];
89+
}
90+
91+
/**
92+
* Start Loading Request
93+
* This is where most of the magic happens... We take the request(s) and process the response.
94+
* From here we can re direct links and other protocalls to different internal methods.
95+
*/
96+
- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType
97+
{
98+
return [ super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType ];
99+
}
100+
101+
102+
- (BOOL) execute:(InvokedUrlCommand*)command
103+
{
104+
return [ super execute:command];
105+
}
106+
107+
- (void)dealloc
108+
{
109+
[ super dealloc ];
110+
}
111+
112+
@end

Diff for: bin/templates/project/__TESTING__/PhoneGap.plist

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>DetectPhoneNumber</key>
6+
<true/>
7+
<key>TopActivityIndicator</key>
8+
<string>gray</string>
9+
<key>EnableLocation</key>
10+
<false/>
11+
<key>EnableAcceleration</key>
12+
<true/>
13+
<key>EnableViewportScale</key>
14+
<false/>
15+
<key>AutoHideSplashScreen</key>
16+
<true/>
17+
<key>ShowSplashScreenSpinner</key>
18+
<true/>
19+
<key>ExternalHosts</key>
20+
<array/>
21+
<key>Plugins</key>
22+
<dict>
23+
<key>com.phonegap.accelerometer</key>
24+
<string>PGAccelerometer</string>
25+
<key>com.phonegap.camera</key>
26+
<string>PGCamera</string>
27+
<key>com.phonegap.connection</key>
28+
<string>PGConnection</string>
29+
<key>com.phonegap.contacts</key>
30+
<string>PGContacts</string>
31+
<key>com.phonegap.debugconsole</key>
32+
<string>PGDebugConsole</string>
33+
<key>com.phonegap.file</key>
34+
<string>PGFile</string>
35+
<key>com.phonegap.filetransfer</key>
36+
<string>PGFileTransfer</string>
37+
<key>com.phonegap.geolocation</key>
38+
<string>PGLocation</string>
39+
<key>com.phonegap.notification</key>
40+
<string>PGNotification</string>
41+
<key>com.phonegap.media</key>
42+
<string>PGSound</string>
43+
<key>com.phonegap.mediacapture</key>
44+
<string>PGCapture</string>
45+
<key>com.phonegap.splashscreen</key>
46+
<string>PGSplashScreen</string>
47+
</dict>
48+
</dict>
49+
</plist>

Diff for: bin/templates/project/__TESTING__/Plugins/README

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder.
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
3+
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
4+
*
5+
* Copyright (c) 2011, IBM Corporation
6+
*/
7+
8+
9+
// accessibility label for recording button
10+
"toggle audio recording" = "toggle audio recording";
11+
// notification spoken by VoiceOver when timed recording finishes
12+
"timed recording complete" = "timed recording complete";
13+
// accessibility hint for display of recorded elapsed time
14+
"recorded time in minutes and seconds" = "recorded time in minutes and seconds";
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/*
2+
* PhoneGap is available under *either* the terms of the modified BSD license *or* the
3+
* MIT License (2008). See http://opensource.org/licenses/alphabetical for full text.
4+
*
5+
* Copyright (c) 2011, IBM Corporation
6+
*/
7+
8+
// accessibility label for recording button
9+
"toggle audio recording" = "grabación de audio cambiar";
10+
// notification spoken by VoiceOver when timed recording finishes
11+
"timed recording complete" = "tiempo de grabación completo";
12+
// accessibility hint for display of recorded elapsed time
13+
"recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos";
4.93 KB
Loading
3.05 KB
Loading
Loading
12.9 KB
Loading
Loading
+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>CFBundleIconFiles</key>
6+
<array>
7+
<string>icon.png</string>
8+
<string>[email protected]</string>
9+
<string>icon-72.png</string>
10+
</array>
11+
<key>UISupportedInterfaceOrientations~ipad</key>
12+
<array>
13+
<string>UIInterfaceOrientationPortrait</string>
14+
<string>UIInterfaceOrientationLandscapeLeft</string>
15+
<string>UIInterfaceOrientationPortraitUpsideDown</string>
16+
<string>UIInterfaceOrientationLandscapeRight</string>
17+
</array>
18+
<key>UISupportedInterfaceOrientations</key>
19+
<array>
20+
<string>UIInterfaceOrientationPortrait</string>
21+
</array>
22+
<key>CFBundleDevelopmentRegion</key>
23+
<string>English</string>
24+
<key>CFBundleDisplayName</key>
25+
<string>${PRODUCT_NAME}</string>
26+
<key>CFBundleExecutable</key>
27+
<string>${EXECUTABLE_NAME}</string>
28+
<key>CFBundleIconFile</key>
29+
<string>icon.png</string>
30+
<key>CFBundleIdentifier</key>
31+
<string>--ID--.__TESTING__</string>
32+
<key>CFBundleInfoDictionaryVersion</key>
33+
<string>6.0</string>
34+
<key>CFBundleName</key>
35+
<string>${PRODUCT_NAME}</string>
36+
<key>CFBundlePackageType</key>
37+
<string>APPL</string>
38+
<key>CFBundleSignature</key>
39+
<string>????</string>
40+
<key>CFBundleVersion</key>
41+
<string>1.0</string>
42+
<key>LSRequiresIPhoneOS</key>
43+
<true/>
44+
<key>NSMainNibFile</key>
45+
<string></string>
46+
<key>NSMainNibFile~ipad</key>
47+
<string></string>
48+
</dict>
49+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//
2+
// Prefix header for all source files of the '__TESTING__' target in the '__TESTING__' project
3+
//
4+
5+
#ifdef __OBJC__
6+
#import <UIKit/UIKit.h>
7+
#import <Foundation/Foundation.h>
8+
#endif
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/* Localized versions of Info.plist keys */
2+

Diff for: bin/templates/project/__TESTING__/main.m

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
//
2+
// main.m
3+
// __TESTING__
4+
//
5+
// Created by Brian LeRoux on 11-08-24.
6+
// Copyright Nitobi Software 2011. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
int main(int argc, char *argv[]) {
12+
13+
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
14+
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
15+
[pool release];
16+
return retVal;
17+
}

Diff for: bin/templates/project/console.log

Whitespace-only changes.

0 commit comments

Comments
 (0)