simctl 1.4.1 → 1.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3bdc998a600a6d6fd3061c51c856e1ae06b14ca8
4
- data.tar.gz: 8547d49764806e85eaabd8fb005d1006967a0b52
3
+ metadata.gz: 11fcd32b757a21e4fbf179095f081bf05c173a62
4
+ data.tar.gz: 1422938aace085d235c73e5bc62c70a78b52ae1a
5
5
  SHA512:
6
- metadata.gz: 7ae1446d24e47f8e76ff7bc0d7cbf333649c78353ca87a5413331246226f18adf4d569611f3478e8bd1481d8748f3db7ec5a38a0e009da27e03e357aa73725e8
7
- data.tar.gz: 3f3a2c148cf03e84d00642745346b8a23239fc1c60a07af6087f42c87244b2ecdab93e902b3885ec98f6932b87dea8069da8d28fc96485cc247738dfcc351c64
6
+ metadata.gz: 4caf9e1dda2ecf77aadea8d71c2ae6a329dfd2b24b0807bab3b67d8cdf6e9b8041263b49e8f6fc5a979ec0f3b9677deab74e936ee26407cc84aff6e95f767450
7
+ data.tar.gz: 9e264b21cb31b756c297333f4e8c1f030dd5eaf144eb48244638cab1e94106b7b79682ae0e87923d2a9ba84ff084f6cca83a285370a92492f54b45fbee817106
@@ -0,0 +1,5 @@
1
+ # 1.5.0
2
+
3
+ * `SimCtl#devicetype` throws exception if device type could not be found
4
+ * `SimCtl#runtime` throws exception if runtime could not be found
5
+ * Support installing and launching an app
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simctl (1.4.1)
4
+ simctl (1.5.0)
5
5
  CFPropertyList
6
6
 
7
7
  GEM
@@ -54,3 +54,6 @@ DEPENDENCIES
54
54
  rake
55
55
  shoulda-context
56
56
  simctl!
57
+
58
+ BUNDLED WITH
59
+ 1.11.2
@@ -2,6 +2,7 @@ require 'simctl/command/boot'
2
2
  require 'simctl/command/create'
3
3
  require 'simctl/command/delete'
4
4
  require 'simctl/command/erase'
5
+ require 'simctl/command/install'
5
6
  require 'simctl/command/kill'
6
7
  require 'simctl/command/launch'
7
8
  require 'simctl/command/list'
@@ -16,6 +17,7 @@ module SimCtl
16
17
  include SimCtl::Command::Create
17
18
  include SimCtl::Command::Delete
18
19
  include SimCtl::Command::Erase
20
+ include SimCtl::Command::Install
19
21
  include SimCtl::Command::Kill
20
22
  include SimCtl::Command::Launch
21
23
  include SimCtl::Command::List
@@ -0,0 +1,18 @@
1
+ require 'shellwords'
2
+
3
+ module SimCtl
4
+ class Command
5
+ module Install
6
+ COMMAND = %w[xcrun simctl install]
7
+
8
+ # Installs an app on a device
9
+ #
10
+ # @param device [SimCtl::Device] the device the app should be installed on
11
+ # @param path Absolute path to the app that should be installed
12
+ # @return [void]
13
+ def install_app(device, path)
14
+ Executor.execute([COMMAND, device.udid, Shellwords.shellescape(path)])
15
+ end
16
+ end
17
+ end
18
+ end
@@ -1,8 +1,11 @@
1
+ require 'shellwords'
2
+
1
3
  module SimCtl
2
4
  class Command
3
5
  module Launch
4
- XCODE_HOME = `xcode-select -p`.chomp
6
+ LAUNCH_APP_COMMAND = 'xcrun simctl launch'
5
7
  SUPPORTED_SCALE = [1.0, 0.75, 0.5, 0.25]
8
+ XCODE_HOME = `xcode-select -p`.chomp
6
9
 
7
10
  # Launches a Simulator instance with the given device
8
11
  #
@@ -21,6 +24,19 @@ module SimCtl
21
24
  command = "open -Fgn #{XCODE_HOME}/Applications/Simulator.app --args #{args}"
22
25
  system command
23
26
  end
27
+
28
+ # Launches an app in the given device
29
+ #
30
+ # @param device [SimCtl::Device] the device to launch
31
+ # @param opts [Hash] options hash - `{ wait_for_debugger: true/false }`
32
+ # @param identifier [String] the app identifier
33
+ # @param args [Array] optional launch arguments
34
+ # @return [void]
35
+ def launch_app(device, identifier, args=[], opts={})
36
+ launch_args = args.map {|arg| Shellwords.shellescape arg}
37
+ launch_opts = opts[:wait_for_debugger] ? '-w' : ''
38
+ Executor.execute([LAUNCH_APP_COMMAND, launch_opts, device.udid, identifier, launch_args])
39
+ end
24
40
  end
25
41
  end
26
42
  end
@@ -1,4 +1,6 @@
1
1
  module SimCtl
2
+ class DeviceTypeNotFound < StandardError; end
3
+ class RuntimeNotFound < StandardError; end
2
4
  class Command
3
5
  module List
4
6
  COMMAND = %w[xcrun simctl list -j]
@@ -14,9 +16,10 @@ module SimCtl
14
16
  # Find a device type
15
17
  #
16
18
  # @param filter [Hash] the filter
17
- # @return [SimCtl::DeviceType, nil] the device type matching the given filter
19
+ # @return [SimCtl::DeviceType] the device type matching the given filter
20
+ # @raise [DeviceTypeNotFound] if the device type could not be found
18
21
  def devicetype(filter)
19
- list_devicetypes.where(filter).first
22
+ list_devicetypes.where(filter).first or raise DeviceTypeNotFound.new("Could not find a device type matching #{filter.inspect}")
20
23
  end
21
24
 
22
25
  # List all devices
@@ -49,9 +52,10 @@ module SimCtl
49
52
  # Find a runtime
50
53
  #
51
54
  # @param filter [Hash] the filter
52
- # @return [SimCtl::Runtime, nil] the runtime matching the given filter
55
+ # @return [SimCtl::Runtime] the runtime matching the given filter
56
+ # @raise [RuntimeNotFound] if the runtime could not be found
53
57
  def runtime(filter)
54
- list_runtimes.where(filter).first
58
+ list_runtimes.where(filter).first or raise RuntimeNotFound.new("Could not find a runtime matching #{filter.inspect}")
55
59
  end
56
60
 
57
61
  end
@@ -45,6 +45,14 @@ module SimCtl
45
45
  SimCtl.erase_device(self)
46
46
  end
47
47
 
48
+ # Installs an app on a device
49
+ #
50
+ # @param path Absolute path to the app that should be installed
51
+ # @return [void]
52
+ def install!(path)
53
+ SimCtl.install_app(self, path)
54
+ end
55
+
48
56
  # Kills the device
49
57
  #
50
58
  # @return [void]
@@ -59,6 +67,16 @@ module SimCtl
59
67
  SimCtl.launch_device(self, scale, opts)
60
68
  end
61
69
 
70
+ # Launches an app in the given device
71
+ #
72
+ # @param opts [Hash] options hash - `{ wait_for_debugger: true/false }`
73
+ # @param identifier [String] the app identifier
74
+ # @param args [Array] optional launch arguments
75
+ # @return [void]
76
+ def launch_app!(identifier, args=[], opts={})
77
+ SimCtl.launch_app(self, identifier, args, opts)
78
+ end
79
+
62
80
  def path
63
81
  @path ||= DevicePath.new(udid)
64
82
  end
@@ -6,9 +6,13 @@ module SimCtl
6
6
  class << self
7
7
  def execute(command)
8
8
  command = command.flatten.join(' ')
9
+ $stderr.puts command if ENV['SIMCTL_DEBUG']
9
10
  Open3.popen3(command) do |stdin, stdout, stderr, result|
10
11
  output = stdout.read
11
- raise StandardError.new(output) if result.value.to_i > 0
12
+ if result.value.to_i > 0
13
+ output = stderr.read if output.empty?
14
+ raise StandardError.new(output)
15
+ end
12
16
  return unless block_given?
13
17
  if looks_like_json?(output)
14
18
  yield JSON.parse(output)
@@ -1,3 +1,3 @@
1
1
  module SimCtl
2
- VERSION = "1.4.1"
2
+ VERSION = '1.5.0'
3
3
  end
@@ -0,0 +1,51 @@
1
+ # Xcode
2
+ #
3
+ # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
4
+
5
+ ## Build generated
6
+ build/
7
+ DerivedData/
8
+
9
+ ## Various settings
10
+ *.pbxuser
11
+ !default.pbxuser
12
+ *.mode1v3
13
+ !default.mode1v3
14
+ *.mode2v3
15
+ !default.mode2v3
16
+ *.perspectivev3
17
+ !default.perspectivev3
18
+ xcuserdata/
19
+
20
+ ## Other
21
+ *.moved-aside
22
+ *.xcuserstate
23
+
24
+ ## Obj-C/Swift specific
25
+ *.hmap
26
+ *.ipa
27
+
28
+ # CocoaPods
29
+ #
30
+ # We recommend against adding the Pods directory to your .gitignore. However
31
+ # you should judge for yourself, the pros and cons are mentioned at:
32
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
33
+ #
34
+ # Pods/
35
+
36
+ # Carthage
37
+ #
38
+ # Add this line if you want to avoid checking in source code from Carthage dependencies.
39
+ # Carthage/Checkouts
40
+
41
+ Carthage/Build
42
+
43
+ # fastlane
44
+ #
45
+ # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46
+ # screenshots whenever they are needed.
47
+ # For more information about the recommended setup visit:
48
+ # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md
49
+
50
+ fastlane/report.xml
51
+ fastlane/screenshots
@@ -0,0 +1,269 @@
1
+ // !$*UTF8*$!
2
+ {
3
+ archiveVersion = 1;
4
+ classes = {
5
+ };
6
+ objectVersion = 46;
7
+ objects = {
8
+
9
+ /* Begin PBXBuildFile section */
10
+ 05185E8C1CC73EFA00987485 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 05185E8B1CC73EFA00987485 /* main.m */; };
11
+ 05185E8F1CC73EFA00987485 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 05185E8E1CC73EFA00987485 /* AppDelegate.m */; };
12
+ /* End PBXBuildFile section */
13
+
14
+ /* Begin PBXFileReference section */
15
+ 05185E871CC73EFA00987485 /* SampleApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SampleApp.app; sourceTree = BUILT_PRODUCTS_DIR; };
16
+ 05185E8B1CC73EFA00987485 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
17
+ 05185E8D1CC73EFA00987485 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
18
+ 05185E8E1CC73EFA00987485 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
19
+ 05185E9B1CC73EFA00987485 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
20
+ /* End PBXFileReference section */
21
+
22
+ /* Begin PBXFrameworksBuildPhase section */
23
+ 05185E841CC73EFA00987485 /* Frameworks */ = {
24
+ isa = PBXFrameworksBuildPhase;
25
+ buildActionMask = 2147483647;
26
+ files = (
27
+ );
28
+ runOnlyForDeploymentPostprocessing = 0;
29
+ };
30
+ /* End PBXFrameworksBuildPhase section */
31
+
32
+ /* Begin PBXGroup section */
33
+ 05185E7E1CC73EFA00987485 = {
34
+ isa = PBXGroup;
35
+ children = (
36
+ 05185E891CC73EFA00987485 /* SampleApp */,
37
+ 05185E881CC73EFA00987485 /* Products */,
38
+ );
39
+ sourceTree = "<group>";
40
+ };
41
+ 05185E881CC73EFA00987485 /* Products */ = {
42
+ isa = PBXGroup;
43
+ children = (
44
+ 05185E871CC73EFA00987485 /* SampleApp.app */,
45
+ );
46
+ name = Products;
47
+ sourceTree = "<group>";
48
+ };
49
+ 05185E891CC73EFA00987485 /* SampleApp */ = {
50
+ isa = PBXGroup;
51
+ children = (
52
+ 05185E8D1CC73EFA00987485 /* AppDelegate.h */,
53
+ 05185E8E1CC73EFA00987485 /* AppDelegate.m */,
54
+ 05185E9B1CC73EFA00987485 /* Info.plist */,
55
+ 05185E8A1CC73EFA00987485 /* Supporting Files */,
56
+ );
57
+ path = SampleApp;
58
+ sourceTree = "<group>";
59
+ };
60
+ 05185E8A1CC73EFA00987485 /* Supporting Files */ = {
61
+ isa = PBXGroup;
62
+ children = (
63
+ 05185E8B1CC73EFA00987485 /* main.m */,
64
+ );
65
+ name = "Supporting Files";
66
+ sourceTree = "<group>";
67
+ };
68
+ /* End PBXGroup section */
69
+
70
+ /* Begin PBXNativeTarget section */
71
+ 05185E861CC73EFA00987485 /* SampleApp */ = {
72
+ isa = PBXNativeTarget;
73
+ buildConfigurationList = 05185E9E1CC73EFA00987485 /* Build configuration list for PBXNativeTarget "SampleApp" */;
74
+ buildPhases = (
75
+ 05185E831CC73EFA00987485 /* Sources */,
76
+ 05185E841CC73EFA00987485 /* Frameworks */,
77
+ 05185E851CC73EFA00987485 /* Resources */,
78
+ );
79
+ buildRules = (
80
+ );
81
+ dependencies = (
82
+ );
83
+ name = SampleApp;
84
+ productName = SampleApp;
85
+ productReference = 05185E871CC73EFA00987485 /* SampleApp.app */;
86
+ productType = "com.apple.product-type.application";
87
+ };
88
+ /* End PBXNativeTarget section */
89
+
90
+ /* Begin PBXProject section */
91
+ 05185E7F1CC73EFA00987485 /* Project object */ = {
92
+ isa = PBXProject;
93
+ attributes = {
94
+ LastUpgradeCheck = 0730;
95
+ ORGANIZATIONNAME = "Johannes Plunien";
96
+ TargetAttributes = {
97
+ 05185E861CC73EFA00987485 = {
98
+ CreatedOnToolsVersion = 7.3;
99
+ };
100
+ };
101
+ };
102
+ buildConfigurationList = 05185E821CC73EFA00987485 /* Build configuration list for PBXProject "SampleApp" */;
103
+ compatibilityVersion = "Xcode 3.2";
104
+ developmentRegion = English;
105
+ hasScannedForEncodings = 0;
106
+ knownRegions = (
107
+ en,
108
+ Base,
109
+ );
110
+ mainGroup = 05185E7E1CC73EFA00987485;
111
+ productRefGroup = 05185E881CC73EFA00987485 /* Products */;
112
+ projectDirPath = "";
113
+ projectRoot = "";
114
+ targets = (
115
+ 05185E861CC73EFA00987485 /* SampleApp */,
116
+ );
117
+ };
118
+ /* End PBXProject section */
119
+
120
+ /* Begin PBXResourcesBuildPhase section */
121
+ 05185E851CC73EFA00987485 /* Resources */ = {
122
+ isa = PBXResourcesBuildPhase;
123
+ buildActionMask = 2147483647;
124
+ files = (
125
+ );
126
+ runOnlyForDeploymentPostprocessing = 0;
127
+ };
128
+ /* End PBXResourcesBuildPhase section */
129
+
130
+ /* Begin PBXSourcesBuildPhase section */
131
+ 05185E831CC73EFA00987485 /* Sources */ = {
132
+ isa = PBXSourcesBuildPhase;
133
+ buildActionMask = 2147483647;
134
+ files = (
135
+ 05185E8F1CC73EFA00987485 /* AppDelegate.m in Sources */,
136
+ 05185E8C1CC73EFA00987485 /* main.m in Sources */,
137
+ );
138
+ runOnlyForDeploymentPostprocessing = 0;
139
+ };
140
+ /* End PBXSourcesBuildPhase section */
141
+
142
+ /* Begin XCBuildConfiguration section */
143
+ 05185E9C1CC73EFA00987485 /* Debug */ = {
144
+ isa = XCBuildConfiguration;
145
+ buildSettings = {
146
+ ALWAYS_SEARCH_USER_PATHS = NO;
147
+ CLANG_ANALYZER_NONNULL = YES;
148
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
149
+ CLANG_CXX_LIBRARY = "libc++";
150
+ CLANG_ENABLE_MODULES = YES;
151
+ CLANG_ENABLE_OBJC_ARC = YES;
152
+ CLANG_WARN_BOOL_CONVERSION = YES;
153
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
154
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
155
+ CLANG_WARN_EMPTY_BODY = YES;
156
+ CLANG_WARN_ENUM_CONVERSION = YES;
157
+ CLANG_WARN_INT_CONVERSION = YES;
158
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
159
+ CLANG_WARN_UNREACHABLE_CODE = YES;
160
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
161
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
162
+ COPY_PHASE_STRIP = NO;
163
+ DEBUG_INFORMATION_FORMAT = dwarf;
164
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
165
+ ENABLE_TESTABILITY = YES;
166
+ GCC_C_LANGUAGE_STANDARD = gnu99;
167
+ GCC_DYNAMIC_NO_PIC = NO;
168
+ GCC_NO_COMMON_BLOCKS = YES;
169
+ GCC_OPTIMIZATION_LEVEL = 0;
170
+ GCC_PREPROCESSOR_DEFINITIONS = (
171
+ "DEBUG=1",
172
+ "$(inherited)",
173
+ );
174
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
175
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
176
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
177
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
178
+ GCC_WARN_UNUSED_FUNCTION = YES;
179
+ GCC_WARN_UNUSED_VARIABLE = YES;
180
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
181
+ MTL_ENABLE_DEBUG_INFO = YES;
182
+ ONLY_ACTIVE_ARCH = YES;
183
+ SDKROOT = iphoneos;
184
+ };
185
+ name = Debug;
186
+ };
187
+ 05185E9D1CC73EFA00987485 /* Release */ = {
188
+ isa = XCBuildConfiguration;
189
+ buildSettings = {
190
+ ALWAYS_SEARCH_USER_PATHS = NO;
191
+ CLANG_ANALYZER_NONNULL = YES;
192
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
193
+ CLANG_CXX_LIBRARY = "libc++";
194
+ CLANG_ENABLE_MODULES = YES;
195
+ CLANG_ENABLE_OBJC_ARC = YES;
196
+ CLANG_WARN_BOOL_CONVERSION = YES;
197
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
198
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
199
+ CLANG_WARN_EMPTY_BODY = YES;
200
+ CLANG_WARN_ENUM_CONVERSION = YES;
201
+ CLANG_WARN_INT_CONVERSION = YES;
202
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
203
+ CLANG_WARN_UNREACHABLE_CODE = YES;
204
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
205
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
206
+ COPY_PHASE_STRIP = NO;
207
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
208
+ ENABLE_NS_ASSERTIONS = NO;
209
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
210
+ GCC_C_LANGUAGE_STANDARD = gnu99;
211
+ GCC_NO_COMMON_BLOCKS = YES;
212
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
213
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
214
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
215
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
216
+ GCC_WARN_UNUSED_FUNCTION = YES;
217
+ GCC_WARN_UNUSED_VARIABLE = YES;
218
+ IPHONEOS_DEPLOYMENT_TARGET = 9.3;
219
+ MTL_ENABLE_DEBUG_INFO = NO;
220
+ SDKROOT = iphoneos;
221
+ VALIDATE_PRODUCT = YES;
222
+ };
223
+ name = Release;
224
+ };
225
+ 05185E9F1CC73EFA00987485 /* Debug */ = {
226
+ isa = XCBuildConfiguration;
227
+ buildSettings = {
228
+ INFOPLIST_FILE = SampleApp/Info.plist;
229
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
230
+ PRODUCT_BUNDLE_IDENTIFIER = com.github.plu.simctl.SampleApp;
231
+ PRODUCT_NAME = "$(TARGET_NAME)";
232
+ };
233
+ name = Debug;
234
+ };
235
+ 05185EA01CC73EFA00987485 /* Release */ = {
236
+ isa = XCBuildConfiguration;
237
+ buildSettings = {
238
+ INFOPLIST_FILE = SampleApp/Info.plist;
239
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
240
+ PRODUCT_BUNDLE_IDENTIFIER = com.github.plu.simctl.SampleApp;
241
+ PRODUCT_NAME = "$(TARGET_NAME)";
242
+ };
243
+ name = Release;
244
+ };
245
+ /* End XCBuildConfiguration section */
246
+
247
+ /* Begin XCConfigurationList section */
248
+ 05185E821CC73EFA00987485 /* Build configuration list for PBXProject "SampleApp" */ = {
249
+ isa = XCConfigurationList;
250
+ buildConfigurations = (
251
+ 05185E9C1CC73EFA00987485 /* Debug */,
252
+ 05185E9D1CC73EFA00987485 /* Release */,
253
+ );
254
+ defaultConfigurationIsVisible = 0;
255
+ defaultConfigurationName = Release;
256
+ };
257
+ 05185E9E1CC73EFA00987485 /* Build configuration list for PBXNativeTarget "SampleApp" */ = {
258
+ isa = XCConfigurationList;
259
+ buildConfigurations = (
260
+ 05185E9F1CC73EFA00987485 /* Debug */,
261
+ 05185EA01CC73EFA00987485 /* Release */,
262
+ );
263
+ defaultConfigurationIsVisible = 0;
264
+ defaultConfigurationName = Release;
265
+ };
266
+ /* End XCConfigurationList section */
267
+ };
268
+ rootObject = 05185E7F1CC73EFA00987485 /* Project object */;
269
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ <FileRef
5
+ location = "self:SampleApp.xcodeproj">
6
+ </FileRef>
7
+ </Workspace>
@@ -0,0 +1,17 @@
1
+ //
2
+ // AppDelegate.h
3
+ // SampleApp
4
+ //
5
+ // Created by Plunien, Johannes on 20/04/16.
6
+ // Copyright © 2016 Johannes Plunien. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+
11
+ @interface AppDelegate : UIResponder <UIApplicationDelegate>
12
+
13
+ @property (strong, nonatomic) UIWindow *window;
14
+
15
+
16
+ @end
17
+
@@ -0,0 +1,17 @@
1
+ //
2
+ // AppDelegate.m
3
+ // SampleApp
4
+ //
5
+ // Created by Plunien, Johannes on 20/04/16.
6
+ // Copyright © 2016 Johannes Plunien. All rights reserved.
7
+ //
8
+
9
+ #import "AppDelegate.h"
10
+
11
+ @interface AppDelegate ()
12
+
13
+ @end
14
+
15
+ @implementation AppDelegate
16
+
17
+ @end
@@ -0,0 +1,38 @@
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>CFBundleDevelopmentRegion</key>
6
+ <string>en</string>
7
+ <key>CFBundleExecutable</key>
8
+ <string>$(EXECUTABLE_NAME)</string>
9
+ <key>CFBundleIdentifier</key>
10
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
11
+ <key>CFBundleInfoDictionaryVersion</key>
12
+ <string>6.0</string>
13
+ <key>CFBundleName</key>
14
+ <string>$(PRODUCT_NAME)</string>
15
+ <key>CFBundlePackageType</key>
16
+ <string>APPL</string>
17
+ <key>CFBundleShortVersionString</key>
18
+ <string>1.0</string>
19
+ <key>CFBundleSignature</key>
20
+ <string>????</string>
21
+ <key>CFBundleVersion</key>
22
+ <string>1</string>
23
+ <key>LSRequiresIPhoneOS</key>
24
+ <true/>
25
+ <key>UIMainStoryboardFile</key>
26
+ <string>Main</string>
27
+ <key>UIRequiredDeviceCapabilities</key>
28
+ <array>
29
+ <string>armv7</string>
30
+ </array>
31
+ <key>UISupportedInterfaceOrientations</key>
32
+ <array>
33
+ <string>UIInterfaceOrientationPortrait</string>
34
+ <string>UIInterfaceOrientationLandscapeLeft</string>
35
+ <string>UIInterfaceOrientationLandscapeRight</string>
36
+ </array>
37
+ </dict>
38
+ </plist>
@@ -0,0 +1,17 @@
1
+ //
2
+ // main.m
3
+ // SampleApp
4
+ //
5
+ // Created by Plunien, Johannes on 20/04/16.
6
+ // Copyright © 2016 Johannes Plunien. All rights reserved.
7
+ //
8
+
9
+ #import <UIKit/UIKit.h>
10
+ #import "AppDelegate.h"
11
+
12
+ int main(int argc, char *argv[])
13
+ {
14
+ @autoreleasepool {
15
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
16
+ }
17
+ }
@@ -16,13 +16,13 @@ class SimCtl::Command::CRUDTest < Minitest::Test
16
16
  assert_raises { SimCtl.create_device name, SimCtl::DeviceType.find(name: devicetype), 'invalid runtime' }
17
17
  end
18
18
 
19
- should '01. create a new device' do
19
+ should '0100. create a new device' do
20
20
  device = SimCtl.create_device name, devicetype, SimCtl::Runtime.latest(:ios)
21
21
  device.wait! {|d| d.state == :shutdown}
22
22
  udid = device.udid
23
23
  end
24
24
 
25
- should '02. find the device by udid' do
25
+ should '0200. find the device by udid' do
26
26
  device = SimCtl.device(udid: udid)
27
27
  assert_kind_of SimCtl::Device, device
28
28
  assert device.availability != nil
@@ -32,62 +32,80 @@ class SimCtl::Command::CRUDTest < Minitest::Test
32
32
  assert device.udid != nil
33
33
  end
34
34
 
35
- should '03. find the device by name' do
35
+ should '0300. find the device by name' do
36
36
  assert SimCtl.device(name: name).udid == udid
37
37
  assert SimCtl.device(name: name) == SimCtl.device(udid: udid)
38
38
  end
39
39
 
40
- should '04. have devicetype property' do
40
+ should '0400. have devicetype property' do
41
41
  assert SimCtl.device(udid: udid).devicetype == SimCtl.devicetype(name: devicetype)
42
42
  end
43
43
 
44
- should '05. have runtime property' do
44
+ should '0500. have runtime property' do
45
45
  assert SimCtl.device(udid: udid).runtime == SimCtl::Runtime.latest(:ios)
46
46
  end
47
47
 
48
- should '06. rename the device' do
48
+ should '0600. rename the device' do
49
49
  SimCtl.device(udid: udid).rename!('new name')
50
50
  assert SimCtl.device(udid: udid).name == 'new name'
51
51
  end
52
52
 
53
- should '07. erase the device' do
53
+ should '0700. erase the device' do
54
54
  SimCtl.device(udid: udid).erase!
55
55
  end
56
56
 
57
- should '08. launch the device' do
57
+ should '0800. launch the device' do
58
58
  device = SimCtl.device(udid: udid)
59
59
  device.launch!
60
60
  device.wait!{|d| d.state == :booted}
61
61
  end
62
62
 
63
- should '09. kill the device' do
63
+ should '0810. launch safari' do
64
+ device = SimCtl.device(udid: udid)
65
+ device.launch_app!('com.apple.mobilesafari')
66
+ end
67
+
68
+ should '0820. install SampleApp' do
69
+ system 'cd test/SampleApp && xcodebuild -sdk iphonesimulator >/dev/null 2>&1'
70
+ device = SimCtl.device(udid: udid)
71
+ device.install!('test/SampleApp/build/Release-iphonesimulator/SampleApp.app')
72
+ end
73
+
74
+ should '0830. launch SampleApp' do
75
+ system 'cd test/SampleApp && xcodebuild -sdk iphonesimulator >/dev/null 2>&1'
76
+ device = SimCtl.device(udid: udid)
77
+ device.launch_app!('com.github.plu.simctl.SampleApp')
78
+ end
79
+
80
+ should '0900. kill the device' do
64
81
  device = SimCtl.device(udid: udid)
65
82
  assert device.kill!
66
83
  device.wait!{|d| d.state == :shutdown}
67
84
  end
68
85
 
69
- should '10. boot the device' do
86
+ should '1000. boot the device' do
70
87
  device = SimCtl.device(udid: udid)
71
88
  device.boot!
72
89
  device.wait!{|d| d.state == :booted}
73
90
  end
74
91
 
75
- should '11. shutdown the device' do
92
+ should '1100. shutdown the device' do
76
93
  device = SimCtl.device(udid: udid)
77
94
  device.shutdown!
78
95
  device.wait!{|d| d.state == :shutdown}
79
96
  end
80
97
 
81
- should '12. disable keyboard helpers' do
98
+ should '1200. disable keyboard helpers' do
82
99
  device = SimCtl.device(udid: udid)
83
100
  device.settings.disable_keyboard_helpers!
84
101
  assert File.exists?(device.path.preferences_plist)
85
102
  end
86
103
 
87
- should '98. reset the device' do
104
+ should '9800. reset the device' do
88
105
  old_device = SimCtl.device(udid: udid)
89
106
  new_device = old_device.reset!
90
107
  new_device.wait!{|d| d.state != :creating}
108
+ new_device.wait!{|d| File.exists?(d.path.device_plist)}
91
109
  assert old_device.name == new_device.name
92
110
  assert old_device.devicetype == new_device.devicetype
93
111
  assert old_device.runtime == new_device.runtime
@@ -95,7 +113,7 @@ class SimCtl::Command::CRUDTest < Minitest::Test
95
113
  udid = new_device.udid
96
114
  end
97
115
 
98
- should '99. delete the device' do
116
+ should '9900. delete the device' do
99
117
  device = SimCtl.device(udid: udid)
100
118
  device.delete!
101
119
  assert_nil SimCtl.device(udid: udid)
@@ -5,6 +5,10 @@ class SimCtl::Command::ListTest < Minitest::Test
5
5
  should 'find device type by name' do
6
6
  assert_kind_of SimCtl::DeviceType, SimCtl.devicetype(name: 'iPhone 5')
7
7
  end
8
+
9
+ should 'raise exception if device type is not found' do
10
+ assert_raises { SimCtl.devicetype(name: 'iPhone 1') }
11
+ end
8
12
  end
9
13
 
10
14
  context 'list_devicetypes' do
@@ -65,7 +69,11 @@ class SimCtl::Command::ListTest < Minitest::Test
65
69
 
66
70
  context 'runtime' do
67
71
  should 'find runtime by name' do
68
- assert_kind_of SimCtl::Runtime, SimCtl.runtime(name: 'iOS 9.2')
72
+ assert_kind_of SimCtl::Runtime, SimCtl.runtime(name: 'iOS 9.3')
73
+ end
74
+
75
+ should 'raise exception if runtime is not found' do
76
+ assert_raises { SimCtl.runtime(name: 'iOS 17.0') }
69
77
  end
70
78
  end
71
79
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simctl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.1
4
+ version: 1.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johannes Plunien
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-31 00:00:00.000000000 Z
11
+ date: 2016-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -90,6 +90,7 @@ files:
90
90
  - ".coveralls.yml"
91
91
  - ".gitignore"
92
92
  - ".travis.yml"
93
+ - CHANGELOG.md
93
94
  - Gemfile
94
95
  - Gemfile.lock
95
96
  - LICENSE
@@ -101,6 +102,7 @@ files:
101
102
  - lib/simctl/command/create.rb
102
103
  - lib/simctl/command/delete.rb
103
104
  - lib/simctl/command/erase.rb
105
+ - lib/simctl/command/install.rb
104
106
  - lib/simctl/command/kill.rb
105
107
  - lib/simctl/command/launch.rb
106
108
  - lib/simctl/command/list.rb
@@ -117,6 +119,13 @@ files:
117
119
  - lib/simctl/runtime.rb
118
120
  - lib/simctl/version.rb
119
121
  - simctl.gemspec
122
+ - test/SampleApp/.gitignore
123
+ - test/SampleApp/SampleApp.xcodeproj/project.pbxproj
124
+ - test/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
125
+ - test/SampleApp/SampleApp/AppDelegate.h
126
+ - test/SampleApp/SampleApp/AppDelegate.m
127
+ - test/SampleApp/SampleApp/Info.plist
128
+ - test/SampleApp/SampleApp/main.m
120
129
  - test/simctl/command/crud_test.rb
121
130
  - test/simctl/command/list_test.rb
122
131
  - test/test_helper.rb
@@ -145,6 +154,13 @@ signing_key:
145
154
  specification_version: 4
146
155
  summary: Ruby interface to xcrun simctl
147
156
  test_files:
157
+ - test/SampleApp/.gitignore
158
+ - test/SampleApp/SampleApp.xcodeproj/project.pbxproj
159
+ - test/SampleApp/SampleApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata
160
+ - test/SampleApp/SampleApp/AppDelegate.h
161
+ - test/SampleApp/SampleApp/AppDelegate.m
162
+ - test/SampleApp/SampleApp/Info.plist
163
+ - test/SampleApp/SampleApp/main.m
148
164
  - test/simctl/command/crud_test.rb
149
165
  - test/simctl/command/list_test.rb
150
166
  - test/test_helper.rb