percy-cli 1.3.0 → 1.3.1
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/.rubocop.yml +1 -1
- data/.travis.yml +0 -1
- data/appveyor.yml +1 -2
- data/lib/percy/cli/snapshot_runner.rb +13 -6
- data/lib/percy/cli/version.rb +1 -1
- data/spec/percy/cli/snapshot_runner_spec.rb +22 -1
- data/spec/percy/cli/testdata/README.md +1 -0
- data/spec/percy/cli/testdata/images/jellybeans-symlink.png +1 -1
- data/spec/percy/cli/testdata/images_symlink +1 -1
- data/spec/percy/cli/testdata/index.xml +21 -0
- data/spec/percy/cli/testdata/subdir/test.xml +1 -0
- data/spec/percy/cli/testdata/subdir/test_symlink.html +1 -1
- data/spec/percy/cli/testdata/subdir_symlink +1 -1
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 312ef525da9b6c70354812c688f833e5f7262171
|
4
|
+
data.tar.gz: b5d596076601b60ac23df1bcac6af67b95d6a36d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd0f40f09e449bb77a497e5722621e801f46d7a68a4c1bd185948867040b665907ce93bef1768f9be5caf9328367c96fede88cf8eaca34621bb665235fafc1b7
|
7
|
+
data.tar.gz: 74be05cae89ec9546103e2b9b65bff5bacf731e5b3a90cc1b08f7a61a2cbf6dccd04724ea8aaf26b439bd4584d3e6cb604fc9e7e88fc6491d72979f0f30faec7
|
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/appveyor.yml
CHANGED
@@ -25,23 +25,30 @@ module Percy
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def run(root_dir, options = {})
|
28
|
-
repo = options[:repo] || Percy.config.repo
|
29
28
|
root_dir = File.expand_path(File.absolute_path(root_dir))
|
30
29
|
strip_prefix = File.expand_path(File.absolute_path(options[:strip_prefix] || root_dir))
|
31
|
-
|
32
|
-
|
33
|
-
baseurl = options[:baseurl] || '/'
|
30
|
+
|
31
|
+
# CLI Options
|
34
32
|
enable_javascript = !!options[:enable_javascript]
|
35
33
|
include_all = !!options[:include_all]
|
34
|
+
snapshot_limit = options[:snapshot_limit]
|
35
|
+
snapshots_regex = options[:snapshots_regex]
|
36
36
|
ignore_regex = options[:ignore_regex]
|
37
37
|
widths = options[:widths].map { |w| Integer(w) }
|
38
|
+
num_threads = options[:threads] || 10
|
39
|
+
repo = options[:repo] || Percy.config.repo
|
40
|
+
baseurl = options[:baseurl] || '/'
|
38
41
|
raise ArgumentError, 'baseurl must start with /' if baseurl[0] != '/'
|
39
42
|
|
40
43
|
base_resource_options = {strip_prefix: strip_prefix, baseurl: baseurl}
|
41
44
|
|
42
45
|
# Find all the static files in the given root directory.
|
43
|
-
|
44
|
-
|
46
|
+
opts = {
|
47
|
+
include_all: include_all,
|
48
|
+
ignore_regex: ignore_regex,
|
49
|
+
snapshots_regex: snapshots_regex,
|
50
|
+
}
|
51
|
+
root_paths = _find_root_paths(root_dir, opts)
|
45
52
|
resource_paths = _find_resource_paths(root_dir, opts)
|
46
53
|
root_resources = _list_resources(root_paths, base_resource_options.merge(is_root: true))
|
47
54
|
build_resources = _list_resources(resource_paths, base_resource_options)
|
data/lib/percy/cli/version.rb
CHANGED
@@ -99,8 +99,29 @@ RSpec.describe Percy::Cli::SnapshotRunner do
|
|
99
99
|
expect(paths).to match_array(expected_results)
|
100
100
|
end
|
101
101
|
|
102
|
+
it 'returns only the files matching the snapshots_regex' do
|
103
|
+
opts = {snapshots_regex: 'xml'}
|
104
|
+
paths = runner._find_root_paths(root_dir, opts)
|
105
|
+
|
106
|
+
expected_results = [
|
107
|
+
File.join(root_dir, 'index.xml'),
|
108
|
+
File.join(root_dir, 'subdir/test.xml'),
|
109
|
+
]
|
110
|
+
|
111
|
+
# Symlinked folders don't work out-of-the-box upon git clone on windows
|
112
|
+
unless Gem.win_platform?
|
113
|
+
expected_results += [
|
114
|
+
# Make sure directory symlinks are followed.
|
115
|
+
File.join(root_dir, 'subdir_symlink/test.xml'),
|
116
|
+
]
|
117
|
+
end
|
118
|
+
|
119
|
+
expect(paths).to match_array(expected_results)
|
120
|
+
end
|
121
|
+
|
102
122
|
it 'skips files passed into the ignore_regex option' do
|
103
|
-
|
123
|
+
opts = {ignore_regex: 'skip|ignore'}
|
124
|
+
paths = runner._find_root_paths(root_dir, opts)
|
104
125
|
|
105
126
|
expected_results = [
|
106
127
|
File.join(root_dir, 'index.html'),
|
@@ -0,0 +1 @@
|
|
1
|
+
### This is a readme
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
jellybeans.png
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
images/
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<title>Test Percy CLI</title>
|
4
|
+
<link href="css/base.css" rel="stylesheet" type="text/css">
|
5
|
+
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css">
|
6
|
+
<link href="//example.com:12345/test-no-protocol.css" rel="stylesheet" type="text/css">
|
7
|
+
<link href='http://example.com:12345/test-single-quotes.css' rel="stylesheet" type="text/css">
|
8
|
+
<link href="http://example.com:12345/test-query-param.css?v=1" rel="stylesheet" type="text/css">
|
9
|
+
|
10
|
+
<link href="http://example.com:12345/test-duplicate.css" rel="stylesheet" type="text/css">
|
11
|
+
<link href="http://example.com:12345/test-duplicate.css" rel="stylesheet" type="text/css">
|
12
|
+
|
13
|
+
<link rel="stylesheet" type="text/css" href="http://example.com:12345/test-diff-tag-order.css">
|
14
|
+
|
15
|
+
<link rel="author" href="https://example.com/should-not-be-included"/>
|
16
|
+
|
17
|
+
<h1>Hello World!</h1>
|
18
|
+
|
19
|
+
Just some text, should not be included:
|
20
|
+
http://example.com/should-not-be-included.css
|
21
|
+
</html>
|
@@ -0,0 +1 @@
|
|
1
|
+
<!DOCTYPE html><html>Hello World!</html>
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
test.html
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
subdir
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percy-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perceptual Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -160,6 +160,7 @@ files:
|
|
160
160
|
- lib/percy/cli/version.rb
|
161
161
|
- percy-cli.gemspec
|
162
162
|
- spec/percy/cli/snapshot_runner_spec.rb
|
163
|
+
- spec/percy/cli/testdata/README.md
|
163
164
|
- spec/percy/cli/testdata/css/base.css
|
164
165
|
- spec/percy/cli/testdata/css/test with spaces.css
|
165
166
|
- spec/percy/cli/testdata/css/unrelated-no-extension
|
@@ -169,8 +170,10 @@ files:
|
|
169
170
|
- spec/percy/cli/testdata/images/large-file-skipped.png
|
170
171
|
- spec/percy/cli/testdata/images_symlink
|
171
172
|
- spec/percy/cli/testdata/index.html
|
173
|
+
- spec/percy/cli/testdata/index.xml
|
172
174
|
- spec/percy/cli/testdata/skip.html
|
173
175
|
- spec/percy/cli/testdata/subdir/test.html
|
176
|
+
- spec/percy/cli/testdata/subdir/test.xml
|
174
177
|
- spec/percy/cli/testdata/subdir/test_symlink.html
|
175
178
|
- spec/percy/cli/testdata/subdir_symlink
|
176
179
|
- spec/spec_helper.rb
|
@@ -194,12 +197,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
197
|
version: '0'
|
195
198
|
requirements: []
|
196
199
|
rubyforge_project:
|
197
|
-
rubygems_version: 2.
|
200
|
+
rubygems_version: 2.5.2
|
198
201
|
signing_key:
|
199
202
|
specification_version: 4
|
200
203
|
summary: Percy command-line interface
|
201
204
|
test_files:
|
202
205
|
- spec/percy/cli/snapshot_runner_spec.rb
|
206
|
+
- spec/percy/cli/testdata/README.md
|
203
207
|
- spec/percy/cli/testdata/css/base.css
|
204
208
|
- spec/percy/cli/testdata/css/test with spaces.css
|
205
209
|
- spec/percy/cli/testdata/css/unrelated-no-extension
|
@@ -209,8 +213,10 @@ test_files:
|
|
209
213
|
- spec/percy/cli/testdata/images/large-file-skipped.png
|
210
214
|
- spec/percy/cli/testdata/images_symlink
|
211
215
|
- spec/percy/cli/testdata/index.html
|
216
|
+
- spec/percy/cli/testdata/index.xml
|
212
217
|
- spec/percy/cli/testdata/skip.html
|
213
218
|
- spec/percy/cli/testdata/subdir/test.html
|
219
|
+
- spec/percy/cli/testdata/subdir/test.xml
|
214
220
|
- spec/percy/cli/testdata/subdir/test_symlink.html
|
215
221
|
- spec/percy/cli/testdata/subdir_symlink
|
216
222
|
- spec/spec_helper.rb
|