wraith 2.1.1 → 2.2.0

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: e0c76259cb8695e6552a8b7b939994e6b9a99e59
4
- data.tar.gz: b78bf8799a480270634004106ccd6f840c4fda70
3
+ metadata.gz: e0d2d6ee9fae5134b1d49d7a676668d2061adc76
4
+ data.tar.gz: 8059a9c46cb989cb4cdd7170040e119dea0fdb2c
5
5
  SHA512:
6
- metadata.gz: 2737b52433482b8f89dda9eddaa2a4e413e3abe272034f69eee1daca65a7838ca45484659cb43d92c9fc1ba020f4a9f12b8d05178c4e69d4fc693c0c5e0a3194
7
- data.tar.gz: 7c109a5ea043b6dc145d18eaabb470637223386e5cb9bd0f5c15e96c11cc90362113de5061cbcd2b080fd22a26aa29a1fe55bb96f3b0d299a0f5db6b60eb3aa1
6
+ metadata.gz: aa6062ac558cad8bd0c5d0dee90d53d129ed3ac98722b2614a6741b8a823b011dc9c8a6360f6351828e2f2ed280f5ae3667b73c6a8cc8ba571c44fde2df6ff60
7
+ data.tar.gz: 847aa419b46d19450a9340191d72d68f1691f63bf44de78684ca4e04b711e4b8c225ff1cce1cf397e048db38c486e790ce18bdda6deaa6d2465f4739e9fcb02a
data/.travis.yml CHANGED
@@ -1,9 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.2"
3
+ - "1.9.3"
4
4
  - "2.0.0"
5
5
 
6
- script: ruby -Ilib bin/wraith capture test_config
6
+ script: bundle exec rspec
7
7
 
8
8
  notifications:
9
9
  email:
data/README.md CHANGED
@@ -17,7 +17,7 @@ and then creates a diff of the two images, the affected areas are highlighted in
17
17
  blue
18
18
 
