monet 0.2.1 → 0.2.2

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: 5b14506b0fca47138eb6897ffad50b1cee94c9b9
4
- data.tar.gz: e552c2598df336e6b7b28908658ba0d6a6d3d393
3
+ metadata.gz: bd82504151954e9dec64d70da527bf9d6973b2aa
4
+ data.tar.gz: 67a18681fd090836de4c7d4285afbd8e59c1b67e
5
5
  SHA512:
6
- metadata.gz: cd45f113bb3bd8be08d0079233511a5a19ade5e4525c95b82c7c67852d7ea93bd028ee121b7e1c7b8920bd2d9a660782abcde3f4f2f09176b497727630889113
7
- data.tar.gz: df875d3a0769da6e43fbbcf060555b66348ca6c416dbef60b52ed411596785b6d82d32ad15e5ed9fe194d2f4b2b8335da2eb31491915d8634c892c27bd1ba2a6
6
+ metadata.gz: 9ec8e7217fedd9b53d186da3ec9b06e2b6d0be26db4b7cabe5365a8d5779e5c03ae517e571cee12f8e951a6e4d63fb92fdadcf63e5d8374c1202b8a798082b5a
7
+ data.tar.gz: 7baca87ebf4ec4e08e5575cdfcd0cebe26eaca652adbfdf9b6ad81a476ffe94857d2286283f1ddb0d9a8ad7a93da9d41b1d2a4bdcac76623294a5a17c4ad60fd
@@ -4,3 +4,4 @@ rvm:
4
4
  - 1.9.3
5
5
  - rbx
6
6
 
7
+ script: bundle exec rake test
data/README.md CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
21
21
  The basic gem requires a config file that is called in an app initializer or via the built-in rake task. This config primarily exists to give the gem a list of paths it needs to collect and either baseline or compare to previous baselines. This config might look something like this:
22
22
 
23
23
  ```ruby
24
- Monet.config do |config|
24
+ config = Monet.config do |config|
25
25
  config.driver = :poltergeist
26
26
  config.dimensions = [1440,900]
27
27
 
@@ -36,24 +36,55 @@ Monet.config do |config|
36
36
  end
37
37
  ```
38
38
 
39
+ You can also use a yaml file and load it later
40
+
41
+ ```yaml
42
+ :driver: :poltergeist
43
+ :dimensions:
44
+ - 1024
45
+
46
+ :base_url: "http://lance.com"
47
+
48
+ :compare_type: Highlight
49
+ :map:
50
+ - "/"
51
+ - "/aboutus"
52
+ - "/littleleague"
53
+ ```
54
+
55
+ You can then use the config to run the capture and comparison toolset:
56
+
57
+ ```ruby
58
+ Monet.capture(config)
59
+ Monet.compare(config)
60
+ ```
61
+
62
+ There are also rake tasks for this
63
+
64
+ ```
65
+ rake run ./config.yaml
66
+ ```
67
+
39
68
  ## Process
40
69
 
41
- Captures are saved into the following structure:
70
+ Captures are saved into the following structure by default:
42
71
 
43
72
  ```
73
+ /baselines
44
74
  /captures
45
- /baselines
46
- /captures
47
75
  ```
48
76
 
49
77
  - /captures is where the current capture run images are stored, pre-comparison with baseline.
50
78
  - /baselines is where all current baseline images are stored. persistent in-between capture runs.
51
79
 
80
+ You can set these params using the `baseline_dir` and `captures_dir` options.
81
+
52
82
  During the capture process, any new captures that do not have a match found in baselines to compare with are considered new baselines.
53
83
  Any images that match baseline are discarded.
54
84
  Any images that flag differences, are flagged for review.
55
85
 
56
86
  Review involves checking flagged images and marking as
87
+
57
88
  1. discard
58
89
  2. flag as issue
59
90
  3. accept as new baseline
@@ -23,6 +23,10 @@ module Monet
23
23
  control.run
24
24
  end
25
25
 
26
+ def config(&block)
27
+ Monet::Config.config block
28
+ end
29
+
26
30
  def load_config(options)
27
31
  Monet::Config.build_config(options)
28
32
  end
@@ -41,7 +41,7 @@ module Monet
41
41
  # takes a path, returns the URL used to generate the image
42
42
  def route_path(path)
43
43
  url = path.split("/").last
44
- path = url.split('>')[1..-1].join("/").gsub(/-\d+\.png/, "")
44
+ path = url.split('|')[1..-1].join("/").gsub(/-\d+\.png/, "")
45
45
 
46
46
  "#{@base_url}/#{path}"
47
47
  end
@@ -53,7 +53,7 @@ module Monet
53
53
 
54
54
  private
55
55
  def image_name(base_dir, path, width)
