snapshot 0.4.11 → 0.4.12

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e7f8764c7ccb052783a772bf7583e3cbe270501
4
- data.tar.gz: 5f16b0ed81aa8f1b660521a6864731c31c2de6d1
3
+ metadata.gz: 9968201d0d0aa36979286f7795002653e0b919bf
4
+ data.tar.gz: 02d096f07cac729ad6d4ded27698d6d8cafbd788
5
5
  SHA512:
6
- metadata.gz: 0938ff5e2b80ea066a207259ba913867df412341c23e6180aae74da50508e2d591b30fdd103b78688a8d94be7a0c22be95cb801a63c4a7b27df5db4e8a39f81c
7
- data.tar.gz: aa8255d45a17dbfe9a4cc9bcae173ae170076dbc6ea21f0b66b8a6507e4d86eadc1d2b604e93b94512059d47a80368bb32af3037eb40973446efdeb9ec014fc9
6
+ metadata.gz: 805dbfb200d6dd9e71994fac0e293a4b008e708d97cdbc7d2b63d1c0e6aa7d39f804f16a2c7c94eb8fd450b8820b5935073c4faa6bed22d539cf4f8a6b6a96e5
7
+ data.tar.gz: fca03fb9128b4155be4162b9b6b5531f6e0d88d7466e08fbe79ce78b0e096a6140a9a913295da0bdab919528077cd519589511d6ffaa6121212c93a93364c132
data/README.md CHANGED
@@ -301,6 +301,14 @@ If you add this line in your `Snapfile`, the previously generated screenshots wi
301
301
  clear_previous_screenshots
302
302
  ```
303
303
 
304
+ ### Completely reset all simulators
305
+
306
+ snapshot reset_simulators
307
+
308
+ **Warning**: This will delete **all** your simulators and replace by new ones! This is useful, if you run into weird `Instruments` problems when running `snapshot`.
309
+
310
+ You can use the environment variable `SNAPSHOT_FORCE_DELETE` to stop asking for confirmation before deleting.
311
+
304
312
 
305
313
  # Tips
306
314
 
data/bin/snapshot CHANGED
@@ -50,6 +50,19 @@ class SnapshotApplication
50
50
  end
51
51
  end
52
52
 
53
+ command :reset_simulators do |c|
54
+ c.syntax = 'snapshot reset_simulators'
55
+ c.description = "This will remove all your existing simulators and re-create new ones"
56
+ c.option '-i', '--ios String', String, 'The iOS Version you want to use'
57
+
58
+ c.action do |args, options|
59
+ version = options.ios || ENV["SNAPSHOT_IOS_VERSION"] || Snapshot::LatestIosVersion::VERSION
60
+ require 'snapshot/reset_simulators'
61
+
62
+ Snapshot::ResetSimulators.clear_everything!(version)
63
+ end
64
+ end
65
+
53
66
  default_command :run
54
67
 
55
68
  run!
@@ -0,0 +1,5 @@
1
+ module Snapshot
2
+ class LatestIosVersion
3
+ VERSION = '8.1'
4
+ end
5
+ end
@@ -0,0 +1,34 @@
1
+ module Snapshot
2
+ class ResetSimulators
3
+ def self.clear_everything!(ios_version)
4
+ # Taken from https://gist.github.com/cabeca/cbaacbeb6a1cc4683aa5
5
+
6
+ # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7
+ # !! Warning: This script will remove all your existing simulators !!
8
+ # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9
+
10
+ sure = true if ENV["SNAPSHOT_FORCE_DELETE"]
11
+ sure = agree("Are you sure? All your simulators will be DELETED and new ones will be created! (y/n)".red, true) unless sure
12
+
13
+ raise "User cancelled action" unless sure
14
+
15
+ device_types_output = `xcrun simctl list devicetypes`
16
+ device_types = device_types_output.scan /(.*) \((.*)\)/
17
+
18
+ devices_output = `xcrun simctl list devices`
19
+ devices = devices_output.scan /\s\s\s\s(.*) \(([^)]+)\) (.*)/
20
+
21
+ devices.each do |device|
22
+ puts "Removing device #{device[0]} (#{device[1]})"
23
+ `xcrun simctl delete #{device[1]}`
24
+ end
25
+
26
+ device_types.each do |device_type|
27
+ puts "Creating #{device_type} for iOS version #{ios_version}"
28
+ command = "xcrun simctl create '#{device_type[0]}' #{device_type[1]} #{ios_version}"
29
+ command_output = `#{command}`
30
+ sleep 0.5
31
+ end
32
+ end
33
+ end
34
+ end
@@ -73,7 +73,7 @@ module Snapshot
73
73
  end
74
74
 
75
75
  def set_defaults
76
- self.ios_version = '8.1'
76
+ self.ios_version = Snapshot::LatestIosVersion::VERSION
77
77
 
78
78
  self.languages = [
79
79
  'de-DE',
@@ -1,3 +1,3 @@
1
1
  module Snapshot
2
- VERSION = "0.4.11"
2
+ VERSION = "0.4.12"
3
3
  end
data/lib/snapshot.rb CHANGED
@@ -8,6 +8,7 @@ require 'snapshot/screenshot_flatten'
8
8
  require 'snapshot/screenshot_rotate'
9
9
  require 'snapshot/simulators'
10
10
  require 'snapshot/dependency_checker'
11
+ require 'snapshot/latest_ios_version'
11
12
 
12
13
  require 'fastlane_core'
13
14
 
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.11
4
+ version: 0.4.12
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-02-27 00:00:00.000000000 Z
11
+ date: 2015-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fastimage
@@ -139,8 +139,10 @@ files:
139
139
  - lib/snapshot.rb
140
140
  - lib/snapshot/builder.rb
141
141
  - lib/snapshot/dependency_checker.rb
142
+ - lib/snapshot/latest_ios_version.rb
142
143
  - lib/snapshot/page.html.erb
143
144
  - lib/snapshot/reports_generator.rb
145
+ - lib/snapshot/reset_simulators.rb
144
146
  - lib/snapshot/runner.rb
145
147
  - lib/snapshot/screenshot_flatten.rb
146
148
  - lib/snapshot/screenshot_rotate.rb