19
19
  ![Photo of BBC News with a
20
- diff](http://bbc-news.github.io/wraith/img/320_diff.png)
20
+ diff](http://bbc-news.github.io/wraith/img/wraith.png)
21
21
 
22
22
 
23
23
  ## Requirements
@@ -11,15 +11,13 @@ directory: 'shots'
11
11
 
12
12
  # Add only 2 domains, key will act as a label
13
13
  domains:
14
- english: "http://pal.live.bbc.com/news"
15
- russian: "http://pal.live.bbc.co.uk/russian"
14
+ english: "http://www.bbc.co.uk/russian"
15
+ russian: "http://www.bbc.co.uk/russian"
16
16
 
17
17
  #Type screen widths below, here are a couple of examples
18
18
  screen_widths:
19
19
  - 320
20
20
  - 600
21
- - 768
22
- - 1024
23
21
  - 1280
24
22
 
25
23
  #Type page URL paths below, here are a couple of examples
data/lib/wraith/cli.rb CHANGED
@@ -86,7 +86,6 @@ class Wraith::CLI < Thor
86
86
  def generate_gallery(config_name)
87
87
  gallery = Wraith::GalleryGenerator.new(config_name)
88
88
  gallery.generate_gallery
89
- puts 'Gallery generated'
90
89
  end
91
90
 
92
91
  desc 'capture [config_name]', 'A full Wraith job'
data/lib/wraith/folder.rb CHANGED
@@ -55,17 +55,17 @@ class Wraith::FolderManager
55
55
  puts 'Creating Folders'
56
56
  end
57
57
 
58
- # Tidy up the shots folder, removing uncessary files
59
- #
60
58
  def tidy_shots_folder(dirs)
61
- if wraith.mode == 'diffs_only'
62
- dirs.each do |a, b|
63
- # If we are running in "diffs_only mode, and none of the variants show a difference
64
- # we remove the file from the shots folder
65
- if b.none? { |_k, v| v[:data] > 0 }
66
- FileUtils.rm_rf("#{wraith.directory}/#{a}")
67
- dirs.delete(a)
59
+ dirs.each do |folder_name, shot_info|
60
+ if shot_info.none? { |_k, v| v[:data] > 0 }
61
+ if wraith.mode == 'diffs_only'
62
+ FileUtils.rm_rf("#{wraith.directory}/#{folder_name}")
63
+ dirs.delete(folder_name)
64
+ else
65
+ return true
68
66
  end
67
+ else
68
+ return false
69
69
  end
70
70
  end
71
71
  end
@@ -45,7 +45,7 @@ class Wraith::GalleryGenerator
45
45
  end
46
46
  end
47
47
  end
48
- @folder_manager.tidy_shots_folder(@dirs)
48
+ @failed_shots = @folder_manager.tidy_shots_folder(@dirs)
49
49
  sorting_dirs(@dirs)
50
50
  end
51
51
 
@@ -122,6 +122,15 @@ class Wraith::GalleryGenerator
122
122
  directories = parse_directories(@location)
123
123
  generate_html(@location, directories, TEMPLATE_BY_DOMAIN_LOCATION, dest, withPath)
124
124
  FileUtils.cp(BOOTSTRAP_LOCATION, "#{@location}/bootstrap.min.css")
125
+ puts 'Gallery generated'
126
+ check_failed_shots
127
+ end
128
+
129
+ def check_failed_shots
130
+ if @failed_shots == false
131
+ puts 'Failures detected'
132
+ exit 1
133
+ end
125
134
  end
126
135
 
127
136
  class ErbBinding < OpenStruct
@@ -1,3 +1,3 @@
1
1
  module Wraith
2
- VERSION = '2.1.1'
2
+ VERSION = '2.2.0'
3
3
  end
data/spec/wraith_spec.rb CHANGED
@@ -6,13 +6,13 @@ describe Wraith do
6
6
  Given { Wraith::FolderManager.new(config_name).clear_shots_folder }
7
7
  Given { Dir.mkdir('shots/test') }
8
8
  let(:config_name) { 'test_config' }
9
- let(:test_url1) { 'http://www.live.bbc.co.uk/news' }
10
- let(:test_url2) { 'http://www.live.bbc.co.uk/russian' }
9
+ let(:test_url1) { 'http://www.bbc.co.uk/russian' }
10
+ let(:test_url2) { 'http://www.bbc.co.uk/russian' }
11
11
  let(:test_image1) { 'shots/test/test1.png' }
12
12
  let(:test_image2) { 'shots/test/test2.png' }
13
13
  let(:diff_image) { 'shots/test/test_diff.png' }
14
14
  let(:data_txt) { 'shots/test/test.txt' }
15
- let(:selector) { ''}
15
+ let(:selector) { '' }
16
16
  let(:saving) { Wraith::SaveImages.new(config_name) }
17
17
 
18
18
  When(:wraith) { Wraith::Wraith.new(config_name) }
@@ -21,9 +21,9 @@ describe Wraith do
21
21
  context 'When creating a wraith worker' do
22
22
 
23
23
  Then { wraith.config.keys.size == 7 }
24
- Then { wraith.widths == [320, 600, 768, 1024, 1280] }
25
- Then { wraith.base_domain == 'http://pal.live.bbc.com/news' }
26
- Then { wraith.comp_domain == 'http://pal.live.bbc.co.uk/russian' }
24
+ Then { wraith.widths == [320, 600, 1280] }
25
+ Then { wraith.base_domain == 'http://www.bbc.co.uk/russian' }
26
+ Then { wraith.comp_domain == 'http://www.bbc.co.uk/russian' }
27
27
  Then { wraith.base_domain_label == 'english' }
28
28
  Then { wraith.comp_domain_label == 'russian' }
29
29
  Then { wraith.paths == { 'home' => '/', 'uk_index' => '/uk' } }
@@ -62,7 +62,7 @@ describe Wraith do
62
62
  Wraith::CropImages.new(config_name).crop_images
63
63
  Wraith::CompareImages.new(config_name).compare_task(test_image1, test_image2, diff_image, data_txt)
64
64
  Wraith::Thumbnails.new(config_name).generate_thumbnails
65
- end
65
+ end
66
66
  Then { File.exist?('shots/thumbnails/test/test1.png') && File.exist?('shots/thumbnails/test/test2.png') && File.exist?('shots/thumbnails/test/test_diff.png') }
67
67
  end
68
68
  end
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.1.1
4
+ version: 2.2.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-10-20 00:00:00.000000000 Z
12
+ date: 2014-12-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry