snapshot 0.3.3 → 0.4.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: 63d4849c32160441375a38343e1788f096de13b1
4
- data.tar.gz: 3aeddc0b99d47752887b6164fb5b6bc13d4bae9d
3
+ metadata.gz: e60a5446d5764cc0d02230645802b5aaae8ccf25
4
+ data.tar.gz: 9724d4807becb6ada750263d8db89c59b91ca44e
5
5
  SHA512:
6
- metadata.gz: 72791e5862dc34a5c23f357c4636519a3b7c180a1ed7ed038f20159bc6f29c2a683a490782a940b9bceece5bbd3ebfaa88f66f555d6e91921ccdf22feae2a88f
7
- data.tar.gz: 962e41980b306165d10e226ba8a4228dde0f9dce9e79f3c513aafbadfe7088281673b7b39ede657e3e7d519558a2af12c1d2e7a63f631bc56b848d99e49bdc83
6
+ metadata.gz: d2c0bfd23a066f1923377b974635cb00df298b98cd6f9c728cba0d49f34e8d2c86904fac666448ba7346ef488708065eed2bd49343be3e9cf6b7af3eb9b35de8
7
+ data.tar.gz: e8bf9580d239021c10392b9e24408b5bce3923dfe2d396b763b7ab974fdbe77c58e33be0e320d8b211d3b6689f89c56b306074873a4ca6ee1e55661718d2153e
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2014 Felix Krause
3
+ Copyright (c) 2015 Felix Krause
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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">Deliver</a> &bull;
3
- <b>Snapshot</b> &bull;
4
- <a href="https://github.com/KrauseFx/frameit">FrameIt</a> &bull;
5
- <a href="https://github.com/KrauseFx/PEM">PEM</a> &bull;
6
- <a href="https://github.com/KrauseFx/sigh">Sigh</a>
9
+ <a href="https://github.com/KrauseFx/deliver">deliver</a> &bull;
10
+ <b>snapshot</b> &bull;
11
+ <a href="https://github.com/KrauseFx/frameit">frameit</a> &bull;
12
+ <a href="https://github.com/KrauseFx/PEM">PEM</a> &bull;
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
- Snapshot - Create iOS App Screenshots
21
+ snapshot
15
22
  ============
16
23
 
17
24
  [![Twitter: @KauseFx](https://img.shields.io/badge/contact-@KrauseFx-blue.svg?style=flat)](https://twitter.com/KrauseFx)
18
25
  [![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://github.com/KrauseFx/snapshot/blob/master/LICENSE)
19
26
  [![Gem](https://img.shields.io/gem/v/snapshot.svg?style=flat)](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
- Follow the developer on Twitter: [@KrauseFx](https://twitter.com/KrauseFx)
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
- - Very easy to integrate with [```deliver```](https://github.com/KrauseFx/deliver)
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
- - ```Snapshot``` automatically waits for network requests to be finished before taking a screenshot (we don't want loading images in the App Store screenshots)
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
- After ```Snapshot``` successfully created new screenshots, it will generate a beautiful html file to get a quick overview of all screens:
67
- ![assets/htmlPage.png](assets/htmlPage.png)
79
+
80
+ ![assets/htmlPagePreviewFade.jpg](assets/htmlPagePreviewFade.jpg)
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. ```Snapshot``` uses a very similar technique - just in a clean and maintainable Ruby gem.
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
- Why should you have to remember complicated commands and parameters?
145
+ ```
146
+ snapshot
147
+ ```
133
148
 
134
- Store your configuration in a text file to easily take screenshots from any computer.
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
- ## Other helpful tools
241
- Check out other tools in this collection to speed up your deployment process:
242
- - [```deliver```](https://github.com/KrauseFx/deliver): Deploy screenshots, app metadata and app updates to the App Store using just one command.
243
- - [```FrameIt```](https://github.com/KrauseFx/frameit): Want a device frame around your screenshot? Do it in an instant!
244
- - [```PEM```](https://github.com/KrauseFx/pem): Tired of manually creating and maintaining your push certification profiles?
245
- - [```sigh```](https://github.com/KrauseFx/sigh): Because you would rather spend your time building stuff than fighting provisioning.
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 ```Snapshot```, submit an issue. Run ```snapshot --trace``` to get the stacktrace.
271
- - I'm available for contract work - drop me an email: snapshot@felixkrause.at
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\' - Automatic taking of screenshots on all simulator types in all languages.'
18
- program :help, 'Author', 'Felix Krause <krausefx@gmail.com>'
19
- program :help, 'Website', 'http://felixkrause.at'
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::SnapshotConfig.shared_instance(options.snapfile) if options.snapfile # to set the custom Snapfile path if given
38
- Snapshot::Runner.new.work(clean: !options.noclean)
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::SnapfileCreator.create('.')
46
+ path = (Snapshot::Helper.fastlane_enabled?? './fastlane' : '.')
47
+ Snapshot::SnapfileCreator.create(path)
48
48
  end
49
- end
49
+ end
@@ -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.project_name
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 Exception => ex
31
+ rescue => ex
34
32
  Helper.log.fatal all_lines.join("\n")
35
33
  raise ex
36
34
  end
@@ -47,5 +47,9 @@ module Snapshot
47
47
  `xcode-select -p`.gsub("\n", '') + "/"
48
48
  end
49
49
 
50
+ def self.fastlane_enabled?
51
+ # This is called from the root context on the first start
52
+ @@enabled ||= File.directory?"./fastlane"
53
+ end
50
54
  end
51
55
  end
@@ -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 SystemExit, Interrupt => ex
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 = [path, 'Snapfile'].join("/")
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
- self.project_path = (Dir.glob("./*.xcworkspace").first rescue nil) # prefer workspaces ofc
81
- self.project_path ||= (Dir.glob("./*.xcodeproj").first rescue nil)
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
- command = "cd '#{File.expand_path('..', project_path)}'; xcodebuild -list"
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 Exception => ex
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?
@@ -25,7 +25,7 @@ module Snapshot
25
25
  if latest and Gem::Version.new(latest) > Gem::Version.new(current_version)
26
26
  return true
27
27
  end
28
- rescue Exception => ex
28
+ rescue => ex
29
29
  Helper.log.debug(ex)
30
30
  Helper.log.error("Could not check if 'snapshot' is up to date.")
31
31
  end
@@ -1,3 +1,3 @@
1
1
  module Snapshot
2
- VERSION = "0.3.3"
2
+ VERSION = "0.4.0"
3
3
  end
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
- # Your code goes here...
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.3.3
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: 2014-12-09 00:00:00.000000000 Z
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: Take the pain out of taking iOS app screenshots.
167
+ description: Automate taking localized screenshots of your iOS app on every device
168
168
  email:
169
- - krausefx@gmail.com
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://felixkrause.at
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: Snapshot - Create hundreds of iOS app screenshots automatically
218
+ summary: Automate taking localized screenshots of your iOS app on every device
219
219
  test_files: []
220
220
  has_rdoc: