wraith 2.2.0 → 2.3.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: e0d2d6ee9fae5134b1d49d7a676668d2061adc76
4
- data.tar.gz: 8059a9c46cb989cb4cdd7170040e119dea0fdb2c
3
+ metadata.gz: b3735eab07e34d5a2e488049294f8fe6575a0d21
4
+ data.tar.gz: 3a6941bc0b2585405ad105a7c859e0a5119df216
5
5
  SHA512:
6
- metadata.gz: aa6062ac558cad8bd0c5d0dee90d53d129ed3ac98722b2614a6741b8a823b011dc9c8a6360f6351828e2f2ed280f5ae3667b73c6a8cc8ba571c44fde2df6ff60
7
- data.tar.gz: 847aa419b46d19450a9340191d72d68f1691f63bf44de78684ca4e04b711e4b8c225ff1cce1cf397e048db38c486e790ce18bdda6deaa6d2465f4739e9fcb02a
6
+ metadata.gz: d09341a03356355aec1ab2deda45bfd66c1b21f3f0e7e124167927df15df2f25897e10ea8230244ba5b71659294c1b6351521c82d9a64431904cbab046f0b09c
7
+ data.tar.gz: b050424d3765a08775990554b641ac650453365987dfa5d5ec10f480b09345407aeb80ee8e9f6e3366b59fc638a9419c95c62404be8695483ca360a8543d7cf6
data/.travis.yml CHANGED
@@ -1,13 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
- - "2.0.0"
5
-
3
+ - 1.9.3
4
+ - 2.0.0
6
5
  script: bundle exec rspec
7
-
8
6
  notifications:
9
7
  email:
10
8
  recipients:
11
- - david.blooman@bbc.co.uk
9
+ - david.blooman@bbc.co.uk
12
10
  on_failure: change
13
11
  on_success: never
12
+ slack:
13
+ secure: BgRAqwHabAtIBgtApDjyUiND2SNxd4sHMgq4ffnJ+EoMme6RSUAeK0G6LLyaGAk6YcpCeWRGOccEpzai87R3ckv6uycUVGxFcTvPmCEClakbUelWovVEyVT3hPLWznxJ8pz3EVB2+5aJnAsTg5M2ZnYtk3a5C1mrPS+WKceE/Ls=
@@ -43,3 +43,5 @@ spider_days:
43
43
  #diffs_first - all paths (with, and without, a difference) are shown, sorted by difference size (largest first)
44
44
  #diffs_only - only paths with a difference are shown, sorted by difference size (largest first)
45
45
  mode: diffs_first
46
+
47
+ threshold: 15
data/configs/config.yaml CHANGED
@@ -30,21 +30,10 @@ paths:
30
30
  #Amount of fuzz ImageMagick will use
31
31
  fuzz: '20%'
32
32
 
33
- #Set the filename of the spider file to use, if not specified it will fallback to spider.txt
34
- # spider_file: bbc_co_uk_spider.txt
35
-
36
33
  #Set the number of days to keep the site spider file
37
34
  spider_days:
38
35
  - 10
39
36
 
40
- #A list of URLs to skip when spidering. Ruby regular expressions can be
41
- #used, if prefixed with !ruby/regexp as defined in the YAML Cookbook
42
- #http://www.yaml.org/YAML_for_ruby.html#regexps
43
- #
44
- # spider_skips:
45
- # - /foo/bar.html # Matches /foo/bar.html explcitly
46
- # - !ruby/regexp /^\/baz\// # Matches any URLs that start with /baz
47
-
48
37
  #Choose how results are displayed, by default alphanumeric. Different screen widths are always grouped.
49
38
  #alphanumeric - all paths (with, and without, a difference) are shown, sorted by path
50
39
  #diffs_first - all paths (with, and without, a difference) are shown, sorted by difference size (largest first)
@@ -34,7 +34,7 @@ fuzz: '20%'
34
34
  spider_days:
35
35
  - 10
36
36
 
37
- #A list of URLs to skip when spidering. Ruby regular expressions can be
37
+ #A list of URLs to skip when spidering. Ruby regular expressions can be
38
38
  #used, if prefixed with !ruby/regexp as defined in the YAML Cookbook
39
39
  #http://www.yaml.org/YAML_for_ruby.html#regexps
40
40
  #
data/lib/wraith/folder.rb CHANGED
@@ -56,16 +56,22 @@ class Wraith::FolderManager
56
56
  end
57
57
 
58
58
  def tidy_shots_folder(dirs)
59
- dirs.each do |folder_name, shot_info|
60
- if shot_info.none? { |_k, v| v[:data] > 0 }
61
- if wraith.mode == 'diffs_only'
59
+ if wraith.mode == 'diffs_only'
60
+ dirs.each do |folder_name, shot_info|
61
+ if shot_info.none? { |_k, v| v[:data] > 0 }
62
62
  FileUtils.rm_rf("#{wraith.directory}/#{folder_name}")
