uispecrunner 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "ext/WaxSim"]
2
+ path = ext/WaxSim
3
+ url = https://github.com/robholland/WaxSim.git
data/Rakefile CHANGED
@@ -12,6 +12,10 @@ begin
12
12
  gem.authors = ["Blake Watters"]
13
13
  gem.add_development_dependency "rspec", ">= 1.2.9"
14
14
  gem.add_runtime_dependency "open4", "= 1.0.1"
15
+ gem.extensions = ['ext/Rakefile']
16
+ gem.files += ['ext/bin/waxsim']
17
+ gem.files += ['ext/WaxSim/**/*']
18
+ gem.files -= ['ext/WaxSim/build']
15
19
  # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
16
20
  end
17
21
  Jeweler::GemcutterTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.0
1
+ 0.4.1
data/ext/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ task :install do
2
+ sh "cd WaxSim && xcodebuild install DSTROOT=../../ INSTALL_PATH=/ext/bin"
3
+ end
4
+
5
+ task :default => :install
@@ -0,0 +1,31 @@
1
+ //
2
+ // Simulator.h
3
+ // Sim
4
+ //
5
+ // Created by ProbablyInteractive on 7/28/09.
6
+ // Copyright 2009 Probably Interactive. All rights reserved.
7
+ //
8
+
9
+ #import <Cocoa/Cocoa.h>
10
+ #import "iPhoneSimulatorRemoteClient.h"
11
+
12
+ @class DTiPhoneSimulatorSystemRoot;
13
+
14
+ @interface Simulator : NSObject <DTiPhoneSimulatorSessionDelegate> {
15
+ NSString *_appPath;
16
+ DTiPhoneSimulatorSystemRoot *_sdk;
17
+ NSNumber *_family;
18
+ DTiPhoneSimulatorSession* _session;
19
+ NSDictionary *_env;
20
+ NSArray *_args;
21
+ }
22
+
23
+ @property (nonatomic, readonly) DTiPhoneSimulatorSession* session;
24
+
25
+ + (NSArray *)availableSDKs;
26
+
27
+ - (id)initWithAppPath:(NSString *)appPath sdk:(NSString *)sdk family:(NSString *)family env:(NSDictionary *)env args:(NSArray *)args;
28
+ - (int)launch;
29
+ - (void)end;
30
+
31
+ @end
@@ -0,0 +1,131 @@
1
+ //
2
+ //
3
+ // Sim
4
+ //
5
+ // Created by ProbablyInteractive on 7/28/09.
6
+ // Copyright 2009 Probably Interactive. All rights reserved.
7
+ //
8
+
9
+ #import "Simulator.h"
10
+
11
+ #include <sys/param.h>
12
+ #include <objc/runtime.h>
13
+
14
+ #define WaxLog(format, args...) \
15
+ fprintf(stderr, "%s\n", [[NSString stringWithFormat:(format), ## args] UTF8String])
16
+
17
+ @implementation Simulator
18
+
19
+ @synthesize session=_session;
20
+
21
+ - (id)initWithAppPath:(NSString *)appPath sdk:(NSString *)sdk family:(NSString *)family env:(NSDictionary *)env args:(NSArray *)args {
22
+ self = [super init];
23
+
24
+ NSFileManager *fileManager = [NSFileManager defaultManager];
25
+ if (![appPath isAbsolutePath]) {
26
+ appPath = [[fileManager currentDirectoryPath] stringByAppendingPathComponent:appPath];
27
+ }
28
+
29
+ _appPath = [appPath retain];
30
+
31
+ if (![fileManager fileExistsAtPath:_appPath]) {
32
+ WaxLog(@"App path '%@' does not exist!", _appPath);
33
+ exit(EXIT_FAILURE);
34
+ }
35
+
36
+ if (!sdk) _sdk = [[DTiPhoneSimulatorSystemRoot defaultRoot] retain];
37
+ else {
38
+ _sdk = [[DTiPhoneSimulatorSystemRoot rootWithSDKVersion:sdk] retain];
39
+ }
40
+
41
+ if (!_sdk) {
42
+ WaxLog(@"Unknown sdk '%@'", sdk);
43
+ WaxLog(@"Available sdks are...");
44
+ for (id root in [DTiPhoneSimulatorSystemRoot knownRoots]) {
45
+ WaxLog(@" %@", [root sdkVersion]);
46
+ }
47
+
48
+ exit(EXIT_FAILURE);
49
+ }
50
+
51
+ if ([family isEqualToString: @"ipad"]) {
52
+ _family = [NSNumber numberWithInt: 2];
53
+ } else {
54
+ _family = [NSNumber numberWithInt: 1];
55
+ }
56
+
57
+ _env = [env retain];
58
+ _args = [args retain];
59
+
60
+ return self;
61
+ }
62
+
63
+ + (NSArray *)availableSDKs {
64
+ NSMutableArray *sdks = [NSMutableArray array];
65
+ for (id root in [DTiPhoneSimulatorSystemRoot knownRoots]) {
66
+ [sdks addObject:[root sdkVersion]];
67
+ }
68
+
69
+ return sdks;
70
+ }
71
+
72
+ - (int)launch {
73
+ WaxLog(@"Launching '%@' on'%@'", _appPath, [_sdk sdkDisplayName]);
74
+
75
+ DTiPhoneSimulatorApplicationSpecifier *appSpec = [DTiPhoneSimulatorApplicationSpecifier specifierWithApplicationPath:_appPath];
76
+ if (!appSpec) {
77
+ WaxLog(@"Could not load application specifier for '%@'", _appPath);
78
+ return EXIT_FAILURE;
79
+ }
80
+
81
+ DTiPhoneSimulatorSystemRoot *sdkRoot = [DTiPhoneSimulatorSystemRoot defaultRoot];
82
+
83
+ DTiPhoneSimulatorSessionConfig *config = [[DTiPhoneSimulatorSessionConfig alloc] init];
84
+ [config setApplicationToSimulateOnStart:appSpec];
85
+ [config setSimulatedSystemRoot:sdkRoot];
86
+ [config setSimulatedDeviceFamily:_family];
87
+ [config setSimulatedApplicationShouldWaitForDebugger:NO];
88
+ [config setSimulatedApplicationLaunchArgs:_args];
89
+ [config setSimulatedApplicationLaunchEnvironment:_env];
90
+ [config setLocalizedClientName:@"iCuke"];
91
+
92
+ // Make the simulator output to the current STDERR
93
+ // We mix them together to avoid buffering issues on STDOUT
94
+ char path[MAXPATHLEN];
95
+
96
+ fcntl(STDERR_FILENO, F_GETPATH, &path);
97
+ [config setSimulatedApplicationStdOutPath:[NSString stringWithUTF8String:path]];
98
+ [config setSimulatedApplicationStdErrPath:[NSString stringWithUTF8String:path]];
99
+
100
+ _session = [[DTiPhoneSimulatorSession alloc] init];
101
+ [_session setDelegate:self];
102
+ [_session setSimulatedApplicationPID:[NSNumber numberWithInt:35]];
103
+
104
+ NSError *error;
105
+ if (![_session requestStartWithConfig:config timeout:30 error:&error]) {
106
+ WaxLog(@"Could not start simulator session: %@", [error localizedDescription]);
107
+ return EXIT_FAILURE;
108
+ }
109
+
110
+ return EXIT_SUCCESS;
111
+ }
112
+
113
+ - (void)end {
114
+ [_session requestEndWithTimeout:0];
115
+ }
116
+
117
+ // DTiPhoneSimulatorSession Delegate
118
+ // ---------------------------------
119
+ - (void)session:(DTiPhoneSimulatorSession *)session didStart:(BOOL)started withError:(NSError *)error {
120
+ if (!started) {
121
+ WaxLog(@"Session failed to start. %@", [error localizedDescription]);
122
+ exit(EXIT_FAILURE);
123
+ }
124
+ }
125
+
126
+ - (void)session:(DTiPhoneSimulatorSession *)session didEndWithError:(NSError *)error {
127
+ WaxLog(@"Session ended with error. %@", [error localizedDescription]);
128
+ if ([error code] != 2) exit(EXIT_FAILURE); // if it is a timeout error, that's cool. We are probably rebooting
129
+ }
130
+
131
+ @end
@@ -0,0 +1,110 @@
1
+ #import <AppKit/AppKit.h>
2
+ #import "iPhoneSimulatorRemoteClient.h"
3
+ #import "Simulator.h"
4
+ #import "termios.h"
5
+
6
+ static BOOL gReset = false;
7
+
8
+ void printUsage();
9
+ void simulate(NSString *sdk, NSString *family, NSString *appPath, NSDictionary *environment, NSArray *additionalArgs);
10
+ void resetSignal(int sig);
11
+
12
+ int main(int argc, char *argv[]) {
13
+ signal(SIGQUIT, resetSignal);
14
+
15
+ int c;
16
+ char *sdk = nil;
17
+ char *family = nil;
18
+ char *appPath = nil;
19
+ NSMutableArray *additionalArgs = [NSMutableArray array];
20
+ NSMutableDictionary *environment = [NSMutableDictionary dictionary];
21
+ NSString *environment_variable;
22
+ NSArray *environment_variable_parts;
23
+
24
+ while ((c = getopt(argc, argv, "e:s:f:ah")) != -1) {
25
+ switch(c) {
26
+ case 'e':
27
+ environment_variable = [NSString stringWithCString:optarg encoding:NSUTF8StringEncoding];
28
+ environment_variable_parts = [environment_variable componentsSeparatedByString:@"="];
29
+
30
+ [environment setObject:[environment_variable_parts objectAtIndex:1] forKey:[environment_variable_parts objectAtIndex:0]];
31
+ break;
32
+ case 's':
33
+ sdk = optarg;
34
+ break;
35
+ case 'f':
36
+ family = optarg;
37
+ break;
38
+ case 'a':
39
+ fprintf(stdout, "Available SDK Versions.\n", optopt);
40
+ for (NSString *sdkVersion in [Simulator availableSDKs]) {
41
+ fprintf(stderr, " %s\n", [sdkVersion UTF8String]);
42
+ }
43
+ return 1;
44
+ case 'h':
45
+ printUsage();
46
+ return 1;
47
+ case '?':
48
+ if (optopt == 's' || optopt == 'f') {
49
+ fprintf(stderr, "Option -%c requires an argument.\n", optopt);
50
+ printUsage();
51
+ }
52
+ else {
53
+ fprintf(stderr, "Unknown option `-%c'.\n", optopt);
54
+ printUsage();
55
+ }
56
+ return 1;
57
+ break;
58
+ default:
59
+ abort ();
60
+ }
61
+
62
+ }
63
+
64
+ if (argc > optind) {
65
+ appPath = argv[optind++];
66
+
67
+ // Additional args are sent to app
68
+ for (int i = optind; i < argc; i++) {
69
+ [additionalArgs addObject:[NSString stringWithUTF8String:argv[i]]];
70
+ }
71
+ }
72
+ else {
73
+ fprintf(stderr, "No app-path was specified!\n");
74
+ printUsage();
75
+ return 1;
76
+ }
77
+
78
+
79
+ NSString *sdkString = sdk ? [NSString stringWithUTF8String:sdk] : nil;
80
+ NSString *familyString = family ? [NSString stringWithUTF8String:family] : nil;
81
+ NSString *appPathString = [NSString stringWithUTF8String:appPath];
82
+
83
+ simulate(sdkString, familyString, appPathString, environment, additionalArgs);
84
+
85
+ return 0;
86
+ }
87
+
88
+ void simulate(NSString *sdk, NSString *family, NSString *appPath, NSDictionary *environment, NSArray *additionalArgs) {
89
+ Simulator *simulator = [[Simulator alloc] initWithAppPath:appPath sdk:sdk family:family env:environment args:additionalArgs];
90
+ [simulator launch];
91
+
92
+ while (!gReset && [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:-1]]) ;
93
+
94
+ [simulator end];
95
+ }
96
+
97
+ void printUsage() {
98
+ fprintf(stderr, "usage: waxsim [options] app-path\n");
99
+ fprintf(stderr, "example: waxsim -s 2.2 /path/to/app.app\n");
100
+ fprintf(stderr, "Available options are:\n");
101
+ fprintf(stderr, "\t-s sdk\tVersion number of sdk to use (-s 3.1)\n");
102
+ fprintf(stderr, "\t-f family\tDevice to use (-f ipad)\n");
103
+ fprintf(stderr, "\t-e VAR=value\tEnvironment variable to set (-e CFFIXED_HOME=/tmp/iphonehome)\n");
104
+ fprintf(stderr, "\t-a \tAvailable SDK's\n");
105
+ fprintf(stderr, "\t-h \tPrints out this wonderful documentation!\n");
106
+ }
107
+
108
+ void resetSignal(int sig) {
109
+ gReset = true;
110
+ }
@@ -0,0 +1,238 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 45;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 048274F11126398C003DFACB /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 048274F01126398C003DFACB /* AppKit.framework */; };
11
+ 048275B2112639B7003DFACB /* Simulator.m in Sources */ = {isa = PBXBuildFile; fileRef = 048275B1112639B7003DFACB /* Simulator.m */; };
12
+ 048275C011263A74003DFACB /* iPhoneSimulatorRemoteClient.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 048275BF11263A74003DFACB /* iPhoneSimulatorRemoteClient.framework */; };
13
+ 8DD76F9A0486AA7600D96B5E /* WaxSim.m in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* WaxSim.m */; settings = {ATTRIBUTES = (); }; };
14
+ 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 08FB779EFE84155DC02AAC07 /* Foundation.framework */; };
15
+ /* End PBXBuildFile section */
16
+
17
+ /* Begin PBXCopyFilesBuildPhase section */
18
+ 8DD76F9E0486AA7600D96B5E /* CopyFiles */ = {
19
+ isa = PBXCopyFilesBuildPhase;
20
+ buildActionMask = 8;
21
+ dstPath = /usr/share/man/man1/;
22
+ dstSubfolderSpec = 0;
23
+ files = (
24
+ );
25
+ runOnlyForDeploymentPostprocessing = 1;
26
+ };
27
+ /* End PBXCopyFilesBuildPhase section */
28
+
29
+ /* Begin PBXFileReference section */
30
+ 048274F01126398C003DFACB /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
31
+ 048275AF112639B7003DFACB /* iPhoneSimulatorRemoteClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = iPhoneSimulatorRemoteClient.h; path = iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h; sourceTree = "<group>"; };
32
+ 048275B0112639B7003DFACB /* Simulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Simulator.h; sourceTree = "<group>"; };
33
+ 048275B1112639B7003DFACB /* Simulator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Simulator.m; sourceTree = "<group>"; };
34
+ 048275BF11263A74003DFACB /* iPhoneSimulatorRemoteClient.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = iPhoneSimulatorRemoteClient.framework; path = Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework; sourceTree = DEVELOPER_DIR; };
35
+ 08FB7796FE84155DC02AAC07 /* WaxSim.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WaxSim.m; sourceTree = "<group>"; };
36
+ 08FB779EFE84155DC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
37
+ 32A70AAB03705E1F00C91783 /* WaxSim_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WaxSim_Prefix.pch; sourceTree = "<group>"; };
38
+ 8DD76FA10486AA7600D96B5E /* waxsim */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = waxsim; sourceTree = BUILT_PRODUCTS_DIR; };
39
+ /* End PBXFileReference section */
40
+
41
+ /* Begin PBXFrameworksBuildPhase section */
42
+ 8DD76F9B0486AA7600D96B5E /* Frameworks */ = {
43
+ isa = PBXFrameworksBuildPhase;
44
+ buildActionMask = 2147483647;
45
+ files = (
46
+ 8DD76F9C0486AA7600D96B5E /* Foundation.framework in Frameworks */,
47
+ 048274F11126398C003DFACB /* AppKit.framework in Frameworks */,
48
+ 048275C011263A74003DFACB /* iPhoneSimulatorRemoteClient.framework in Frameworks */,
49
+ );
50
+ runOnlyForDeploymentPostprocessing = 0;
51
+ };
52
+ /* End PBXFrameworksBuildPhase section */
53
+
54
+ /* Begin PBXGroup section */
55
+ 08FB7794FE84155DC02AAC07 /* WaxSim */ = {
56
+ isa = PBXGroup;
57
+ children = (
58
+ 08FB7795FE84155DC02AAC07 /* Source */,
59
+ 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */,
60
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
61
+ );
62
+ name = WaxSim;
63
+ sourceTree = "<group>";
64
+ };
65
+ 08FB7795FE84155DC02AAC07 /* Source */ = {
66
+ isa = PBXGroup;
67
+ children = (
68
+ 32A70AAB03705E1F00C91783 /* WaxSim_Prefix.pch */,
69
+ 08FB7796FE84155DC02AAC07 /* WaxSim.m */,
70
+ 048275B0112639B7003DFACB /* Simulator.h */,
71
+ 048275B1112639B7003DFACB /* Simulator.m */,
72
+ 048275AF112639B7003DFACB /* iPhoneSimulatorRemoteClient.h */,
73
+ );
74
+ name = Source;
75
+ sourceTree = "<group>";
76
+ };
77
+ 08FB779DFE84155DC02AAC07 /* External Frameworks and Libraries */ = {
78
+ isa = PBXGroup;
79
+ children = (
80
+ 048275BF11263A74003DFACB /* iPhoneSimulatorRemoteClient.framework */,
81
+ 048274F01126398C003DFACB /* AppKit.framework */,
82
+ 08FB779EFE84155DC02AAC07 /* Foundation.framework */,
83
+ );
84
+ name = "External Frameworks and Libraries";
85
+ sourceTree = "<group>";
86
+ };
87
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
88
+ isa = PBXGroup;
89
+ children = (
90
+ 8DD76FA10486AA7600D96B5E /* waxsim */,
91
+ );
92
+ name = Products;
93
+ sourceTree = "<group>";
94
+ };
95
+ /* End PBXGroup section */
96
+
97
+ /* Begin PBXNativeTarget section */
98
+ 8DD76F960486AA7600D96B5E /* WaxSim */ = {
99
+ isa = PBXNativeTarget;
100
+ buildConfigurationList = 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "WaxSim" */;
101
+ buildPhases = (
102
+ 8DD76F990486AA7600D96B5E /* Sources */,
103
+ 8DD76F9B0486AA7600D96B5E /* Frameworks */,
104
+ 8DD76F9E0486AA7600D96B5E /* CopyFiles */,
105
+ );
106
+ buildRules = (
107
+ );
108
+ dependencies = (
109
+ );
110
+ name = WaxSim;
111
+ productInstallPath = "$(HOME)/bin";
112
+ productName = WaxSim;
113
+ productReference = 8DD76FA10486AA7600D96B5E /* waxsim */;
114
+ productType = "com.apple.product-type.tool";
115
+ };
116
+ /* End PBXNativeTarget section */
117
+
118
+ /* Begin PBXProject section */
119
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
120
+ isa = PBXProject;
121
+ buildConfigurationList = 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "WaxSim" */;
122
+ compatibilityVersion = "Xcode 3.1";
123
+ hasScannedForEncodings = 1;
124
+ mainGroup = 08FB7794FE84155DC02AAC07 /* WaxSim */;
125
+ projectDirPath = "";
126
+ projectRoot = "";
127
+ targets = (
128
+ 8DD76F960486AA7600D96B5E /* WaxSim */,
129
+ );
130
+ };
131
+ /* End PBXProject section */
132
+
133
+ /* Begin PBXSourcesBuildPhase section */
134
+ 8DD76F990486AA7600D96B5E /* Sources */ = {
135
+ isa = PBXSourcesBuildPhase;
136
+ buildActionMask = 2147483647;
137
+ files = (
138
+ 8DD76F9A0486AA7600D96B5E /* WaxSim.m in Sources */,
139
+ 048275B2112639B7003DFACB /* Simulator.m in Sources */,
140
+ );
141
+ runOnlyForDeploymentPostprocessing = 0;
142
+ };
143
+ /* End PBXSourcesBuildPhase section */
144
+
145
+ /* Begin XCBuildConfiguration section */
146
+ 1DEB927508733DD40010E9CD /* Debug */ = {
147
+ isa = XCBuildConfiguration;
148
+ buildSettings = {
149
+ ALWAYS_SEARCH_USER_PATHS = NO;
150
+ COPY_PHASE_STRIP = NO;
151
+ FRAMEWORK_SEARCH_PATHS = (
152
+ "$(inherited)",
153
+ "\"$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks\"",
154
+ );
155
+ GCC_DYNAMIC_NO_PIC = NO;
156
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
157
+ GCC_ENABLE_OBJC_GC = supported;
158
+ GCC_MODEL_TUNING = G5;
159
+ GCC_OPTIMIZATION_LEVEL = 0;
160
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
161
+ GCC_PREFIX_HEADER = WaxSim_Prefix.pch;
162
+ INSTALL_PATH = /usr/local/bin;
163
+ LD_RUNPATH_SEARCH_PATHS = /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks;
164
+ PRODUCT_NAME = waxsim;
165
+ };
166
+ name = Debug;
167
+ };
168
+ 1DEB927608733DD40010E9CD /* Release */ = {
169
+ isa = XCBuildConfiguration;
170
+ buildSettings = {
171
+ ALWAYS_SEARCH_USER_PATHS = NO;
172
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
173
+ FRAMEWORK_SEARCH_PATHS = (
174
+ "$(inherited)",
175
+ "\"$(DEVELOPER_DIR)/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks\"",
176
+ );
177
+ GCC_ENABLE_OBJC_GC = supported;
178
+ GCC_MODEL_TUNING = G5;
179
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
180
+ GCC_PREFIX_HEADER = WaxSim_Prefix.pch;
181
+ INSTALL_PATH = /usr/local/bin;
182
+ LD_RUNPATH_SEARCH_PATHS = /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks;
183
+ PRODUCT_NAME = waxsim;
184
+ };
185
+ name = Release;
186
+ };
187
+ 1DEB927908733DD40010E9CD /* Debug */ = {
188
+ isa = XCBuildConfiguration;
189
+ buildSettings = {
190
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
191
+ GCC_C_LANGUAGE_STANDARD = gnu99;
192
+ GCC_OPTIMIZATION_LEVEL = 0;
193
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
194
+ GCC_WARN_UNUSED_VARIABLE = YES;
195
+ ONLY_ACTIVE_ARCH = YES;
196
+ PREBINDING = NO;
197
+ SDKROOT = macosx10.6;
198
+ };
199
+ name = Debug;
200
+ };
201
+ 1DEB927A08733DD40010E9CD /* Release */ = {
202
+ isa = XCBuildConfiguration;
203
+ buildSettings = {
204
+ ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
205
+ GCC_C_LANGUAGE_STANDARD = gnu99;
206
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
207
+ GCC_WARN_UNUSED_VARIABLE = YES;
208
+ ONLY_ACTIVE_ARCH = YES;
209
+ PREBINDING = NO;
210
+ SDKROOT = macosx10.6;
211
+ };
212
+ name = Release;
213
+ };
214
+ /* End XCBuildConfiguration section */
215
+
216
+ /* Begin XCConfigurationList section */
217
+ 1DEB927408733DD40010E9CD /* Build configuration list for PBXNativeTarget "WaxSim" */ = {
218
+ isa = XCConfigurationList;
219
+ buildConfigurations = (
220
+ 1DEB927508733DD40010E9CD /* Debug */,
221
+ 1DEB927608733DD40010E9CD /* Release */,
222
+ );
223
+ defaultConfigurationIsVisible = 0;
224
+ defaultConfigurationName = Release;
225
+ };
226
+ 1DEB927808733DD40010E9CD /* Build configuration list for PBXProject "WaxSim" */ = {
227
+ isa = XCConfigurationList;
228
+ buildConfigurations = (
229
+ 1DEB927908733DD40010E9CD /* Debug */,
230
+ 1DEB927A08733DD40010E9CD /* Release */,
231
+ );
232
+ defaultConfigurationIsVisible = 0;
233
+ defaultConfigurationName = Release;
234
+ };
235
+ /* End XCConfigurationList section */
236
+ };
237
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
238
+ }
@@ -0,0 +1,7 @@
1
+ //
2
+ // Prefix header for all source files of the 'WaxSim' target in the 'WaxSim' project.
3
+ //
4
+
5
+ #ifdef __OBJC__
6
+ #import <Foundation/Foundation.h>
7
+ #endif
@@ -0,0 +1,126 @@
1
+ #import <Cocoa/Cocoa.h>
2
+
3
+ /*
4
+ * File: /Developer/Platforms/iPhoneSimulator.platform/Developer/Library/PrivateFrameworks/iPhoneSimulatorRemoteClient.framework/Versions/A/iPhoneSimulatorRemoteClient
5
+ * Arch: Intel 80x86 (i386)
6
+ * Current version: 12.0.0, Compatibility version: 1.0.0
7
+ */
8
+
9
+ @class DTiPhoneSimulatorSession;
10
+
11
+ @protocol DTiPhoneSimulatorSessionDelegate
12
+
13
+ - (void) session: (DTiPhoneSimulatorSession *) session didEndWithError: (NSError *) error;
14
+ - (void) session: (DTiPhoneSimulatorSession *) session didStart: (BOOL) started withError: (NSError *) error;
15
+
16
+ @end
17
+
18
+ @interface DTiPhoneSimulatorApplicationSpecifier : NSObject <NSCopying>
19
+ {
20
+ NSString *_appPath;
21
+ NSString *_bundleID;
22
+ }
23
+
24
+ + (id) specifierWithApplicationPath: (NSString *) appPath;
25
+ + (id) specifierWithApplicationBundleIdentifier: (NSString *) bundleID;
26
+ - (NSString *) bundleID;
27
+ - (void) setBundleID: (NSString *) bundleId;
28
+ - (NSString *) appPath;
29
+ - (void) setAppPath: (NSString *) appPath;
30
+
31
+ @end
32
+
33
+ @interface DTiPhoneSimulatorSystemRoot : NSObject <NSCopying>
34
+ {
35
+ NSString *sdkRootPath;
36
+ NSString *sdkVersion;
37
+ NSString *sdkDisplayName;
38
+ }
39
+
40
+ + (id) defaultRoot;
41
+
42
+ + (id)rootWithSDKPath:(NSString *) path;
43
+ + (id)rootWithSDKVersion:(NSString *)version;
44
+
45
+ + (NSArray *) knownRoots;
46
+ - (id)initWithSDKPath:(id)fp8;
47
+ - (id)sdkDisplayName;
48
+ - (void)setSdkDisplayName:(id)fp8;
49
+ - (id)sdkVersion;
50
+ - (void)setSdkVersion:(id)fp8;
51
+ - (id)sdkRootPath;
52
+ - (void)setSdkRootPath:(id)fp8;
53
+
54
+ @end
55
+
56
+
57
+
58
+ @interface DTiPhoneSimulatorSessionConfig : NSObject <NSCopying>
59
+ {
60
+ NSString *_localizedClientName;
61
+ DTiPhoneSimulatorSystemRoot *_simulatedSystemRoot;
62
+ DTiPhoneSimulatorApplicationSpecifier *_applicationToSimulateOnStart;
63
+ NSArray *_simulatedApplicationLaunchArgs;
64
+ NSDictionary *_simulatedApplicationLaunchEnvironment;
65
+ BOOL _simulatedApplicationShouldWaitForDebugger;
66
+ NSString *_simulatedApplicationStdOutPath;
67
+ NSString *_simulatedApplicationStdErrPath;
68
+ }
69
+
70
+ + (NSString *) displayNameForDeviceFamily: (NSNumber *) family;
71
+
72
+ - (id)simulatedApplicationStdErrPath;
73
+ - (void)setSimulatedApplicationStdErrPath:(id)fp8;
74
+ - (id)simulatedApplicationStdOutPath;
75
+ - (void)setSimulatedApplicationStdOutPath:(id)fp8;
76
+ - (id)simulatedApplicationLaunchEnvironment;
77
+ - (void)setSimulatedApplicationLaunchEnvironment:(id)fp8;
78
+ - (id)simulatedApplicationLaunchArgs;
79
+ - (void)setSimulatedApplicationLaunchArgs:(id)fp8;
80
+
81
+ - (DTiPhoneSimulatorApplicationSpecifier *) applicationToSimulateOnStart;
82
+ - (void) setApplicationToSimulateOnStart: (DTiPhoneSimulatorApplicationSpecifier *) appSpec;
83
+ - (DTiPhoneSimulatorSystemRoot *) simulatedSystemRoot;
84
+ - (void) setSimulatedSystemRoot: (DTiPhoneSimulatorSystemRoot *) simulatedSystemRoot;
85
+
86
+ - (NSNumber *) simulatedDeviceFamily;
87
+ - (void) setSimulatedDeviceFamily: (NSNumber *) family;
88
+
89
+ - (BOOL) simulatedApplicationShouldWaitForDebugger;
90
+ - (void) setSimulatedApplicationShouldWaitForDebugger: (BOOL) waitForDebugger;
91
+
92
+ - (id)localizedClientName;
93
+ - (void)setLocalizedClientName:(id)fp8;
94
+
95
+ @end
96
+
97
+
98
+ @interface DTiPhoneSimulatorSession : NSObject {
99
+ NSString *_uuid;
100
+ id <DTiPhoneSimulatorSessionDelegate> _delegate;
101
+ NSNumber *_simulatedApplicationPID;
102
+ int _sessionLifecycleProgress;
103
+ NSTimer *_timeoutTimer;
104
+ DTiPhoneSimulatorSessionConfig *_sessionConfig;
105
+ struct ProcessSerialNumber _simulatorPSN;
106
+ }
107
+
108
+ - (BOOL) requestStartWithConfig: (DTiPhoneSimulatorSessionConfig *) config timeout: (NSTimeInterval) timeout error: (NSError **) outError;
109
+ - (void) requestEndWithTimeout: (NSTimeInterval) timeout;
110
+
111
+ - (id)sessionConfig;
112
+ - (void)setSessionConfig:(id)fp8;
113
+ - (id)timeoutTimer;
114
+ - (void)setTimeoutTimer:(id)fp8;
115
+ - (int)sessionLifecycleProgress;
116
+ - (void)setSessionLifecycleProgress:(int)fp8;
117
+ - (id)simulatedApplicationPID;
118
+ - (void)setSimulatedApplicationPID:(id)fp8;
119
+
120
+ - (id<DTiPhoneSimulatorSessionDelegate>) delegate;
121
+ - (void) setDelegate: (id<DTiPhoneSimulatorSessionDelegate>) delegate;
122
+
123
+ - (id)uuid;
124
+ - (void)setUuid:(id)fp8;
125
+
126
+ @end
@@ -0,0 +1,27 @@
1
+ require 'tmpdir'
2
+
3
+ class UISpecRunner
4
+ class Drivers
5
+ class WaxSim
6
+ WAXSIM_BIN_DIR = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', '..', 'ext', 'bin'))
7
+
8
+ attr_reader :config
9
+
10
+ def initialize(config)
11
+ @config = config
12
+ end
13
+
14
+ def waxsim_path
15
+ File.join(WAXSIM_BIN_DIR, 'waxsim')
16
+ end
17
+
18
+ def run_specs(env)
19
+ env_args = env.map { |k,v| "-e #{k}=#{v} "}.join(' ')
20
+ # TODO: Add support for family...
21
+ command = %Q{#{waxsim_path} -s #{config.sdk_version} #{env_args} "#{config.app_path}"}
22
+ puts "Executing: #{command}"
23
+ `#{command}`
24
+ end
25
+ end
26
+ end
27
+ end
@@ -18,7 +18,7 @@ class UISpecRunner
18
18
  self[:build_dir] = './build'
19
19
  self[:verbose] = false
20
20
  self[:sdk_version] = '4.0'
21
- self[:driver] = :shell
21
+ self[:driver] = :waxsim
22
22
  self[:exit_on_finish] = true
23
23
 
24
24
  require 'optparse'
@@ -64,9 +64,9 @@ class UISpecRunner
64
64
  self[:scheme] = scheme
65
65
  end
66
66
 
67
- o.on('--driver [DRIVER]', [:shell, :osascript],
68
- "Select driver (shell, osascript)",
69
- 'Default: shell') do |driver|
67
+ o.on('--driver [DRIVER]', [:shell, :osascript, :waxsim],
68
+ "Select driver (shell, osascript, waxsim)",
69
+ 'Default: waxsim') do |driver|
70
70
  self[:driver] = driver.to_sym
71
71
  end
72
72
 
data/lib/uispecrunner.rb CHANGED
@@ -7,6 +7,7 @@ gem 'open4', '>= 1.0.1'
7
7
  require 'open4'
8
8
  require 'uispecrunner/xcode_builder'
9
9
  require 'uispecrunner/drivers/shell'
10
+ require 'uispecrunner/drivers/waxsim'
10
11
  require 'uispecrunner/drivers/osascript'
11
12
 
12
13
  class UISpecRunner
@@ -24,7 +25,7 @@ class UISpecRunner
24
25
  self.configuration ||= 'Debug'
25
26
  self.build_dir ||= './build'
26
27
  self.run_mode ||= :all
27
- self.driver ||= :shell
28
+ self.driver ||= :waxsim
28
29
  self.exit_on_finish ||= true
29
30
  self.env ||= {}
30
31
  end
@@ -92,11 +93,12 @@ class UISpecRunner
92
93
 
93
94
  private
94
95
  def driver_class
95
- # TODO: Add WaxSim...
96
96
  if self.driver == :shell
97
97
  UISpecRunner::Drivers::Shell
98
98
  elsif self.driver == :osascript
99
99
  UISpecRunner::Drivers::OSAScript
100
+ elsif self.driver == :waxsim
101
+ UISpecRunner::Drivers::WaxSim
100
102
  end
101
103
  end
102
104
 
@@ -9,6 +9,12 @@
9
9
  #import <Foundation/Foundation.h>
10
10
  #import "UISpec.h"
11
11
 
12
+ // Define protocols for Unit and Integration specs
13
+ @protocol UISpecUnit <NSObject>
14
+ @end
15
+ @protocol UISpecIntegration <NSObject>
16
+ @end
17
+
12
18
  @interface UISpec (UISpecRunner)
13
19
 
14
20
  /**
data/uispecrunner.gemspec CHANGED
@@ -5,30 +5,40 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{uispecrunner}
8
- s.version = "0.4.0"
8
+ s.version = "0.4.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Blake Watters"]
12
- s.date = %q{2011-03-09}
12
+ s.date = %q{2011-03-12}
13
13
  s.default_executable = %q{uispec}
14
14
  s.description = %q{Provides a simple Ruby interface for running UISpec iPhone tests}
15
15
  s.email = %q{blake@twotoasters.com}
16
16
  s.executables = ["uispec"]
17
+ s.extensions = ["ext/Rakefile"]
17
18
  s.extra_rdoc_files = [
18
19
  "LICENSE",
19
20
  "README.md"
20
21
  ]
21
22
  s.files = [
23
+ ".gitmodules",
22
24
  "CHANGELOG",
23
25
  "LICENSE",
24
26
  "README.md",
25
27
  "Rakefile",
26
28
  "VERSION",
27
29
  "bin/uispec",
30
+ "ext/Rakefile",
31
+ "ext/WaxSim/Simulator.h",
32
+ "ext/WaxSim/Simulator.m",
33
+ "ext/WaxSim/WaxSim.m",
34
+ "ext/WaxSim/WaxSim.xcodeproj/project.pbxproj",
35
+ "ext/WaxSim/WaxSim_Prefix.pch",
36
+ "ext/WaxSim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h",
28
37
  "lib/uispecrunner.rb",
29
38
  "lib/uispecrunner/application.rb",
30
39
  "lib/uispecrunner/drivers/osascript.rb",
31
40
  "lib/uispecrunner/drivers/shell.rb",
41
+ "lib/uispecrunner/drivers/waxsim.rb",
32
42
  "lib/uispecrunner/options.rb",
33
43
  "lib/uispecrunner/xcode_builder.rb",
34
44
  "spec/options_spec.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uispecrunner
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Blake Watters
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-09 00:00:00 -05:00
18
+ date: 2011-03-12 00:00:00 -05:00
19
19
  default_executable: uispec
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -54,22 +54,31 @@ description: Provides a simple Ruby interface for running UISpec iPhone tests
54
54
  email: blake@twotoasters.com
55
55
  executables:
56
56
  - uispec
57
- extensions: []
58
-
57
+ extensions:
58
+ - ext/Rakefile
59
59
  extra_rdoc_files:
60
60
  - LICENSE
61
61
  - README.md
62
62
  files:
63
+ - .gitmodules
63
64
  - CHANGELOG
64
65
  - LICENSE
65
66
  - README.md
66
67
  - Rakefile
67
68
  - VERSION
68
69
  - bin/uispec
70
+ - ext/Rakefile
71
+ - ext/WaxSim/Simulator.h
72
+ - ext/WaxSim/Simulator.m
73
+ - ext/WaxSim/WaxSim.m
74
+ - ext/WaxSim/WaxSim.xcodeproj/project.pbxproj
75
+ - ext/WaxSim/WaxSim_Prefix.pch
76
+ - ext/WaxSim/iPhoneSimulatorRemoteClient/iPhoneSimulatorRemoteClient.h
69
77
  - lib/uispecrunner.rb
70
78
  - lib/uispecrunner/application.rb
71
79
  - lib/uispecrunner/drivers/osascript.rb
72
80
  - lib/uispecrunner/drivers/shell.rb
81
+ - lib/uispecrunner/drivers/waxsim.rb
73
82
  - lib/uispecrunner/options.rb
74
83
  - lib/uispecrunner/xcode_builder.rb
75
84
  - spec/options_spec.rb