snapshot 1.4.1 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -1
- data/lib/assets/SnapshotHelper.swift +15 -11
- data/lib/snapshot/reset_simulators.rb +51 -19
- data/lib/snapshot/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96f6aa6d5034a51c6bd41f7c1ba31796b19daa55
|
4
|
+
data.tar.gz: 2ffaec44d9ca48065f8dada8142b8f324740be5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a06cc5ff23182185afa183e4928fb4b0b041ec4943157e21424cbc69d40b92a8fbce0e7c23d97d5c07d1c37c9c72ac242949892619a71d6527e7552d3f1fa02c
|
7
|
+
data.tar.gz: 777220ead255052ff6d08eb231d0efdbefaf8d0dbd8b041bee9b4425128ccf49224279e72ce5db86866f95130f5e3ce4c0f2ec8cb159612a02e812ae7381f7e4
|
data/README.md
CHANGED
@@ -17,7 +17,8 @@
|
|
17
17
|
<a href="https://github.com/fastlane/pilot">pilot</a> •
|
18
18
|
<a href="https://github.com/fastlane/boarding">boarding</a> •
|
19
19
|
<a href="https://github.com/fastlane/gym">gym</a> •
|
20
|
-
<a href="https://github.com/fastlane/scan">scan</a>
|
20
|
+
<a href="https://github.com/fastlane/scan">scan</a> •
|
21
|
+
<a href="https://github.com/fastlane/match">match</a>
|
21
22
|
</p>
|
22
23
|
-------
|
23
24
|
|
@@ -333,6 +334,7 @@ Also, feel free to duplicate radar [23062925](https://openradar.appspot.com/rada
|
|
333
334
|
- [`boarding`](https://github.com/fastlane/boarding): The easiest way to invite your TestFlight beta testers
|
334
335
|
- [`gym`](https://github.com/fastlane/gym): Building your iOS apps has never been easier
|
335
336
|
- [`scan`](https://github.com/fastlane/scan): The easiest way to run tests of your iOS and Mac app
|
337
|
+
- [`match`](https://github.com/fastlane/match): Easily sync your certificates and profiles across your team using git
|
336
338
|
|
337
339
|
##### [Like this tool? Be the first to know about updates and new fastlane tools](https://tinyletter.com/krausefx)
|
338
340
|
|
@@ -17,8 +17,7 @@ func setLanguage(app: XCUIApplication) {
|
|
17
17
|
}
|
18
18
|
|
19
19
|
func setupSnapshot(app: XCUIApplication) {
|
20
|
-
Snapshot.
|
21
|
-
Snapshot.setLaunchArguments(app)
|
20
|
+
Snapshot.setupSnapshot(app)
|
22
21
|
}
|
23
22
|
|
24
23
|
func snapshot(name: String, waitForLoadingIndicator: Bool = false) {
|
@@ -26,10 +25,15 @@ func snapshot(name: String, waitForLoadingIndicator: Bool = false) {
|
|
26
25
|
}
|
27
26
|
|
28
27
|
class Snapshot: NSObject {
|
29
|
-
|
28
|
+
|
29
|
+
class func setupSnapshot(app: XCUIApplication) {
|
30
|
+
setLanguage(app)
|
31
|
+
setLaunchArguments(app)
|
32
|
+
}
|
33
|
+
|
30
34
|
class func setLanguage(app: XCUIApplication) {
|
31
35
|
let path = "/tmp/language.txt"
|
32
|
-
|
36
|
+
|
33
37
|
do {
|
34
38
|
let locale = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String
|
35
39
|
deviceLanguage = locale.substringToIndex(locale.startIndex.advancedBy(2, limit:locale.endIndex))
|
@@ -38,12 +42,12 @@ class Snapshot: NSObject {
|
|
38
42
|
print("Couldn't detect/set language...")
|
39
43
|
}
|
40
44
|
}
|
41
|
-
|
45
|
+
|
42
46
|
class func setLaunchArguments(app: XCUIApplication) {
|
43
47
|
let path = "/tmp/snapshot-launch_arguments.txt"
|
44
|
-
|
48
|
+
|
45
49
|
app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES"]
|
46
|
-
|
50
|
+
|
47
51
|
do {
|
48
52
|
let launchArguments = try NSString(contentsOfFile: path, encoding: NSUTF8StringEncoding) as String
|
49
53
|
let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: [])
|
@@ -56,18 +60,18 @@ class Snapshot: NSObject {
|
|
56
60
|
print("Couldn't detect/set launch_arguments...")
|
57
61
|
}
|
58
62
|
}
|
59
|
-
|
63
|
+
|
60
64
|
class func snapshot(name: String, waitForLoadingIndicator: Bool = false) {
|
61
65
|
if waitForLoadingIndicator {
|
62
66
|
waitForLoadingIndicatorToDisappear()
|
63
67
|
}
|
64
|
-
|
68
|
+
|
65
69
|
print("snapshot: \(name)") // more information about this, check out https://github.com/krausefx/snapshot
|
66
|
-
|
70
|
+
|
67
71
|
sleep(1) // Waiting for the animation to be finished (kind of)
|
68
72
|
XCUIDevice.sharedDevice().orientation = .Unknown
|
69
73
|
}
|
70
|
-
|
74
|
+
|
71
75
|
class func waitForLoadingIndicatorToDisappear() {
|
72
76
|
let query = XCUIApplication().statusBars.childrenMatchingType(.Other).elementBoundByIndex(1).childrenMatchingType(.Other)
|
73
77
|
|
@@ -9,23 +9,16 @@ module Snapshot
|
|
9
9
|
sure = agree("Are you sure? All your simulators will be DELETED and new ones will be created! (y/n)".red, true) unless sure
|
10
10
|
raise "User cancelled action" unless sure
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
# -- iOS 9.0 --
|
15
|
-
# iPhone 4s (32246EBC-33B0-47F9-B7BB-5C23C550DF29) (Shutdown)
|
16
|
-
# iPhone 5 (4B56C101-6B95-43D1-9485-3FBA0E127FFA) (Shutdown)
|
17
|
-
# iPhone 5s (6379C204-E82A-4FBD-8A22-6A01C7791D62) (Shutdown)
|
18
|
-
# -- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-4 --
|
19
|
-
# iPhone 4s (FE9D6F85-1C51-4FE6-8597-FCAB5286B869) (Shutdown) (unavailable, runtime profile not found)
|
20
|
-
|
21
|
-
all_devices.split("\n").each do |line|
|
22
|
-
parsed = line.match(/\s+([\w\s]+)\s\(([\w\-]+)\)/) || []
|
23
|
-
next unless parsed.length == 3 # we don't care about those headers
|
24
|
-
_, name, id = parsed.to_a
|
12
|
+
devices.each do |device|
|
13
|
+
_, name, id = device
|
25
14
|
puts "Removing device #{name} (#{id})"
|
26
15
|
`xcrun simctl delete #{id}`
|
27
16
|
end
|
28
17
|
|
18
|
+
all_runtimes = `xcrun simctl list runtimes`.lines.map { |s| s.slice(/(.*?) \(/, 1) }.compact
|
19
|
+
tv_versions = filter_runtimes(all_runtimes, 'tvOS')
|
20
|
+
watch_versions = filter_runtimes(all_runtimes, 'watchOS')
|
21
|
+
|
29
22
|
all_device_types = `xcrun simctl list devicetypes`.scan(/(.*)\s\((.*)\)/)
|
30
23
|
# == Device Types ==
|
31
24
|
# iPhone 4s (com.apple.CoreSimulator.SimDeviceType.iPhone-4s)
|
@@ -33,14 +26,53 @@ module Snapshot
|
|
33
26
|
# iPhone 5s (com.apple.CoreSimulator.SimDeviceType.iPhone-5s)
|
34
27
|
# iPhone 6 (com.apple.CoreSimulator.SimDeviceType.iPhone-6)
|
35
28
|
all_device_types.each do |device_type|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
29
|
+
if device_type.join(' ').include?("Watch")
|
30
|
+
create(device_type, watch_versions, 'watchOS')
|
31
|
+
elsif device_type.join(' ').include?("TV")
|
32
|
+
create(device_type, tv_versions, 'tvOS')
|
33
|
+
else
|
34
|
+
create(device_type, ios_versions)
|
42
35
|
end
|
43
36
|
end
|
37
|
+
|
38
|
+
phones = []
|
39
|
+
watches = []
|
40
|
+
devices.each do |device|
|
41
|
+
_, name, id = device
|
42
|
+
phones << id if name.start_with?('iPhone 6')
|
43
|
+
watches << id if name.end_with?('mm')
|
44
|
+
end
|
45
|
+
|
46
|
+
puts "Creating device pair of #{phones.last} and #{watches.last}"
|
47
|
+
`xcrun simctl pair #{watches.last} #{phones.last}`
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.create(device_type, os_versions, os_name = 'iOS')
|
51
|
+
os_versions.each do |os_version|
|
52
|
+
puts "Creating #{device_type} for #{os_name} version #{os_version}"
|
53
|
+
`xcrun simctl create '#{device_type[0]}' #{device_type[1]} #{os_version}`
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.filter_runtimes(all_runtimes, os = 'iOS')
|
58
|
+
all_runtimes.select { |r| r[/^#{os}/] }.map { |r| r.split(' ')[1] }
|
59
|
+
end
|
60
|
+
|
61
|
+
def self.devices
|
62
|
+
all_devices = `xcrun simctl list devices`
|
63
|
+
# == Devices ==
|
64
|
+
# -- iOS 9.0 --
|
65
|
+
# iPhone 4s (32246EBC-33B0-47F9-B7BB-5C23C550DF29) (Shutdown)
|
66
|
+
# iPhone 5 (4B56C101-6B95-43D1-9485-3FBA0E127FFA) (Shutdown)
|
67
|
+
# iPhone 5s (6379C204-E82A-4FBD-8A22-6A01C7791D62) (Shutdown)
|
68
|
+
# -- Unavailable: com.apple.CoreSimulator.SimRuntime.iOS-8-4 --
|
69
|
+
# iPhone 4s (FE9D6F85-1C51-4FE6-8597-FCAB5286B869) (Shutdown) (unavailable, runtime profile not found)
|
70
|
+
|
71
|
+
result = all_devices.lines.map do |line|
|
72
|
+
(line.match(/\s+([\w\s]+)\s\(([\w\-]+)\)/) || []).to_a
|
73
|
+
end
|
74
|
+
|
75
|
+
result.select { |parsed| parsed.length == 3 } # we don't care about those headers
|
44
76
|
end
|
45
77
|
end
|
46
78
|
end
|
data/lib/snapshot/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|