63
63
  dirs.delete(folder_name)
64
- else
65
- return true
66
64
  end
67
- else
68
- return false
65
+ end
66
+ end
67
+ end
68
+
69
+ def threshold_rate(dirs)
70
+ dirs.each do |_folder_name, shot_info|
71
+ shot_info.each do |_k, v|
72
+ if v[:data] > wraith.threshold
73
+ return false
74
+ end
69
75
  end
70
76
  end
71
77
  end
@@ -45,7 +45,8 @@ class Wraith::GalleryGenerator
45
45
  end
46
46
  end
47
47
  end
48
- @failed_shots = @folder_manager.tidy_shots_folder(@dirs)
48
+ @folder_manager.tidy_shots_folder(@dirs)
49
+ @failed_shots = @folder_manager.threshold_rate(@dirs)
49
50
  sorting_dirs(@dirs)
50
51
  end
51
52
 
@@ -109,7 +110,8 @@ class Wraith::GalleryGenerator
109
110
  locals = {
110
111
  location: location,
111
112
  directories: directories,
112
- path: path
113
+ path: path,
114
+ threshold: wraith.threshold
113
115
  }
114
116
  html = ERB.new(template).result(ErbBinding.new(locals).get_binding)
115
117
  File.open(destination, 'w') do |outf|
@@ -28,11 +28,16 @@
28
28
  </div>
29
29
  <div class="col-lg-10">
30
30
  <% directories.each do |dir, sizes| %>
31
+ <% sizes.to_a.sort.each do |size, files| %>
31
32
  <div class="row">
32
- <a name="<%= dir %>"></a>
33
- <h2><%= dir.gsub('__', '/') %></h2>
33
+ <a name="<%= dir %>"></a>
34
+ <% if files[:data] > threshold %>
35
+ <h2 style="color:#CC0101"><%= dir.gsub('__', '/') %> <span class="glyphicon glyphicon-remove"></span></h2>
36
+ <% else %>
37
+ <h2><%= dir.gsub('__', '/') %></h2>
38
+ <% end %>
34
39
  </div>
35
- <% sizes.to_a.sort.each do |size, files| %>
40
+
36
41
  <div class="row">
37
42
  <h3 class="col-lg-1 text-muted"><%=size%>px</h3>
38
43
  <% files[:variants].each do |file| %>
@@ -1,3 +1,3 @@
1
1
  module Wraith
2
- VERSION = '2.2.0'
2
+ VERSION = '2.3.0'
3
3
  end
data/lib/wraith/wraith.rb CHANGED
@@ -87,6 +87,10 @@ class Wraith::Wraith
87
87
  end
88
88
  end
89
89
 
90
+ def threshold
91
+ @config['threshold'] ? @config['threshold'] : 0
92
+ end
93
+
90
94
  def phantomjs_options
91
95
  @config['phantomjs_options']
92
96
  end
@@ -43,3 +43,5 @@ spider_days:
43
43
  #diffs_first - all paths (with, and without, a difference) are shown, sorted by difference size (largest first)
44
44
  #diffs_only - only paths with a difference are shown, sorted by difference size (largest first)
45
45
  mode: diffs_first
46
+
47
+ threshold: 5
@@ -30,23 +30,14 @@ paths:
30
30
  #Amount of fuzz ImageMagick will use
31
31
  fuzz: '20%'
32
32
 
33
- #Set the filename of the spider file to use, if not specified it will fallback to spider.txt
34
- # spider_file: bbc_co_uk_spider.txt
35
-
36
33
  #Set the number of days to keep the site spider file
37
34
  spider_days:
38
35
  - 10
39
36
 
40
- #A list of URLs to skip when spidering. Ruby regular expressions can be
41
- #used, if prefixed with !ruby/regexp as defined in the YAML Cookbook
42
- #http://www.yaml.org/YAML_for_ruby.html#regexps
43
- #
44
- # spider_skips:
45
- # - /foo/bar.html # Matches /foo/bar.html explcitly
46
- # - !ruby/regexp /^\/baz\// # Matches any URLs that start with /baz
47
-
48
37
  #Choose how results are displayed, by default alphanumeric. Different screen widths are always grouped.
49
38
  #alphanumeric - all paths (with, and without, a difference) are shown, sorted by path
50
39
  #diffs_first - all paths (with, and without, a difference) are shown, sorted by difference size (largest first)
51
40
  #diffs_only - only paths with a difference are shown, sorted by difference size (largest first)
52
- #mode: diffs_first
41
+ mode: diffs_first
42
+
43
+ threshold: 5
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: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dave Blooman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-07 00:00:00.000000000 Z
12
+ date: 2014-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry