wraith 1.1.4 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +2 -3
- data/bin/wraith +0 -2
- data/configs/config.yaml +1 -1
- data/configs/config_nojs.yaml +4 -4
- data/configs/test_config.yaml +11 -5
- data/lib/wraith/cli.rb +1 -1
- data/lib/wraith/compare_images.rb +16 -1
- data/lib/wraith/gallery_template/gallery_template.erb +2 -2
- data/lib/wraith/version.rb +1 -1
- data/lib/wraith/wraith.rb +10 -7
- data/wraith.gemspec +0 -1
- metadata +2 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea2a5aee7b4cbe3a600243e296db2bd328e38ce1
|
4
|
+
data.tar.gz: 60b739fbc44ed47c90d4643fa90458ffaca5e646
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd22474244454f8d4282603b0219b89cb2efaab49f3744a4e0b10b7321a8d41439bd15aa0d5def2141b7afe03a7b8a17bbf67c1ed4c2053b8149eb88348a4fd0
|
7
|
+
data.tar.gz: 5d00b6a992af94fd40fe0fead13b350b79d0f1962a7bfd9c1b35ccc62618df137545a37e0389875a1d60f33c2670b4d3f794aaa2cdef3330d2dd56845942f201
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -47,13 +47,13 @@ You can type `wraith` into terminal to bring up the list of commands, but the on
|
|
47
47
|
wraith capture config_name
|
48
48
|
```
|
49
49
|
|
50
|
-
This assumes that your snap.js and config.yaml are in the folders that were created on setup. There are other commands also available, these all expect a config_name to be passed as an option. Wraith will look for the config file at `configs/[config_name].yaml`.
|
50
|
+
This assumes that your snap.js and config.yaml are in the folders that were created on setup. There are other commands also available, these all expect a config_name to be passed as an option. Wraith will look for the config file at `configs/[config_name].yaml`. If you want to use a config from outside the setup folders, you can pass a path to a config where the config name would usually be set. This will assume that the config and snap file are in the same directory.
|
51
51
|
|
52
52
|
```sh
|
53
53
|
wraith capture config_name # A full Wraith job
|
54
54
|
wraith compare_images config_name # compares images to generate diffs
|
55
55
|
wraith crop_images config_name # crops images to the same height
|
56
|
-
wraith
|
56
|
+
wraith setup_folders config_name # create folders for images
|
57
57
|
wraith generate_gallery config_name # create page for viewing images
|
58
58
|
wraith generate_thumbnails config_name # create thumbnails for gallery
|
59
59
|
wraith reset_shots config_name # removes all the files in the shots folder
|
@@ -96,4 +96,3 @@ Take a look at the LICENSE file in the code.
|
|
96
96
|
* [Dave Blooman](http://twitter.com/dblooman)
|
97
97
|
* [John Cleveley](http://twitter.com/jcleveley)
|
98
98
|
* [Simon Thulbourn](http://twitter.com/sthulbourn)
|
99
|
-
|
data/bin/wraith
CHANGED
data/configs/config.yaml
CHANGED
data/configs/config_nojs.yaml
CHANGED
@@ -4,7 +4,7 @@ browser:
|
|
4
4
|
# gecko: "slimerjs"
|
5
5
|
|
6
6
|
#If you want to have multiple snapping files, set the file name here
|
7
|
-
snap_file: "
|
7
|
+
snap_file: "javascript/nojs.js"
|
8
8
|
|
9
9
|
# Type the name of the directory that shots will be stored in
|
10
10
|
directory:
|
@@ -35,9 +35,9 @@ paths:
|
|
35
35
|
# - /imghp
|
36
36
|
# - /maps
|
37
37
|
|
38
|
-
#Amount of fuzz ImageMagick will use
|
39
|
-
fuzz: '20%'
|
38
|
+
#Amount of fuzz ImageMagick will use
|
39
|
+
fuzz: '20%'
|
40
40
|
|
41
41
|
#Set the number of days to keep the site spider file
|
42
42
|
spider_days:
|
43
|
-
- 10
|
43
|
+
- 10
|
data/configs/test_config.yaml
CHANGED
@@ -4,7 +4,7 @@ browser:
|
|
4
4
|
# gecko: "./slimerjs"
|
5
5
|
|
6
6
|
#If you want to have multiple snapping files, set the file name here
|
7
|
-
snap_file: "
|
7
|
+
snap_file: "javascript/snap.js"
|
8
8
|
|
9
9
|
# Type the name of the directory that shots will be stored in
|
10
10
|
directory:
|
@@ -12,8 +12,8 @@ directory:
|
|
12
12
|
|
13
13
|
# Add only 2 domains, key will act as a label
|
14
14
|
domains:
|
15
|
-
english: "http://
|
16
|
-
russian: "http://
|
15
|
+
english: "http://pal.live.bbc.com/news"
|
16
|
+
russian: "http://pal.live.bbc.co.uk/russian"
|
17
17
|
|
18
18
|
#Type screen widths below, here are a couple of examples
|
19
19
|
screen_widths:
|
@@ -35,6 +35,12 @@ paths:
|
|
35
35
|
# - /imghp
|
36
36
|
# - /maps
|
37
37
|
|
38
|
-
#Amount of fuzz ImageMagick will use
|
39
|
-
fuzz: '20%'
|
38
|
+
#Amount of fuzz ImageMagick will use
|
39
|
+
fuzz: '20%'
|
40
40
|
|
41
|
+
#Set the filename of the spider file to use, if not specified it will fallback to spider.txt
|
42
|
+
# spider_file: bbc_co_uk_spider.txt
|
43
|
+
|
44
|
+
#Set the number of days to keep the site spider file
|
45
|
+
spider_days:
|
46
|
+
- 10
|
data/lib/wraith/cli.rb
CHANGED
@@ -30,7 +30,7 @@ class Wraith::CLI < Thor
|
|
30
30
|
reset.clear_shots_folder
|
31
31
|
end
|
32
32
|
|
33
|
-
desc "
|
33
|
+
desc "setup_folders [config_name]", "create folders for images"
|
34
34
|
def setup_folders(config_name)
|
35
35
|
create = Wraith::FolderManager.new(config_name)
|
36
36
|
create.create_folders
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'wraith'
|
2
|
+
require 'image_size'
|
3
|
+
require 'open3'
|
2
4
|
|
3
5
|
class Wraith::CompareImages
|
4
6
|
attr_reader :wraith
|
@@ -13,9 +15,22 @@ class Wraith::CompareImages
|
|
13
15
|
base, compare = files.slice!(0, 2)
|
14
16
|
diff = base.gsub(/([a-z0-9]+).png$/, 'diff.png')
|
15
17
|
info = base.gsub(/([a-z0-9]+).png$/, 'data.txt')
|
16
|
-
|
18
|
+
compare_task(base, compare, diff, info)
|
17
19
|
Dir.glob("#{wraith.directory}/*/*.txt").map { |f| "\n#{f}\n#{File.read(f)}" }
|
18
20
|
puts 'Saved diff'
|
19
21
|
end
|
20
22
|
end
|
23
|
+
|
24
|
+
def percentage(img_size, px_value, info)
|
25
|
+
pixel_count = (px_value / img_size) * 100
|
26
|
+
rounded = pixel_count.round(2)
|
27
|
+
File.open(info, 'w') { |file| file.write(rounded) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def compare_task(base, compare, output, info)
|
31
|
+
cmdline = "compare -fuzz #{wraith.fuzz} -metric AE -highlight-color blue #{base} #{compare} #{output}"
|
32
|
+
px_value = Open3.popen3(cmdline) { |stdin, stdout, stderr, wait_thr| stderr.read }.to_f
|
33
|
+
img_size = ImageSize.path(output).size.inject(:*)
|
34
|
+
percentage(img_size, px_value, info)
|
35
|
+
end
|
21
36
|
end
|
@@ -50,7 +50,7 @@
|
|
50
50
|
</a>
|
51
51
|
<% end %>
|
52
52
|
<p class="text-center">diff</p>
|
53
|
-
<p class="text-center text-muted"><%=files[:data]%>
|
53
|
+
<p class="text-center text-muted"><%=files[:data]%> percent different</p>
|
54
54
|
|
55
55
|
</div>
|
56
56
|
</div>
|
@@ -60,4 +60,4 @@
|
|
60
60
|
</div>
|
61
61
|
</div>
|
62
62
|
</body>
|
63
|
-
</html>
|
63
|
+
</html>
|
data/lib/wraith/version.rb
CHANGED
data/lib/wraith/wraith.rb
CHANGED
@@ -4,7 +4,13 @@ class Wraith::Wraith
|
|
4
4
|
attr_accessor :config
|
5
5
|
|
6
6
|
def initialize(config_name)
|
7
|
-
|
7
|
+
if File.exists? config_name
|
8
|
+
@config = YAML::load(File.open(config_name))
|
9
|
+
@snap_path = File.expand_path(File.dirname("#{config_name}"))
|
10
|
+
else
|
11
|
+
@config = YAML::load(File.open("configs/#{config_name}.yaml"))
|
12
|
+
@snap_path = File.dirname(__FILE__)
|
13
|
+
end
|
8
14
|
end
|
9
15
|
|
10
16
|
def directory
|
@@ -12,7 +18,8 @@ class Wraith::Wraith
|
|
12
18
|
end
|
13
19
|
|
14
20
|
def snap_file
|
15
|
-
@config['snap_file'] ? @config['snap_file'] :
|
21
|
+
file = @config['snap_file'] ? @config['snap_file'] : 'javascript/snap.js'
|
22
|
+
File.expand_path(file, @snap_path)
|
16
23
|
end
|
17
24
|
|
18
25
|
def widths
|
@@ -38,7 +45,7 @@ class Wraith::Wraith
|
|
38
45
|
def comp_domain_label
|
39
46
|
domains.keys[1]
|
40
47
|
end
|
41
|
-
|
48
|
+
|
42
49
|
def spider_file
|
43
50
|
@config['spider_file'] ? @config['spider_file'] : 'spider.txt'
|
44
51
|
end
|
@@ -63,10 +70,6 @@ class Wraith::Wraith
|
|
63
70
|
puts `"#{browser}" #{@config['phantomjs_options']} "#{snap_file}" "#{url}" "#{width}" "#{file_name}"`
|
64
71
|
end
|
65
72
|
|
66
|
-
def compare_images(base, compare, output, info)
|
67
|
-
puts `compare -fuzz #{fuzz} -metric AE -highlight-color blue #{base} #{compare} #{output} 2>#{info}`
|
68
|
-
end
|
69
|
-
|
70
73
|
def self.crop_images(crop, height)
|
71
74
|
# For compatibility with windows file structures switch commenting on the following 2 lines
|
72
75
|
puts `convert #{crop} -background none -extent 0x#{height} #{crop}`
|
data/wraith.gemspec
CHANGED
@@ -18,7 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_development_dependency "rake"
|
22
21
|
spec.add_development_dependency "pry"
|
23
22
|
spec.add_development_dependency "rspec-given"
|
24
23
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wraith
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dave Blooman
|
@@ -9,22 +9,8 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-04-16 00:00:00.000000000 Z
|
13
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
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: pry
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|