monet 0.2.1 → 0.2.2
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 +4 -4
- data/.travis.yml +1 -0
- data/README.md +35 -4
- data/lib/monet.rb +4 -0
- data/lib/monet/path_router.rb +2 -2
- data/lib/monet/tasks.rb +9 -4
- data/lib/monet/version.rb +1 -1
- data/spec/capture_spec.rb +4 -4
- data/spec/path_router_spec.rb +7 -7
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd82504151954e9dec64d70da527bf9d6973b2aa
|
4
|
+
data.tar.gz: 67a18681fd090836de4c7d4285afbd8e59c1b67e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ec8e7217fedd9b53d186da3ec9b06e2b6d0be26db4b7cabe5365a8d5779e5c03ae517e571cee12f8e951a6e4d63fb92fdadcf63e5d8374c1202b8a798082b5a
|
7
|
+
data.tar.gz: 7baca87ebf4ec4e08e5575cdfcd0cebe26eaca652adbfdf9b6ad81a476ffe94857d2286283f1ddb0d9a8ad7a93da9d41b1d2a4bdcac76623294a5a17c4ad60fd
|
data/.travis.yml
CHANGED
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
|
data/lib/monet.rb
CHANGED
data/lib/monet/path_router.rb
CHANGED
@@ -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('
|
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
|
|
data/lib/monet/tasks.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
require 'monet'
|
2
2
|
|
3
3
|
namespace :monet do
|
4
|
-
|
5
|
-
|
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
|
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
|
data/lib/monet/version.rb
CHANGED
data/spec/capture_spec.rb
CHANGED
@@ -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
|
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
|
42
|
-
Then { File.exist?("#{path}/google.com/google.com
|
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
|
48
|
+
Then { File.exist?("#{path}/www.facebook.com/www.facebook.com|-1024.png").should be_true }
|
49
49
|
end
|
50
50
|
|
51
51
|
end
|
data/spec/path_router_spec.rb
CHANGED
@@ -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
|
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
|
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
|
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
|
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
|
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
|
48
|
-
Then { path.should == "#{baseline}/google.com/google.com
|
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
|