percy-cli 1.3.0 → 1.3.1

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: c733c7f086cb54277cdccea9768c4ea00640bab5
4
- data.tar.gz: 71cb84b3d65b2f57ffb82e9f3aa07c924f4373e3
3
+ metadata.gz: 312ef525da9b6c70354812c688f833e5f7262171
4
+ data.tar.gz: b5d596076601b60ac23df1bcac6af67b95d6a36d
5
5
  SHA512:
6
- metadata.gz: cf84886f1b1f8fa4cb7ba6151dbd0e57ec223a89868fd9a97ebb7afc0bfaaba5f4b816c2b185578849c60536af95d03baad280241b13f026a4f85e33f40d2780
7
- data.tar.gz: ff52d00ba138e5de32e505541dfd260fef882a65b0dc6eae954eee66c655f265fe5789a6accfa02a0e34d397d6d3fb0ee7a9f7341d83e9f27c4d91e23060d32b
6
+ metadata.gz: fd0f40f09e449bb77a497e5722621e801f46d7a68a4c1bd185948867040b665907ce93bef1768f9be5caf9328367c96fede88cf8eaca34621bb665235fafc1b7
7
+ data.tar.gz: 74be05cae89ec9546103e2b9b65bff5bacf731e5b3a90cc1b08f7a61a2cbf6dccd04724ea8aaf26b439bd4584d3e6cb604fc9e7e88fc6491d72979f0f30faec7
data/.rubocop.yml CHANGED
@@ -3,7 +3,7 @@ inherit_gem:
3
3
  - default.yml
4
4
 
5
5
  AllCops:
6
- TargetRubyVersion: 2.1
6
+ TargetRubyVersion: 2.2
7
7
 
8
8
  Style/GlobalVars:
9
9
  Exclude:
data/.travis.yml CHANGED
@@ -1,6 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1
4
3
  - 2.2
5
4
  - ruby-head
6
5
  before_install:
data/appveyor.yml CHANGED
@@ -1,8 +1,7 @@
1
- # Test on Ruby 2.2 and 2.1
1
+ # Test on Ruby 2.2
2
2
  environment:
3
3
  matrix:
4
4
  - RUBY_VERSION: 22
5
- - RUBY_VERSION: 21
6
5
 
7
6
  # Install scripts. (runs after repo cloning)
8
7
  install:
@@ -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
- num_threads = options[:threads] || 10
32
- snapshot_limit = options[:snapshot_limit]
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
- root_paths = _find_root_paths(root_dir, snapshots_regex: options[:snapshots_regex])
44
- opts = {include_all: include_all, ignore_regex: ignore_regex}
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)
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  class Cli
3
- VERSION = '1.3.0'.freeze
3
+ VERSION = '1.3.1'.freeze
4
4
  end
5
5
  end
@@ -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
- paths = runner._find_root_paths root_dir, ignore_regex: 'skip|ignore'
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
- spec/percy/cli/testdata/images/jellybeans.png
1
+ jellybeans.png
@@ -1 +1 @@
1
- spec/percy/cli/testdata/images/
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
- spec/percy/cli/testdata/subdir/test.html
1
+ test.html
@@ -1 +1 @@
1
- spec/percy/cli/testdata/subdir
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.0
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-01-31 00:00:00.000000000 Z
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.6.13
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