wraith 1.0.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gemset +1 -0
- data/.gitignore +5 -0
- data/.ruby-version +1 -0
- data/.travis.yml +13 -0
- data/Gemfile +4 -0
- data/LICENSE +177 -0
- data/README.md +203 -0
- data/Rakefile +68 -0
- data/bin/wraith +13 -0
- data/configs/config.yaml +43 -0
- data/configs/config_nojs.yaml +43 -0
- data/configs/test_config.yaml +40 -0
- data/lib/wraith.rb +5 -4
- data/lib/wraith/assets/invalid.jpg +0 -0
- data/lib/wraith/cli.rb +82 -0
- data/lib/wraith/compare_images.rb +21 -0
- data/lib/wraith/crop.rb +50 -0
- data/lib/wraith/error.rb +3 -0
- data/lib/wraith/folder.rb +40 -0
- data/lib/wraith/gallery.rb +86 -0
- data/lib/wraith/gallery_template/bootstrap.min.css +9 -0
- data/lib/wraith/gallery_template/gallery_template.erb +63 -0
- data/lib/wraith/images.rb +19 -0
- data/lib/wraith/javascript/nojs.js +85 -0
- data/lib/wraith/javascript/snap.js +85 -0
- data/lib/wraith/save_images.rb +67 -0
- data/lib/wraith/spider.rb +66 -0
- data/lib/wraith/thumbnails.rb +17 -0
- data/lib/wraith/version.rb +3 -0
- data/lib/wraith/wraith.rb +81 -0
- data/spec/wraith_spec.rb +58 -0
- data/wraith.gemspec +32 -0
- metadata +192 -20
data/spec/wraith_spec.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
require 'rspec-given'
|
2
|
+
require 'wraith'
|
3
|
+
require 'wraith_manager'
|
4
|
+
|
5
|
+
describe Wraith do
|
6
|
+
Given(:config_name) { 'test_config' }
|
7
|
+
Given { WraithManager.new(config_name).reset_shots_folder }
|
8
|
+
Given(:test_url1) { "http://www.live.bbc.co.uk/news" }
|
9
|
+
Given(:test_url2) { "http://www.live.bbc.co.uk/russian" }
|
10
|
+
Given { Dir.mkdir('shots/test') }
|
11
|
+
Given(:test_image1) { 'shots/test/test1.png' }
|
12
|
+
Given(:test_image2) { 'shots/test/test2.png' }
|
13
|
+
Given(:diff_image) { 'shots/test/test_diff.png' }
|
14
|
+
Given(:data_txt) { 'shots/test/test.txt' }
|
15
|
+
|
16
|
+
When(:wraith) { Wraith.new(config_name) }
|
17
|
+
Then { wraith.is_a? Wraith }
|
18
|
+
|
19
|
+
context "When creating a wraith worker" do
|
20
|
+
When(:no_config) { Wraith.new }
|
21
|
+
Then { no_config.should have_failed(ArgumentError) }
|
22
|
+
|
23
|
+
Then { wraith.config.keys.size == 8 }
|
24
|
+
Then { wraith.widths == [320, 600, 768, 1024, 1280] }
|
25
|
+
Then { wraith.base_domain == "http://www.live.bbc.co.uk/news" }
|
26
|
+
Then { wraith.comp_domain == "http://www.live.bbc.co.uk/russian" }
|
27
|
+
Then { wraith.base_domain_label == "english" }
|
28
|
+
Then { wraith.comp_domain_label == "russian" }
|
29
|
+
Then { wraith.paths == { "home" => "/", "uk_index" => "/uk" } }
|
30
|
+
end
|
31
|
+
|
32
|
+
context "When capturing an image" do
|
33
|
+
# capture_page_image
|
34
|
+
When do
|
35
|
+
wraith.engine.each do |type, engine|
|
36
|
+
wraith.capture_page_image( engine, test_url1, 320, test_image1 )
|
37
|
+
end
|
38
|
+
end
|
39
|
+
When(:image_size) { ImageSize.path(test_image1).size }
|
40
|
+
Then { image_size[0] == 320 }
|
41
|
+
end
|
42
|
+
|
43
|
+
context "When comparing images" do
|
44
|
+
When(:diff_image_size) do
|
45
|
+
wraith.engine.each do |type, engine|
|
46
|
+
wraith.capture_page_image( engine, test_url1, 320, test_image1 )
|
47
|
+
wraith.capture_page_image( engine, test_url2, 320, test_image2 )
|
48
|
+
end
|
49
|
+
WraithManager.new(config_name).crop_images
|
50
|
+
wraith.compare_images( test_image1, test_image2, diff_image, data_txt )
|
51
|
+
ImageSize.path(diff_image).size
|
52
|
+
end
|
53
|
+
Then { diff_image_size[0] == 320 }
|
54
|
+
end
|
55
|
+
|
56
|
+
# crop_images
|
57
|
+
# thumbnail_image
|
58
|
+
end
|
data/wraith.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'wraith/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "wraith"
|
8
|
+
spec.version = Wraith::VERSION
|
9
|
+
spec.authors = ["Dave Blooman", "Simon Thulbourn"]
|
10
|
+
spec.email = ["david.blooman@gmail.com", "simon+github@thulbourn.com"]
|
11
|
+
spec.summary = 'Wraith is a screenshot comparison tool, created by developers at BBC News.'
|
12
|
+
spec.description = 'Wraith is a screenshot comparison tool, created by developers at BBC News.'
|
13
|
+
spec.homepage = "http://responsivenews.co.uk"
|
14
|
+
spec.license = "Apache 2"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
spec.add_development_dependency "pry"
|
23
|
+
spec.add_development_dependency "rspec-given"
|
24
|
+
|
25
|
+
spec.add_runtime_dependency "rake"
|
26
|
+
spec.add_runtime_dependency "image_size"
|
27
|
+
spec.add_runtime_dependency "anemone"
|
28
|
+
spec.add_runtime_dependency "robotex"
|
29
|
+
spec.add_runtime_dependency "nokogiri"
|
30
|
+
spec.add_runtime_dependency "log4r"
|
31
|
+
spec.add_runtime_dependency "thor"
|
32
|
+
end
|
metadata
CHANGED
@@ -1,49 +1,221 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wraith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
5
|
-
prerelease:
|
4
|
+
version: 1.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
-
|
7
|
+
- Dave Blooman
|
9
8
|
- Simon Thulbourn
|
10
|
-
- John Clevely
|
11
9
|
autorequire:
|
12
10
|
bindir: bin
|
13
11
|
cert_chain: []
|
14
|
-
date:
|
15
|
-
dependencies:
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
12
|
+
date: 2014-02-06 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '>='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: '0'
|
21
|
+
type: :development
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '>='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: '0'
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: pry
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '>='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '0'
|
35
|
+
type: :development
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '>='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: '0'
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: rspec-given
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '>='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: '0'
|
49
|
+
type: :development
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: rake
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '>='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '0'
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: image_size
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '>='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '0'
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: anemone
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: robotex
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - '>='
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - '>='
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: nokogiri
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - '>='
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: log4r
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - '>='
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - '>='
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: thor
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - '>='
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0'
|
147
|
+
type: :runtime
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
description: Wraith is a screenshot comparison tool, created by developers at BBC
|
155
|
+
News.
|
156
|
+
email:
|
157
|
+
- david.blooman@gmail.com
|
158
|
+
- simon+github@thulbourn.com
|
159
|
+
executables:
|
160
|
+
- wraith
|
20
161
|
extensions: []
|
21
162
|
extra_rdoc_files: []
|
22
163
|
files:
|
164
|
+
- .gemset
|
165
|
+
- .gitignore
|
166
|
+
- .ruby-version
|
167
|
+
- .travis.yml
|
168
|
+
- Gemfile
|
169
|
+
- LICENSE
|
170
|
+
- README.md
|
171
|
+
- Rakefile
|
172
|
+
- bin/wraith
|
173
|
+
- configs/config.yaml
|
174
|
+
- configs/config_nojs.yaml
|
175
|
+
- configs/test_config.yaml
|
23
176
|
- lib/wraith.rb
|
24
|
-
|
177
|
+
- lib/wraith/assets/invalid.jpg
|
178
|
+
- lib/wraith/cli.rb
|
179
|
+
- lib/wraith/compare_images.rb
|
180
|
+
- lib/wraith/crop.rb
|
181
|
+
- lib/wraith/error.rb
|
182
|
+
- lib/wraith/folder.rb
|
183
|
+
- lib/wraith/gallery.rb
|
184
|
+
- lib/wraith/gallery_template/bootstrap.min.css
|
185
|
+
- lib/wraith/gallery_template/gallery_template.erb
|
186
|
+
- lib/wraith/images.rb
|
187
|
+
- lib/wraith/javascript/nojs.js
|
188
|
+
- lib/wraith/javascript/snap.js
|
189
|
+
- lib/wraith/save_images.rb
|
190
|
+
- lib/wraith/spider.rb
|
191
|
+
- lib/wraith/thumbnails.rb
|
192
|
+
- lib/wraith/version.rb
|
193
|
+
- lib/wraith/wraith.rb
|
194
|
+
- spec/wraith_spec.rb
|
195
|
+
- wraith.gemspec
|
196
|
+
homepage: http://responsivenews.co.uk
|
25
197
|
licenses:
|
26
|
-
-
|
198
|
+
- Apache 2
|
199
|
+
metadata: {}
|
27
200
|
post_install_message:
|
28
201
|
rdoc_options: []
|
29
202
|
require_paths:
|
30
203
|
- lib
|
31
204
|
required_ruby_version: !ruby/object:Gem::Requirement
|
32
|
-
none: false
|
33
205
|
requirements:
|
34
|
-
- -
|
206
|
+
- - '>='
|
35
207
|
- !ruby/object:Gem::Version
|
36
208
|
version: '0'
|
37
209
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
38
|
-
none: false
|
39
210
|
requirements:
|
40
|
-
- -
|
211
|
+
- - '>='
|
41
212
|
- !ruby/object:Gem::Version
|
42
213
|
version: '0'
|
43
214
|
requirements: []
|
44
215
|
rubyforge_project:
|
45
|
-
rubygems_version:
|
216
|
+
rubygems_version: 2.0.14
|
46
217
|
signing_key:
|
47
|
-
specification_version:
|
48
|
-
summary:
|
49
|
-
test_files:
|
218
|
+
specification_version: 4
|
219
|
+
summary: Wraith is a screenshot comparison tool, created by developers at BBC News.
|
220
|
+
test_files:
|
221
|
+
- spec/wraith_spec.rb
|