percy-cli 1.1.0 → 1.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 +4 -4
- data/Gemfile +2 -0
- data/lib/percy/cli/snapshot.rb +5 -2
- data/lib/percy/cli/version.rb +1 -1
- data/lib/percy/cli.rb +5 -0
- data/percy-cli.gemspec +1 -1
- data/spec/percy/cli/snapshot_spec.rb +9 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bc326770317a74d216e80e1726103293eac8e96
|
4
|
+
data.tar.gz: 2a879c017a9f1c5dc87a2dc6544a0bec9ea9a226
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 774bbb59c78d30e63e110cf3707deddb753f4af042ae8ffa1717b159438d8f5527a8ba4a6e3ad8762ec577eaa4c45463444abc7dc569f272d802b5c739e87261
|
7
|
+
data.tar.gz: a24e6258533ecd62f33cbe19028faa117d9ebb0b2399a98f3d838253a9817876f7c9b01816e45d2811cb0e3adf17f71a8bbc7ef29f9d7bd299ad36237102e585
|
data/Gemfile
CHANGED
data/lib/percy/cli/snapshot.rb
CHANGED
@@ -24,6 +24,7 @@ module Percy
|
|
24
24
|
snapshot_limit = options[:snapshot_limit]
|
25
25
|
baseurl = options[:baseurl] || '/'
|
26
26
|
enable_javascript = !!options[:enable_javascript]
|
27
|
+
widths = options[:widths].map { |w| Integer(w) }
|
27
28
|
raise ArgumentError.new('baseurl must start with /') if baseurl[0] != '/'
|
28
29
|
|
29
30
|
base_resource_options = {strip_prefix: strip_prefix, baseurl: baseurl}
|
@@ -66,6 +67,7 @@ module Percy
|
|
66
67
|
build['data']['id'],
|
67
68
|
[root_resource],
|
68
69
|
enable_javascript: enable_javascript,
|
70
|
+
widths: widths,
|
69
71
|
)
|
70
72
|
upload_missing_resources(build, snapshot, all_resources, {num_threads: num_threads})
|
71
73
|
Percy.finalize_snapshot(snapshot['data']['id'])
|
@@ -93,8 +95,9 @@ module Percy
|
|
93
95
|
raise ArgumentError.new('block is requried') if !block_given?
|
94
96
|
begin
|
95
97
|
block.call
|
96
|
-
rescue Percy::Client::
|
97
|
-
Percy::Client::
|
98
|
+
rescue Percy::Client::ServerError, # Rescue server errors.
|
99
|
+
Percy::Client::PaymentRequiredError, # Rescue quota exceeded errors.
|
100
|
+
Percy::Client::ConnectionFailed, # Rescue some networking errors.
|
98
101
|
Percy::Client::TimeoutError => e
|
99
102
|
Percy.logger.error(e)
|
100
103
|
@failed = true
|
data/lib/percy/cli/version.rb
CHANGED
data/lib/percy/cli.rb
CHANGED
@@ -47,6 +47,10 @@ module Percy
|
|
47
47
|
'--snapshots_regex REGEX',
|
48
48
|
String,
|
49
49
|
'Regular expression for matching the files to snapshot. Defaults to: "\.(html|htm)$"'
|
50
|
+
c.option \
|
51
|
+
'--widths CSV',
|
52
|
+
String,
|
53
|
+
'Comma-separated list of rendering widths for snapshots. Ex: 320,1280"'
|
50
54
|
c.option \
|
51
55
|
'--snapshot_limit NUM',
|
52
56
|
Integer,
|
@@ -64,6 +68,7 @@ module Percy
|
|
64
68
|
options.default threads: DEFAULT_NUM_THREADS
|
65
69
|
options.threads = MAX_NUM_THREADS if options.threads > MAX_NUM_THREADS
|
66
70
|
options.enable_javascript = options.enable_javascript
|
71
|
+
options.widths = (options.widths || '').split(',')
|
67
72
|
|
68
73
|
raise OptionParser::MissingArgument, 'root folder path is required' if args.empty?
|
69
74
|
if args.length > 1
|
data/percy-cli.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
21
|
spec.add_dependency 'commander', '~> 4.3'
|
22
|
-
spec.add_dependency 'percy-client', '
|
22
|
+
spec.add_dependency 'percy-client', '~> 1.4'
|
23
23
|
spec.add_dependency 'thread', '~> 0.2'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 1.7'
|
@@ -17,9 +17,16 @@ RSpec.describe Percy::Cli::Snapshot do
|
|
17
17
|
expect(result).to eq(true)
|
18
18
|
expect(cli.send(:failed?)).to eq(false)
|
19
19
|
end
|
20
|
-
it 'makes block safe from
|
20
|
+
it 'makes block safe from quota exceeded errors' do
|
21
21
|
result = cli.send(:rescue_connection_failures) do
|
22
|
-
raise Percy::Client::
|
22
|
+
raise Percy::Client::PaymentRequiredError.new(409, 'POST', '', '')
|
23
|
+
end
|
24
|
+
expect(result).to eq(nil)
|
25
|
+
expect(cli.send(:failed?)).to eq(true)
|
26
|
+
end
|
27
|
+
it 'makes block safe from server errors' do
|
28
|
+
result = cli.send(:rescue_connection_failures) do
|
29
|
+
raise Percy::Client::ServerError.new(502, 'POST', '', '')
|
23
30
|
end
|
24
31
|
expect(result).to eq(nil)
|
25
32
|
expect(cli.send(:failed?)).to eq(true)
|
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.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perceptual Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-02-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: percy-client
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: '1.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: '1.4'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: thread
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|