snapshot 0.4.8 → 0.4.9
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/lib/assets/snapshot.js +1 -5
- data/lib/snapshot.rb +4 -6
- data/lib/snapshot/dependency_checker.rb +3 -3
- data/lib/snapshot/page.html.erb +5 -2
- data/lib/snapshot/snapfile_creator.rb +1 -11
- data/lib/snapshot/version.rb +1 -1
- metadata +3 -61
- data/lib/snapshot/helper.rb +0 -55
- data/lib/snapshot/update_checker.rb +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eabaebc955a15edd3112f25763bfb7d4f739d8b1
|
4
|
+
data.tar.gz: a659b2cab87ab71c921ec6bfa01e926576fc98fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fc1971391f58ec8c4dbec7f98e485822fa7f4ce7e09bd569e1cbbf8f6d464e28a93ee3a2612ec0d3d979c517c9774af47fbdd7a00244efa2c3899d2bf2832cd
|
7
|
+
data.tar.gz: fce288bbb2822a369275d0fb08ed29da5ec2439ef0aa51c7fa5531dd4761a09feab7d8135a50e172e821c72545bfcf3fc2d3fe363f03c87fc2d554603cfd2a96
|
data/lib/assets/snapshot.js
CHANGED
@@ -6,8 +6,4 @@ var window = app.mainWindow();
|
|
6
6
|
|
7
7
|
|
8
8
|
target.delay(3)
|
9
|
-
captureLocalizedScreenshot("0-LandingScreen")
|
10
|
-
|
11
|
-
target.frontMostApp().tabBar().buttons()[1].tap();
|
12
|
-
target.delay(1)
|
13
|
-
captureLocalizedScreenshot("1-SecondScreen")
|
9
|
+
captureLocalizedScreenshot("0-LandingScreen")
|
data/lib/snapshot.rb
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
require 'json'
|
2
1
|
require 'snapshot/version'
|
3
|
-
require 'snapshot/helper'
|
4
2
|
require 'snapshot/snapshot_config'
|
5
3
|
require 'snapshot/runner'
|
6
4
|
require 'snapshot/builder'
|
@@ -9,13 +7,13 @@ require 'snapshot/reports_generator'
|
|
9
7
|
require 'snapshot/screenshot_flatten'
|
10
8
|
require 'snapshot/screenshot_rotate'
|
11
9
|
require 'snapshot/simulators'
|
12
|
-
require 'snapshot/update_checker'
|
13
10
|
require 'snapshot/dependency_checker'
|
14
11
|
|
15
|
-
|
16
|
-
require 'colored'
|
12
|
+
require 'fastlane_core'
|
17
13
|
|
18
14
|
module Snapshot
|
19
|
-
|
15
|
+
Helper = FastlaneCore::Helper # you gotta love Ruby: Helper.* should use the Helper class contained in FastlaneCore
|
16
|
+
|
17
|
+
FastlaneCore::UpdateChecker.verify_latest_version('snapshot', Snapshot::VERSION)
|
20
18
|
Snapshot::DependencyChecker.check_dependencies
|
21
19
|
end
|
@@ -11,11 +11,11 @@ module Snapshot
|
|
11
11
|
def self.check_xcode_select
|
12
12
|
unless `xcode-select -v`.include?"xcode-select version "
|
13
13
|
Helper.log.fatal '#############################################################'
|
14
|
-
Helper.log.fatal "# You have to install the Xcode commdand line tools to use
|
14
|
+
Helper.log.fatal "# You have to install the Xcode commdand line tools to use snapshot"
|
15
15
|
Helper.log.fatal "# Install the latest version of Xcode from the AppStore"
|
16
16
|
Helper.log.fatal "# Run xcode-select --install to install the developer tools"
|
17
17
|
Helper.log.fatal '#############################################################'
|
18
|
-
raise "Run 'xcode-select --install' and start
|
18
|
+
raise "Run 'xcode-select --install' and start snapshot again"
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
@@ -57,4 +57,4 @@ module Snapshot
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
-
end
|
60
|
+
end
|
data/lib/snapshot/page.html.erb
CHANGED
@@ -40,11 +40,14 @@
|
|
40
40
|
<% screens.each do |screen_path| %>
|
41
41
|
<% next if screen_path.include?"_framed.png" %>
|
42
42
|
<td>
|
43
|
-
<% screen_size = FastImage.size(screen_path) %>
|
43
|
+
<% screen_size = FastImage.size(File.join(SnapshotConfig.shared_instance.screenshots_path, screen_path)) %>
|
44
|
+
<% width = ((screen_size[0] / divide_size_by).round rescue 0) %>
|
45
|
+
<% width = [width, max_width].min %>
|
46
|
+
<% style = (width > 0 ? "width: #{width}px;" : '') %>
|
44
47
|
<a href="<%= screen_path %>" target="_blank">
|
45
48
|
<img class="screenshot"
|
46
49
|
src="<%= screen_path %>",
|
47
|
-
style="
|
50
|
+
style="<%= style %>" />
|
48
51
|
</a>
|
49
52
|
</td>
|
50
53
|
<% end %>
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'snapshot/helper'
|
2
|
-
|
3
1
|
module Snapshot
|
4
2
|
class SnapfileCreator
|
5
3
|
# This method will take care of creating a Snapfile
|
@@ -8,6 +6,7 @@ module Snapshot
|
|
8
6
|
|
9
7
|
raise "Snapfile already exists at path '#{snapfile_path}'. Run 'snapshot' to use Snapshot.".red if File.exists?(snapfile_path)
|
10
8
|
|
9
|
+
gem_path = Helper.gem_path("snapshot")
|
11
10
|
File.write(snapfile_path, File.read("#{gem_path}/lib/assets/SnapfileTemplate"))
|
12
11
|
File.write([path, 'snapshot.js'].join('/'), File.read("#{gem_path}/lib/assets/snapshot.js"))
|
13
12
|
File.write([path, 'snapshot-iPad.js'].join('/'), File.read("#{gem_path}/lib/assets/snapshot.js"))
|
@@ -18,14 +17,5 @@ module Snapshot
|
|
18
17
|
puts "Successfully created new UI Automation JS file for iPad at '#{[path, 'snapshot-iPad.js'].join('/')}'".green
|
19
18
|
puts "Successfully created new Snapfile at '#{snapfile_path}'".green
|
20
19
|
end
|
21
|
-
|
22
|
-
private
|
23
|
-
def self.gem_path
|
24
|
-
if not Helper.is_test? and Gem::Specification::find_all_by_name('snapshot').any?
|
25
|
-
return Gem::Specification.find_by_name('snapshot').gem_dir
|
26
|
-
else
|
27
|
-
return './'
|
28
|
-
end
|
29
|
-
end
|
30
20
|
end
|
31
21
|
end
|
data/lib/snapshot/version.rb
CHANGED
metadata
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snapshot
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
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-
|
11
|
+
date: 2015-02-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: fastlane_core
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
@@ -24,62 +24,6 @@ dependencies:
|
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: highline
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.6.21
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ~>
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.6.21
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: colored
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - '>='
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '0'
|
48
|
-
type: :runtime
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - '>='
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: commander
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '4'
|
62
|
-
type: :runtime
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ~>
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '4'
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: fastimage
|
71
|
-
requirement: !ruby/object:Gem::Requirement
|
72
|
-
requirements:
|
73
|
-
- - ~>
|
74
|
-
- !ruby/object:Gem::Version
|
75
|
-
version: 1.6.3
|
76
|
-
type: :runtime
|
77
|
-
prerelease: false
|
78
|
-
version_requirements: !ruby/object:Gem::Requirement
|
79
|
-
requirements:
|
80
|
-
- - ~>
|
81
|
-
- !ruby/object:Gem::Version
|
82
|
-
version: 1.6.3
|
83
27
|
- !ruby/object:Gem::Dependency
|
84
28
|
name: bundler
|
85
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -181,7 +125,6 @@ files:
|
|
181
125
|
- lib/snapshot.rb
|
182
126
|
- lib/snapshot/builder.rb
|
183
127
|
- lib/snapshot/dependency_checker.rb
|
184
|
-
- lib/snapshot/helper.rb
|
185
128
|
- lib/snapshot/page.html.erb
|
186
129
|
- lib/snapshot/reports_generator.rb
|
187
130
|
- lib/snapshot/runner.rb
|
@@ -191,7 +134,6 @@ files:
|
|
191
134
|
- lib/snapshot/snapfile_creator.rb
|
192
135
|
- lib/snapshot/snapshot_config.rb
|
193
136
|
- lib/snapshot/snapshot_file.rb
|
194
|
-
- lib/snapshot/update_checker.rb
|
195
137
|
- lib/snapshot/version.rb
|
196
138
|
homepage: http://fastlane.tools
|
197
139
|
licenses:
|
data/lib/snapshot/helper.rb
DELETED
@@ -1,55 +0,0 @@
|
|
1
|
-
require 'logger'
|
2
|
-
|
3
|
-
module Snapshot
|
4
|
-
class Helper
|
5
|
-
|
6
|
-
|
7
|
-
# Logging happens using this method
|
8
|
-
def self.log
|
9
|
-
if is_test?
|
10
|
-
@@log ||= Logger.new(STDOUT) # don't show any logs when running tests
|
11
|
-
else
|
12
|
-
@@log ||= Logger.new(STDOUT)
|
13
|
-
end
|
14
|
-
|
15
|
-
@@log.formatter = proc do |severity, datetime, progname, msg|
|
16
|
-
string = "#{severity} [#{datetime.strftime('%Y-%m-%d %H:%M:%S.%2N')}]: "
|
17
|
-
second = "#{msg}\n"
|
18
|
-
|
19
|
-
if severity == "DEBUG"
|
20
|
-
string = string.magenta
|
21
|
-
elsif severity == "INFO"
|
22
|
-
string = string.white
|
23
|
-
elsif severity == "WARN"
|
24
|
-
string = string.yellow
|
25
|
-
elsif severity == "ERROR"
|
26
|
-
string = string.red
|
27
|
-
elsif severity == "FATAL"
|
28
|
-
string = string.red.bold
|
29
|
-
end
|
30
|
-
|
31
|
-
|
32
|
-
[string, second].join("")
|
33
|
-
end
|
34
|
-
|
35
|
-
@@log
|
36
|
-
end
|
37
|
-
|
38
|
-
# @return true if the currently running program is a unit test
|
39
|
-
def self.is_test?
|
40
|
-
defined?SpecHelper
|
41
|
-
end
|
42
|
-
|
43
|
-
# @return the full path to the Xcode developer tools of the currently
|
44
|
-
# running system
|
45
|
-
def self.xcode_path
|
46
|
-
return "" if self.is_test? and not OS.mac?
|
47
|
-
`xcode-select -p`.gsub("\n", '') + "/"
|
48
|
-
end
|
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
|
54
|
-
end
|
55
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
|
3
|
-
module Snapshot
|
4
|
-
# Verifies, the user runs the latest version of this gem
|
5
|
-
class UpdateChecker
|
6
|
-
# This method will check if the latest version is installed and show a warning if that's not the case
|
7
|
-
def self.verify_latest_version
|
8
|
-
if self.update_available?
|
9
|
-
v = fetch_latest
|
10
|
-
puts '#######################################################################'.green
|
11
|
-
puts "# Snapshot #{v} is available.".green
|
12
|
-
puts "# It is recommended to use the latest version.".green
|
13
|
-
puts "# Update using '(sudo) gem update snapshot'.".green
|
14
|
-
puts "# To see what's new, open https://github.com/KrauseFx/snapshot/releases.".green
|
15
|
-
puts '#######################################################################'.green
|
16
|
-
return true
|
17
|
-
end
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
|
-
# Is a new official release available (this does not include pre-releases)
|
22
|
-
def self.update_available?
|
23
|
-
begin
|
24
|
-
latest = fetch_latest
|
25
|
-
if latest and Gem::Version.new(latest) > Gem::Version.new(current_version)
|
26
|
-
return true
|
27
|
-
end
|
28
|
-
rescue => ex
|
29
|
-
Helper.log.debug(ex)
|
30
|
-
Helper.log.error("Could not check if 'snapshot' is up to date.")
|
31
|
-
end
|
32
|
-
return false
|
33
|
-
end
|
34
|
-
|
35
|
-
# The currently used version of this gem
|
36
|
-
def self.current_version
|
37
|
-
Snapshot::VERSION
|
38
|
-
end
|
39
|
-
|
40
|
-
private
|
41
|
-
def self.fetch_latest
|
42
|
-
JSON.parse(open("http://rubygems.org/api/v1/gems/snapshot.json").read)["version"]
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|