snapshot 1.12.2 → 1.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/snapshot +2 -109
- data/lib/snapshot/commands_generator.rb +110 -0
- data/lib/snapshot/reset_simulators.rb +22 -12
- data/lib/snapshot/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a2f6706dde254c8ec5cf7470a1539cb7cbdc83f
|
4
|
+
data.tar.gz: 41ed453012760f5795b1f54262d286d1e3e38271
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8f5d96bed914afa3ce3c54ea5afac1b6f16ebf3ca7657804721495b735fb7f4eee8ad7b105ed69ddcfb875fc7bfb82f7212b39f23643908297b0e070713b5bdc
|
7
|
+
data.tar.gz: 434a2585a607f638397bcb422e3601e26425e8448e5004933c13b46e0ded3726a025ca5bccfa876cd13448f7a85f0c2deece84b694ce8f1ce7c30a9c18f44315
|
data/bin/snapshot
CHANGED
@@ -1,113 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
-
|
3
2
|
$:.push File.expand_path("../../lib", __FILE__)
|
4
3
|
|
5
4
|
require 'snapshot'
|
6
|
-
require '
|
7
|
-
|
8
|
-
HighLine.track_eof = false
|
9
|
-
|
10
|
-
class SnapshotApplication
|
11
|
-
include Commander::Methods
|
12
|
-
|
13
|
-
# rubocop:disable Metrics/MethodLength
|
14
|
-
def run
|
15
|
-
program :version, Snapshot::VERSION
|
16
|
-
program :description, 'CLI for \'snapshot\' - Automate taking localized screenshots of your iOS app on every device'
|
17
|
-
program :help, 'Author', 'Felix Krause <snapshot@krausefx.com>'
|
18
|
-
program :help, 'Website', 'https://fastlane.tools'
|
19
|
-
program :help, 'GitHub', 'https://github.com/fastlane/snapshot'
|
20
|
-
program :help_formatter, :compact
|
21
|
-
|
22
|
-
global_option('--verbose', 'Shows a more verbose output') { $verbose = true }
|
23
|
-
|
24
|
-
always_trace!
|
25
|
-
|
26
|
-
FastlaneCore::CommanderGenerator.new.generate(Snapshot::Options.available_options)
|
27
|
-
|
28
|
-
command :run do |c|
|
29
|
-
c.syntax = 'snapshot'
|
30
|
-
c.description = 'Take new screenshots based on the Snapfile.'
|
31
|
-
|
32
|
-
c.action do |args, options|
|
33
|
-
load_config(options)
|
34
|
-
|
35
|
-
Snapshot::DependencyChecker.check_simulators
|
36
|
-
Snapshot::Runner.new.work
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
command :init do |c|
|
41
|
-
c.syntax = 'snapshot init'
|
42
|
-
c.description = "Creates a new Snapfile in the current directory"
|
43
|
-
|
44
|
-
c.action do |args, options|
|
45
|
-
require 'snapshot/setup'
|
46
|
-
path = (Snapshot::Helper.fastlane_enabled? ? './fastlane' : '.')
|
47
|
-
Snapshot::Setup.create(path)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
command :update do |c|
|
52
|
-
c.syntax = 'snapshot update'
|
53
|
-
c.description = "Updates your SnapshotHelper.swift to the latest version"
|
54
|
-
|
55
|
-
c.action do |args, options|
|
56
|
-
require 'snapshot/update'
|
57
|
-
Snapshot::Update.new.update
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
command :reset_simulators do |c|
|
62
|
-
c.syntax = 'snapshot reset_simulators'
|
63
|
-
c.description = "This will remove all your existing simulators and re-create new ones"
|
64
|
-
c.option '-i', '--ios String', String, 'The comma separated list of iOS Versions you want to use'
|
65
|
-
|
66
|
-
c.action do |args, options|
|
67
|
-
options.default ios_version: Snapshot::LatestIosVersion.version
|
68
|
-
versions = options.ios_version.split(',') if options.ios_version
|
69
|
-
require 'snapshot/reset_simulators'
|
70
|
-
|
71
|
-
Snapshot::ResetSimulators.clear_everything!(versions)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
command :clear_derived_data do |c|
|
76
|
-
c.syntax = 'snapshot clear_derived_data -f path'
|
77
|
-
c.description = "Clear the directory where build products and other derived data will go"
|
78
|
-
|
79
|
-
c.action do |args, options|
|
80
|
-
load_config(options)
|
81
|
-
derived_data_path = Snapshot.config[:derived_data_path]
|
82
|
-
|
83
|
-
if !derived_data_path
|
84
|
-
Snapshot::UI.user_error! "No derived_data_path"
|
85
|
-
elsif !Dir.exist?(derived_data_path)
|
86
|
-
Snapshot::UI.important "Path #{derived_data_path} does not exist"
|
87
|
-
else
|
88
|
-
FileUtils.rm_rf(derived_data_path)
|
89
|
-
Snapshot::UI.success "Removed #{derived_data_path}"
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
default_command :run
|
95
|
-
|
96
|
-
run!
|
97
|
-
end
|
98
|
-
|
99
|
-
private
|
100
|
-
|
101
|
-
def load_config(options)
|
102
|
-
o = options.__hash__.dup
|
103
|
-
o.delete(:verbose)
|
104
|
-
Snapshot.config = FastlaneCore::Configuration.create(Snapshot::Options.available_options, o)
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
begin
|
109
|
-
FastlaneCore::UpdateChecker.start_looking_for_update('snapshot')
|
110
|
-
SnapshotApplication.new.run
|
111
|
-
ensure
|
112
|
-
FastlaneCore::UpdateChecker.show_update_status('snapshot', Snapshot::VERSION)
|
113
|
-
end
|
5
|
+
require 'snapshot/commands_generator'
|
6
|
+
Snapshot::CommandsGenerator.start
|
@@ -0,0 +1,110 @@
|
|
1
|
+
require 'commander'
|
2
|
+
|
3
|
+
HighLine.track_eof = false
|
4
|
+
|
5
|
+
module Snapshot
|
6
|
+
class CommandsGenerator
|
7
|
+
include Commander::Methods
|
8
|
+
|
9
|
+
def self.start
|
10
|
+
FastlaneCore::UpdateChecker.start_looking_for_update('snapshot')
|
11
|
+
self.new.run
|
12
|
+
ensure
|
13
|
+
FastlaneCore::UpdateChecker.show_update_status('snapshot', Snapshot::VERSION)
|
14
|
+
end
|
15
|
+
|
16
|
+
# rubocop:disable Metrics/MethodLength
|
17
|
+
def run
|
18
|
+
program :version, Snapshot::VERSION
|
19
|
+
program :description, 'CLI for \'snapshot\' - Automate taking localized screenshots of your iOS app on every device'
|
20
|
+
program :help, 'Author', 'Felix Krause <snapshot@krausefx.com>'
|
21
|
+
program :help, 'Website', 'https://fastlane.tools'
|
22
|
+
program :help, 'GitHub', 'https://github.com/fastlane/snapshot'
|
23
|
+
program :help_formatter, :compact
|
24
|
+
|
25
|
+
global_option('--verbose', 'Shows a more verbose output') { $verbose = true }
|
26
|
+
|
27
|
+
always_trace!
|
28
|
+
|
29
|
+
FastlaneCore::CommanderGenerator.new.generate(Snapshot::Options.available_options)
|
30
|
+
|
31
|
+
command :run do |c|
|
32
|
+
c.syntax = 'snapshot'
|
33
|
+
c.description = 'Take new screenshots based on the Snapfile.'
|
34
|
+
|
35
|
+
c.action do |args, options|
|
36
|
+
load_config(options)
|
37
|
+
|
38
|
+
Snapshot::DependencyChecker.check_simulators
|
39
|
+
Snapshot::Runner.new.work
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
command :init do |c|
|
44
|
+
c.syntax = 'snapshot init'
|
45
|
+
c.description = "Creates a new Snapfile in the current directory"
|
46
|
+
|
47
|
+
c.action do |args, options|
|
48
|
+
require 'snapshot/setup'
|
49
|
+
path = (Snapshot::Helper.fastlane_enabled? ? './fastlane' : '.')
|
50
|
+
Snapshot::Setup.create(path)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
command :update do |c|
|
55
|
+
c.syntax = 'snapshot update'
|
56
|
+
c.description = "Updates your SnapshotHelper.swift to the latest version"
|
57
|
+
|
58
|
+
c.action do |args, options|
|
59
|
+
require 'snapshot/update'
|
60
|
+
Snapshot::Update.new.update
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
command :reset_simulators do |c|
|
65
|
+
c.syntax = 'snapshot reset_simulators'
|
66
|
+
c.description = "This will remove all your existing simulators and re-create new ones"
|
67
|
+
c.option '-i', '--ios String', String, 'The comma separated list of iOS Versions you want to use'
|
68
|
+
|
69
|
+
c.action do |args, options|
|
70
|
+
options.default ios_version: Snapshot::LatestIosVersion.version
|
71
|
+
versions = options.ios_version.split(',') if options.ios_version
|
72
|
+
require 'snapshot/reset_simulators'
|
73
|
+
|
74
|
+
Snapshot::ResetSimulators.clear_everything!(versions)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
command :clear_derived_data do |c|
|
79
|
+
c.syntax = 'snapshot clear_derived_data -f path'
|
80
|
+
c.description = "Clear the directory where build products and other derived data will go"
|
81
|
+
|
82
|
+
c.action do |args, options|
|
83
|
+
load_config(options)
|
84
|
+
derived_data_path = Snapshot.config[:derived_data_path]
|
85
|
+
|
86
|
+
if !derived_data_path
|
87
|
+
Snapshot::UI.user_error! "No derived_data_path"
|
88
|
+
elsif !Dir.exist?(derived_data_path)
|
89
|
+
Snapshot::UI.important "Path #{derived_data_path} does not exist"
|
90
|
+
else
|
91
|
+
FileUtils.rm_rf(derived_data_path)
|
92
|
+
Snapshot::UI.success "Removed #{derived_data_path}"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
default_command :run
|
98
|
+
|
99
|
+
run!
|
100
|
+
end
|
101
|
+
|
102
|
+
private
|
103
|
+
|
104
|
+
def load_config(options)
|
105
|
+
o = options.__hash__.dup
|
106
|
+
o.delete(:verbose)
|
107
|
+
Snapshot.config = FastlaneCore::Configuration.create(Snapshot::Options.available_options, o)
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|
@@ -35,16 +35,7 @@ module Snapshot
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
-
|
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}`
|
38
|
+
make_phone_watch_pair
|
48
39
|
end
|
49
40
|
|
50
41
|
def self.create(device_type, os_versions, os_name = 'iOS')
|
@@ -59,7 +50,7 @@ module Snapshot
|
|
59
50
|
end
|
60
51
|
|
61
52
|
def self.devices
|
62
|
-
all_devices =
|
53
|
+
all_devices = Helper.backticks('xcrun simctl list devices', print: $verbose)
|
63
54
|
# == Devices ==
|
64
55
|
# -- iOS 9.0 --
|
65
56
|
# iPhone 4s (32246EBC-33B0-47F9-B7BB-5C23C550DF29) (Shutdown)
|
@@ -69,10 +60,29 @@ module Snapshot
|
|
69
60
|
# iPhone 4s (FE9D6F85-1C51-4FE6-8597-FCAB5286B869) (Shutdown) (unavailable, runtime profile not found)
|
70
61
|
|
71
62
|
result = all_devices.lines.map do |line|
|
72
|
-
(line.match(/\s+(
|
63
|
+
(line.match(/\s+(.+?)\s\(([\w\-]+)\).*/) || []).to_a
|
73
64
|
end
|
74
65
|
|
75
66
|
result.select { |parsed| parsed.length == 3 } # we don't care about those headers
|
76
67
|
end
|
68
|
+
|
69
|
+
def self.make_phone_watch_pair
|
70
|
+
phones = []
|
71
|
+
watches = []
|
72
|
+
devices.each do |device|
|
73
|
+
full_line, name, id = device
|
74
|
+
phones << id if name.start_with?('iPhone 6') && device_line_usable?(full_line)
|
75
|
+
watches << id if name.end_with?('mm') && device_line_usable?(full_line)
|
76
|
+
end
|
77
|
+
|
78
|
+
if phones.any? && watches.any?
|
79
|
+
puts "Creating device pair of #{phones.last} and #{watches.last}"
|
80
|
+
Helper.backticks("xcrun simctl pair #{watches.last} #{phones.last}", print: $verbose)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.device_line_usable?(line)
|
85
|
+
!line.include?("unavailable")
|
86
|
+
end
|
77
87
|
end
|
78
88
|
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.12.
|
4
|
+
version: 1.12.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fastimage
|
@@ -227,6 +227,7 @@ files:
|
|
227
227
|
- lib/assets/SnapshotHelper.swift
|
228
228
|
- lib/snapshot.rb
|
229
229
|
- lib/snapshot/collector.rb
|
230
|
+
- lib/snapshot/commands_generator.rb
|
230
231
|
- lib/snapshot/dependency_checker.rb
|
231
232
|
- lib/snapshot/detect_values.rb
|
232
233
|
- lib/snapshot/error_handler.rb
|