snapshot 0.3.3 → 0.4.0
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/LICENSE +1 -1
- data/README.md +56 -22
- data/bin/snapshot +11 -11
- data/lib/snapshot/builder.rb +2 -4
- data/lib/snapshot/helper.rb +4 -0
- data/lib/snapshot/runner.rb +1 -36
- data/lib/snapshot/snapfile_creator.rb +3 -1
- data/lib/snapshot/snapshot_config.rb +14 -4
- data/lib/snapshot/snapshot_file.rb +2 -1
- data/lib/snapshot/update_checker.rb +1 -1
- data/lib/snapshot/version.rb +1 -1
- data/lib/snapshot.rb +4 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e60a5446d5764cc0d02230645802b5aaae8ccf25
|
4
|
+
data.tar.gz: 9724d4807becb6ada750263d8db89c59b91ca44e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2c0bfd23a066f1923377b974635cb00df298b98cd6f9c728cba0d49f34e8d2c86904fac666448ba7346ef488708065eed2bd49343be3e9cf6b7af3eb9b35de8
|
7
|
+
data.tar.gz: e8bf9580d239021c10392b9e24408b5bce3923dfe2d396b763b7ab974fdbe77c58e33be0e320d8b211d3b6689f89c56b306074873a4ca6ee1e55661718d2153e
|
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
+
<h3 align="center">
|
2
|
+
<a href="https://github.com/KrauseFx/fastlane">
|
3
|
+
<img src="assets/fastlane.png" width="150" />
|
4
|
+
<br />
|
5
|
+
fastlane
|
6
|
+
</a>
|
7
|
+
</h3>
|
1
8
|
<p align="center">
|
2
|
-
<a href="https://github.com/KrauseFx/deliver">
|
3
|
-
<b>
|
4
|
-
<a href="https://github.com/KrauseFx/frameit">
|
5
|
-
<a href="https://github.com/KrauseFx/PEM">PEM</a> •
|
6
|
-
<a href="https://github.com/KrauseFx/sigh">
|
9
|
+
<a href="https://github.com/KrauseFx/deliver">deliver</a> •
|
10
|
+
<b>snapshot</b> •
|
11
|
+
<a href="https://github.com/KrauseFx/frameit">frameit</a> •
|
12
|
+
<a href="https://github.com/KrauseFx/PEM">PEM</a> •
|
13
|
+
<a href="https://github.com/KrauseFx/sigh">sigh</a>
|
7
14
|
</p>
|
8
15
|
-------
|
9
16
|
|
@@ -11,13 +18,14 @@
|
|
11
18
|
<img src="assets/snapshot.png">
|
12
19
|
</p>
|
13
20
|
|
14
|
-
|
21
|
+
snapshot
|
15
22
|
============
|
16
23
|
|
17
24
|
[](https://twitter.com/KrauseFx)
|
18
25
|
[](https://github.com/KrauseFx/snapshot/blob/master/LICENSE)
|
19
26
|
[](http://rubygems.org/gems/snapshot)
|
20
27
|
|
28
|
+
###### Automate taking localized screenshots of your iOS app on every device
|
21
29
|
|
22
30
|
You have an iPhone app. You support 20 languages. You updated the design. You want to release the update to the App Store.
|
23
31
|
What's missing?
|
@@ -38,7 +46,7 @@ It's hard to get everything right!
|
|
38
46
|
|
39
47
|
This gem solves all those problems. It will run completely in the background - you can do something else, while your computer takes the screenshots for you.
|
40
48
|
|
41
|
-
|
49
|
+
Get in contact with the developer on Twitter: [@KrauseFx](https://twitter.com/KrauseFx)
|
42
50
|
|
43
51
|
|
44
52
|
-------
|
@@ -54,17 +62,22 @@ Follow the developer on Twitter: [@KrauseFx](https://twitter.com/KrauseFx)
|
|
54
62
|
|
55
63
|
-------
|
56
64
|
|
65
|
+
<h5 align="center"><code>snapshot</code> is part of <a href="http://fastlane.tools">fastlane</a>: connect all deployment tools into one streamlined workflow.</h5>
|
66
|
+
|
67
|
+
|
57
68
|
|
58
69
|
# Features
|
59
70
|
- Create hundreds of screenshots in multiple languages on all simulators
|
60
71
|
- Configure it once, store the configuration in git
|
61
72
|
- Do something else, while the computer takes the screenshots for you
|
62
|
-
-
|
73
|
+
- Integrated with [`fastlane`](http://fastlane.tools) and [`deliver`](https://github.com/KrauseFx/deliver)
|
63
74
|
- Generates a beautiful web page, which shows all screenshots on all devices. This is perfect to send to Q&A or the marketing team
|
64
|
-
- ```
|
75
|
+
- ```snapshot``` automatically waits for network requests to be finished before taking a screenshot (we don't want loading images in the App Store screenshots)
|
76
|
+
|
77
|
+
After ```snapshot``` successfully created new screenshots, it will generate a beautiful html file to get a quick overview of all screens:
|
65
78
|
|
66
|
-
|
67
|
-

|
68
81
|
|
69
82
|
## Why?
|
70
83
|
This gem automatically switches the language and device type and runs the automation script to take all screenshots.
|
@@ -81,7 +94,7 @@ This gem automatically switches the language and device type and runs the automa
|
|
81
94
|
I've been using many other solutions out there. Unfortunately none of them were perfect. The biggest issue was random timeouts of ```Instruments``` when starting the script. This problem is solved with ```snapshot```
|
82
95
|
|
83
96
|
- **UI Automation in Instruments**: Instruments can only run your app on one device in one language. You have to manually switch it.
|
84
|
-
- **[ui-screen-shooter](https://github.com/jonathanpenn/ui-screen-shooter)**: This is the best alternative out there right now. It's based on AppleScript, you can not update it properly and there are quite some hacks in there. ```
|
97
|
+
- **[ui-screen-shooter](https://github.com/jonathanpenn/ui-screen-shooter)**: This is the best alternative out there right now. It's based on AppleScript, you can not update it properly and there are quite some hacks in there. ```snapshot``` uses a very similar technique - just in a clean and maintainable Ruby gem.
|
85
98
|
- **[Subliminal](https://github.com/inkling/Subliminal)**: A good approach to write the interaction code in Objective C. Unfortunately it has a lot of open issues with the latest release of Xcode. Also, it requires modifications of your Xcode project and schemes, which might break some other things.
|
86
99
|
|
87
100
|
# Installation
|
@@ -129,12 +142,21 @@ From now on, you can run ```snapshot``` to create new screenshots of your app.
|
|
129
142
|
|
130
143
|
# Usage
|
131
144
|
|
132
|
-
|
145
|
+
```
|
146
|
+
snapshot
|
147
|
+
```
|
133
148
|
|
134
|
-
|
149
|
+
To skip cleaning the project:
|
150
|
+
```
|
151
|
+
snapshot --noclean
|
152
|
+
```
|
135
153
|
|
136
154
|
## Snapfile
|
137
155
|
|
156
|
+
#### Why should you have to remember complicated commands and parameters?
|
157
|
+
|
158
|
+
Store your configuration in a text file to easily take screenshots from any computer.
|
159
|
+
|
138
160
|
Create a file called ```Snapfile``` in your project directory.
|
139
161
|
Once you created your configuration, just run ```snapshot```.
|
140
162
|
|
@@ -237,12 +259,24 @@ In case you want to skip this process, just add ```skip_alpha_removal``` to your
|
|
237
259
|
|
238
260
|
# Tips
|
239
261
|
|
240
|
-
##
|
241
|
-
|
242
|
-
- [
|
243
|
-
- [
|
244
|
-
- [
|
245
|
-
- [
|
262
|
+
## [`fastlane`](http://fastlane.tools) Toolchain
|
263
|
+
|
264
|
+
- [`fastlane`](http://fastlane.tools): Connect all deployment tools into one streamlined workflow
|
265
|
+
- [`deliver`](https://github.com/KrauseFx/deliver): Upload screenshots, metadata and your app to the App Store using a single command
|
266
|
+
- [`frameit`](https://github.com/KrauseFx/frameit): Quickly put your screenshots into the right device frames
|
267
|
+
- [`PEM`](https://github.com/KrauseFx/pem): Automatically generate and renew your push notification profiles
|
268
|
+
- [`sigh`](https://github.com/KrauseFx/sigh): Because you would rather spend your time building stuff than fighting provisioning
|
269
|
+
|
270
|
+
## Run in Continuous Integration
|
271
|
+
If you want to run `snapshot` on your `Jenkins` machine (or any other CI-system), you might run into an `authorization` popup coming up.
|
272
|
+
|
273
|
+
You can disable this dialog, running the following command:
|
274
|
+
```
|
275
|
+
security authorizationdb read system.privilege.taskport > /tmp/system.privilege.taskport.plist
|
276
|
+
/usr/libexec/PlistBuddy -c "Set :allow-root true" /tmp/system.privilege.taskport.plist
|
277
|
+
sudo security authorizationdb write system.privilege.taskport < /tmp/system.privilege.taskport.plist
|
278
|
+
```
|
279
|
+
I found this solution in the [`Subliminal` wiki](https://github.com/inkling/Subliminal/wiki/Continuous-Integration#faq).
|
246
280
|
|
247
281
|
## Specify a custom ```Snapfile```
|
248
282
|
|
@@ -267,8 +301,8 @@ Unfortunately ```Instruments``` sometimes decides, to not respond to anything. W
|
|
267
301
|
The only way to fix this, is a restart of the Mac.
|
268
302
|
|
269
303
|
# Need help?
|
270
|
-
- If there is a technical problem with ```
|
271
|
-
- I'm available for contract work - drop me an email: snapshot@
|
304
|
+
- If there is a technical problem with ```snapshot```, submit an issue. Run ```snapshot --trace``` to get the stacktrace.
|
305
|
+
- I'm available for contract work - drop me an email: snapshot@krausefx.com
|
272
306
|
|
273
307
|
# License
|
274
308
|
This project is licensed under the terms of the MIT license. See the LICENSE file.
|
data/bin/snapshot
CHANGED
@@ -4,8 +4,6 @@ $:.push File.expand_path("../../lib", __FILE__)
|
|
4
4
|
|
5
5
|
require 'snapshot'
|
6
6
|
require 'commander/import'
|
7
|
-
require 'snapshot/update_checker'
|
8
|
-
require 'snapshot/dependency_checker'
|
9
7
|
require 'snapshot/snapfile_creator'
|
10
8
|
require 'snapshot/snapshot_config'
|
11
9
|
|
@@ -14,17 +12,15 @@ HighLine.track_eof = false
|
|
14
12
|
|
15
13
|
# Commander
|
16
14
|
program :version, Snapshot::VERSION
|
17
|
-
program :description, 'CLI for \'Snapshot\' -
|
18
|
-
program :help, 'Author', 'Felix Krause <krausefx
|
19
|
-
program :help, 'Website', 'http://
|
15
|
+
program :description, 'CLI for \'Snapshot\' - Automate taking localized screenshots of your iOS app on every device'
|
16
|
+
program :help, 'Author', 'Felix Krause <snapshot@krausefx.com>'
|
17
|
+
program :help, 'Website', 'http://fastlane.tools'
|
20
18
|
program :help, 'GitHub', 'https://github.com/krausefx/snapshot'
|
21
19
|
program :help_formatter, :compact
|
22
20
|
|
23
21
|
global_option('--verbose') { $verbose = true }
|
24
22
|
|
25
23
|
|
26
|
-
Snapshot::UpdateChecker.verify_latest_version
|
27
|
-
|
28
24
|
default_command :run
|
29
25
|
|
30
26
|
command :run do |c|
|
@@ -34,8 +30,11 @@ command :run do |c|
|
|
34
30
|
c.option '--noclean', 'Skips the clean process when running snapshot.'
|
35
31
|
|
36
32
|
c.action do |args, options|
|
37
|
-
Snapshot::
|
38
|
-
|
33
|
+
path = (Snapshot::Helper.fastlane_enabled?? './fastlane' : '.')
|
34
|
+
Dir.chdir(path) do # switch the context
|
35
|
+
Snapshot::SnapshotConfig.shared_instance(options.snapfile)
|
36
|
+
Snapshot::Runner.new.work(clean: !options.noclean)
|
37
|
+
end
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
@@ -44,6 +43,7 @@ command :init do |c|
|
|
44
43
|
c.description = "Creates a new Snapfile in the current directory"
|
45
44
|
|
46
45
|
c.action do |args, options|
|
47
|
-
Snapshot::
|
46
|
+
path = (Snapshot::Helper.fastlane_enabled?? './fastlane' : '.')
|
47
|
+
Snapshot::SnapfileCreator.create(path)
|
48
48
|
end
|
49
|
-
end
|
49
|
+
end
|
data/lib/snapshot/builder.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'snapshot/dependency_checker'
|
2
|
-
|
3
1
|
module Snapshot
|
4
2
|
class Builder
|
5
3
|
BUILD_DIR = '/tmp/snapshot'
|
@@ -16,7 +14,7 @@ module Snapshot
|
|
16
14
|
|
17
15
|
if not command
|
18
16
|
# That's the default case, user did not provide a custom build_command
|
19
|
-
raise "Could not find project. Please pass the path to your project using 'project_path'.".red unless SnapshotConfig.shared_instance.
|
17
|
+
raise "Could not find project. Please pass the path to your project using 'project_path'.".red unless SnapshotConfig.shared_instance.project_path
|
20
18
|
command = generate_build_command(clean: clean)
|
21
19
|
end
|
22
20
|
|
@@ -30,7 +28,7 @@ module Snapshot
|
|
30
28
|
all_lines << line
|
31
29
|
begin
|
32
30
|
parse_build_line(line) if line.length > 2
|
33
|
-
rescue
|
31
|
+
rescue => ex
|
34
32
|
Helper.log.fatal all_lines.join("\n")
|
35
33
|
raise ex
|
36
34
|
end
|
data/lib/snapshot/helper.rb
CHANGED
data/lib/snapshot/runner.rb
CHANGED
@@ -4,10 +4,6 @@ module Snapshot
|
|
4
4
|
class Runner
|
5
5
|
TRACE_DIR = '/tmp/snapshot_traces'
|
6
6
|
|
7
|
-
def initialize
|
8
|
-
Snapshot::DependencyChecker.check_dependencies
|
9
|
-
end
|
10
|
-
|
11
7
|
def work(clean: true)
|
12
8
|
SnapshotConfig.shared_instance.js_file # to verify the file can be found
|
13
9
|
|
@@ -22,17 +18,12 @@ module Snapshot
|
|
22
18
|
SnapshotConfig.shared_instance.blocks[:setup_for_device_change].call(device) # Callback
|
23
19
|
|
24
20
|
SnapshotConfig.shared_instance.languages.each do |language|
|
25
|
-
|
26
|
-
# uninstall_app(device)
|
27
|
-
|
28
21
|
SnapshotConfig.shared_instance.blocks[:setup_for_language_change].call(language, device) # Callback
|
29
22
|
|
30
23
|
begin
|
31
24
|
errors.concat(run_tests(device, language))
|
32
25
|
counter += copy_screenshots(language)
|
33
|
-
rescue
|
34
|
-
raise ex # system interrupted exception (ctrl + C)
|
35
|
-
rescue StandardError => ex
|
26
|
+
rescue => ex
|
36
27
|
Helper.log.error(ex)
|
37
28
|
end
|
38
29
|
SnapshotConfig.shared_instance.blocks[:teardown_language].call(language, device) # Callback
|
@@ -102,32 +93,6 @@ module Snapshot
|
|
102
93
|
return errors
|
103
94
|
end
|
104
95
|
|
105
|
-
# def uninstall_app(device)
|
106
|
-
# def com(str)
|
107
|
-
# puts str.yellow
|
108
|
-
# puts `#{str}`
|
109
|
-
# sleep 1.0
|
110
|
-
# end
|
111
|
-
|
112
|
-
# def find_simulator(name)
|
113
|
-
# all = `instruments -s`.split("\n")
|
114
|
-
# all.each do |current|
|
115
|
-
# return current.match(/\[(.*)\]/)[1] if current.include?name
|
116
|
-
# end
|
117
|
-
# raise "Could not find simulator '#{name}' to install the app on."
|
118
|
-
# end
|
119
|
-
|
120
|
-
# udid = find_simulator(device)
|
121
|
-
# com("killall 'iOS Simulator'")
|
122
|
-
# com("xcrun simctl boot '#{udid}'")
|
123
|
-
# com("xcrun simctl uninstall '#{udid}' 'net.sunapps.123'") # TODO: Dynamic
|
124
|
-
# sleep 3
|
125
|
-
# com("xcrun simctl install '#{udid}' '#{@app_path}'")
|
126
|
-
# com("xcrun simctl shutdown '#{udid}'")
|
127
|
-
# sleep 1
|
128
|
-
# com("killall 'iOS Simulator'")
|
129
|
-
# end
|
130
|
-
|
131
96
|
def parse_test_line(line)
|
132
97
|
if line =~ /.*Target failed to run.*/
|
133
98
|
return :retry
|
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'snapshot/helper'
|
2
|
+
|
1
3
|
module Snapshot
|
2
4
|
class SnapfileCreator
|
3
5
|
# This method will take care of creating a Snapfile
|
4
6
|
def self.create(path)
|
5
|
-
snapfile_path =
|
7
|
+
snapfile_path = File.join(path, 'Snapfile')
|
6
8
|
|
7
9
|
raise "Snapfile already exists at path '#{snapfile_path}'. Run 'snapshot' to use Snapshot.".red if File.exists?(snapfile_path)
|
8
10
|
|
@@ -77,8 +77,14 @@ module Snapshot
|
|
77
77
|
|
78
78
|
self.screenshots_path = './screenshots'
|
79
79
|
|
80
|
-
|
81
|
-
|
80
|
+
folders = ["./*.xcworkspace"] # we prefer workspaces
|
81
|
+
folders << "./*.xcodeproj"
|
82
|
+
folders << "../*.xcworkspace"
|
83
|
+
folders << "../*.xcodeproj"
|
84
|
+
|
85
|
+
folders.each do |current|
|
86
|
+
self.project_path ||= (File.expand_path(Dir[current].first) rescue nil)
|
87
|
+
end
|
82
88
|
|
83
89
|
empty = Proc.new {}
|
84
90
|
self.blocks = {
|
@@ -117,7 +123,11 @@ module Snapshot
|
|
117
123
|
# The scheme to use (either it's set, or there is only one, or user has to enter it)
|
118
124
|
def scheme
|
119
125
|
begin
|
120
|
-
|
126
|
+
project_key = 'project'
|
127
|
+
project_key = 'workspace' if project_path.end_with?'.xcworkspace'
|
128
|
+
command = "xcodebuild -#{project_key} '#{project_path}' -list"
|
129
|
+
Helper.log.debug command
|
130
|
+
|
121
131
|
schemes = `#{command}`.split("Schemes:").last.split("\n").each { |a| a.strip! }.delete_if { |a| a == '' }
|
122
132
|
Helper.log.debug "Found available schemes: #{schemes}"
|
123
133
|
|
@@ -145,7 +155,7 @@ module Snapshot
|
|
145
155
|
end
|
146
156
|
return self.manual_scheme
|
147
157
|
end
|
148
|
-
rescue
|
158
|
+
rescue => ex
|
149
159
|
raise "Could not fetch available schemes: #{ex}".red
|
150
160
|
end
|
151
161
|
end
|
@@ -54,7 +54,8 @@ module Snapshot
|
|
54
54
|
else
|
55
55
|
raise "The given project_path '#{path}' could not be found. Make sure to include the extension as well.".red
|
56
56
|
end
|
57
|
-
|
57
|
+
when :html_path
|
58
|
+
raise "The `html_path` options was removed from snapshot. The default location is now the screenshots path. Please remove this line from your 'Snapfile'.".red
|
58
59
|
# Blocks
|
59
60
|
when :setup_for_device_change, :teardown_device, :setup_for_language_change, :teardown_language
|
60
61
|
raise "#{method_sym} needs to have a block provided." unless block_given?
|
data/lib/snapshot/version.rb
CHANGED
data/lib/snapshot.rb
CHANGED
@@ -8,10 +8,13 @@ require 'snapshot/snapshot_file'
|
|
8
8
|
require 'snapshot/reports_generator'
|
9
9
|
require 'snapshot/screenshot_flatten'
|
10
10
|
require 'snapshot/simulators'
|
11
|
+
require 'snapshot/update_checker'
|
12
|
+
require 'snapshot/dependency_checker'
|
11
13
|
|
12
14
|
# Third Party code
|
13
15
|
require 'colored'
|
14
16
|
|
15
17
|
module Snapshot
|
16
|
-
|
18
|
+
Snapshot::UpdateChecker.verify_latest_version
|
19
|
+
Snapshot::DependencyChecker.check_dependencies
|
17
20
|
end
|
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: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Felix Krause
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -164,9 +164,9 @@ dependencies:
|
|
164
164
|
- - '>='
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
description:
|
167
|
+
description: Automate taking localized screenshots of your iOS app on every device
|
168
168
|
email:
|
169
|
-
- krausefx
|
169
|
+
- snapshot@krausefx.com
|
170
170
|
executables:
|
171
171
|
- snapshot
|
172
172
|
extensions: []
|
@@ -192,7 +192,7 @@ files:
|
|
192
192
|
- lib/snapshot/snapshot_file.rb
|
193
193
|
- lib/snapshot/update_checker.rb
|
194
194
|
- lib/snapshot/version.rb
|
195
|
-
homepage: http://
|
195
|
+
homepage: http://fastlane.tools
|
196
196
|
licenses:
|
197
197
|
- MIT
|
198
198
|
metadata: {}
|
@@ -215,6 +215,6 @@ rubyforge_project:
|
|
215
215
|
rubygems_version: 2.2.2
|
216
216
|
signing_key:
|
217
217
|
specification_version: 4
|
218
|
-
summary:
|
218
|
+
summary: Automate taking localized screenshots of your iOS app on every device
|
219
219
|
test_files: []
|
220
220
|
has_rdoc:
|