56
- name = normalize_path(path).gsub(/\//, '>')
56
+ name = normalize_path(path).gsub(/\//, '|')
57
57
  "#{base_dir}/#{host}/#{name}-#{width}.png"
58
58
  end
59
59
 
@@ -1,8 +1,11 @@
1
1
  require 'monet'
2
2
 
3
3
  namespace :monet do
4
- task :clean do
5
- config = Monet::Config.load
4
+ desc "clean out the baseline directory"
5
+ task :clean, :path do |t, args|
6
+ args.with_defaults(path: './config.yaml')
7
+
8
+ config = Monet::Config.load args[:path]
6
9
  Monet.clean config
7
10
  end
8
11
 
@@ -11,8 +14,10 @@ namespace :monet do
11
14
  end
12
15
 
13
16
  desc "Run the baseline comparison"
14
- task :run do
15
- config = Monet::Config.load
17
+ task :run, :path do |t, args|
18
+ args.with_defaults(path: './config.yaml')
19
+
20
+ config = Monet::Config.load args[:path]
16
21
  Monet.capture config
17
22
  Monet.compare config
18
23
  end
@@ -1,3 +1,3 @@
1
1
  module Monet
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -32,20 +32,20 @@ describe Monet::Capture do
32
32
  context "converts name properly" do
33
33
  Given(:capture_agent) { Monet::Capture.new(capture_dir: path, base_url: url, dimensions: [900]) }
34
34
  When { capture_agent.capture("/") }
35
- Then { File.exist?("#{path}/google.com/google.com>-900.png").should be_true }
35
+ Then { File.exist?("#{path}/google.com/google.com|-900.png").should be_true }
36
36
  end
37
37
 
38
38
  context "captures all dimensions requested" do
39
39
  Given(:capture_agent) { Monet::Capture.new(capture_dir: path, base_url: url, dimensions: [900, 1400]) }
40
40
  When { capture_agent.capture("/") }
41
- Then { File.exist?("#{path}/google.com/google.com>-900.png").should be_true }
42
- Then { File.exist?("#{path}/google.com/google.com>-1400.png").should be_true }
41
+ Then { File.exist?("#{path}/google.com/google.com|-900.png").should be_true }
42
+ Then { File.exist?("#{path}/google.com/google.com|-1400.png").should be_true }
43
43
  end
44
44
 
45
45
  context "prepends default protocol if missing" do
46
46
  Given(:capture_agent) { Monet::Capture.new(capture_dir: path, base_url: "http://www.facebook.com") }
47
47
  When { capture_agent.capture('/') }
48
- Then { File.exist?("#{path}/www.facebook.com/www.facebook.com>-1024.png").should be_true }
48
+ Then { File.exist?("#{path}/www.facebook.com/www.facebook.com|-1024.png").should be_true }
49
49
  end
50
50
 
51
51
  end
@@ -20,31 +20,31 @@ describe Monet::PathRouter do
20
20
 
21
21
  context "full url to path" do
22
22
  When(:path) { router.route_url("http://google.com/space/manager", 900) }
23
- Then { path.should == "#{capture}/google.com/google.com>space>manager-900.png" }
23
+ Then { path.should == "#{capture}/google.com/google.com|space|manager-900.png" }
24
24
  end
25
25
 
26
26
  context "url path to path" do
27
27
  When(:path) { router.route_url_path("/space/manager", 900) }
28
- Then { path.should == "#{capture}/google.com/google.com>space>manager-900.png"}
28
+ Then { path.should == "#{capture}/google.com/google.com|space|manager-900.png"}
29
29
  end
30
30
 
31
31
  context "path to url" do
32
- When(:url) { router.route_path("#{capture}/google.com/google.com>space>manager-900.png") }
32
+ When(:url) { router.route_path("#{capture}/google.com/google.com|space|manager-900.png") }
33
33
  Then { url.should == "http://google.com/space/manager" }
34
34
  end
35
35
 
36
36
  context "path to baseline from url" do
37
37
  When(:path) { router.url_to_baseline("http://google.com/space/manager", 900) }
38
- Then { path.should == "#{baseline}/google.com/google.com>space>manager-900.png" }
38
+ Then { path.should == "#{baseline}/google.com/google.com|space|manager-900.png" }
39
39
  end
40
40
 
41
41
  context "path to baseline from path" do
42
42
  When(:path) { router.url_path_to_baseline("/space/manager", 900) }
43
- Then { path.should == "#{baseline}/google.com/google.com>space>manager-900.png" }
43
+ Then { path.should == "#{baseline}/google.com/google.com|space|manager-900.png" }
44
44
  end
45
45
 
46
46
  context "capture path to baseline path" do
47
- When(:path) { router.capture_to_baseline("#{capture}/google.com/google.com>space>manager-900.png") }
48
- Then { path.should == "#{baseline}/google.com/google.com>space>manager-900.png" }
47
+ When(:path) { router.capture_to_baseline("#{capture}/google.com/google.com|space|manager-900.png") }
48
+ Then { path.should == "#{baseline}/google.com/google.com|space|manager-900.png" }
49
49
  end
50
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luke van der Hoeven