percy-common 3.0.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +4 -0
- data/lib/percy/common/version.rb +1 -1
- data/lib/percy/logger.rb +1 -0
- data/lib/percy/redis_client.rb +80 -0
- data/percy-common.gemspec +10 -8
- metadata +32 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe94763bb303e12d788d293e1b2a1947fccfb61a1334a04c71179f99590ab639
|
4
|
+
data.tar.gz: 113a9533d5286c9753d21df7d631b2f6c64601680cd698db5600503d9e638c23
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ea47390164289c6a3402ce8f108f19ba698a69d1b2fb50dcaa58d12961ab10c18a74e1d54ed47e268a827b9851986136766ab436397b5bf475d690631a65f09
|
7
|
+
data.tar.gz: 1ae7c46e24ff481bb6d986d0cdfdca18450c27b350cb89d0938cd54101f4fc8f8edcd518220b64339edbb14b9846beb7390bffab59f2c94100350614ca736f24
|
data/.rubocop.yml
CHANGED
data/lib/percy/common/version.rb
CHANGED
data/lib/percy/logger.rb
CHANGED
@@ -0,0 +1,80 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'redis'
|
4
|
+
|
5
|
+
module Percy
|
6
|
+
class RedisClient
|
7
|
+
attr_reader :options
|
8
|
+
attr_reader :client
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
@options = options
|
12
|
+
@client = ::Redis.new(
|
13
|
+
options.merge(
|
14
|
+
ssl: ssl_enabled?,
|
15
|
+
ssl_params: ssl_params,
|
16
|
+
),
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
private def ssl_enabled?
|
21
|
+
provided_url.to_s.start_with?('rediss://')
|
22
|
+
end
|
23
|
+
|
24
|
+
private def provided_url
|
25
|
+
options.dig(:url)
|
26
|
+
end
|
27
|
+
|
28
|
+
private def ssl_params
|
29
|
+
return {} unless ssl_enabled?
|
30
|
+
|
31
|
+
{
|
32
|
+
ca_file: certificate_authority_file,
|
33
|
+
cert: OpenSSL::X509::Certificate.new(client_certificate),
|
34
|
+
key: OpenSSL::PKey::RSA.new(private_key),
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
private def client_certificate
|
39
|
+
ENV.fetch(
|
40
|
+
'REDIS_SSL_CLIENT_CERTIFICATE',
|
41
|
+
File.read(client_certificate_path),
|
42
|
+
)
|
43
|
+
end
|
44
|
+
|
45
|
+
private def client_certificate_path
|
46
|
+
ENV.fetch(
|
47
|
+
'REDIS_SSL_CLIENT_CERTIFICATE_PATH',
|
48
|
+
File.join(cert_path, 'user.crt'),
|
49
|
+
)
|
50
|
+
end
|
51
|
+
|
52
|
+
private def private_key
|
53
|
+
ENV.fetch(
|
54
|
+
'REDIS_SSL_PRIVATE_KEY',
|
55
|
+
File.read(private_key_path),
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
private def private_key_path
|
60
|
+
ENV.fetch(
|
61
|
+
'REDIS_SSL_PRIVATE_KEY_PATH',
|
62
|
+
File.join(cert_path, 'user_private.key'),
|
63
|
+
)
|
64
|
+
end
|
65
|
+
|
66
|
+
private def certificate_authority_file
|
67
|
+
ENV.fetch(
|
68
|
+
'REDIS_SSL_CERTIFICATE_AUTHORITY_PATH',
|
69
|
+
File.join(cert_path, 'server_ca.pem'),
|
70
|
+
)
|
71
|
+
end
|
72
|
+
|
73
|
+
private def cert_path
|
74
|
+
ENV.fetch(
|
75
|
+
'REDIS_SSL_CERTIFICATE_PATH',
|
76
|
+
File.expand_path('../../redis', __dir__),
|
77
|
+
)
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/percy-common.gemspec
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
1
|
+
lib = File.expand_path('lib', __dir__)
|
3
2
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
3
|
require 'percy/common/version'
|
5
4
|
|
@@ -9,19 +8,22 @@ Gem::Specification.new do |spec|
|
|
9
8
|
spec.authors = ['Perceptual Inc.']
|
10
9
|
spec.email = ['team@percy.io']
|
11
10
|
|
12
|
-
spec.summary =
|
13
|
-
spec.description =
|
11
|
+
spec.summary = 'Server-side common library for Percy.'
|
12
|
+
spec.description = ''
|
14
13
|
spec.homepage = ''
|
15
14
|
|
16
|
-
spec.files = `git ls-files -z`.split("\x0").reject
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
+
f.match(/^(test|spec|features)\//)
|
17
|
+
end
|
17
18
|
spec.require_paths = ['lib']
|
18
19
|
|
19
20
|
spec.add_dependency 'dogstatsd-ruby', '~> 4.4.0'
|
20
21
|
spec.add_dependency 'excon', '~> 0.57'
|
22
|
+
spec.add_dependency 'redis', '~> 4.1.3'
|
21
23
|
|
22
|
-
spec.add_development_dependency 'bundler', '~> 2.
|
23
|
-
spec.add_development_dependency 'rake', '~> 12.3'
|
24
|
-
spec.add_development_dependency 'rspec', '~> 3.2'
|
24
|
+
spec.add_development_dependency 'bundler', '~> 2.1.4'
|
25
25
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
26
26
|
spec.add_development_dependency 'percy-style', '~> 0.6.0'
|
27
|
+
spec.add_development_dependency 'rake', '~> 12.3'
|
28
|
+
spec.add_development_dependency 'rspec', '~> 3.2'
|
27
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: percy-common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.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: 2020-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dogstatsd-ruby
|
@@ -38,76 +38,90 @@ dependencies:
|
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.57'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: redis
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 4.1.3
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 4.1.3
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: bundler
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
59
|
- - "~>"
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version: 2.
|
61
|
+
version: 2.1.4
|
48
62
|
type: :development
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
66
|
- - "~>"
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version: 2.
|
68
|
+
version: 2.1.4
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
70
|
+
name: guard-rspec
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
73
|
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
|
-
version: '
|
75
|
+
version: '4.7'
|
62
76
|
type: :development
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
80
|
- - "~>"
|
67
81
|
- !ruby/object:Gem::Version
|
68
|
-
version: '
|
82
|
+
version: '4.7'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
84
|
+
name: percy-style
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - "~>"
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 0.6.0
|
76
90
|
type: :development
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
94
|
- - "~>"
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 0.6.0
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: rake
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - "~>"
|
88
102
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
103
|
+
version: '12.3'
|
90
104
|
type: :development
|
91
105
|
prerelease: false
|
92
106
|
version_requirements: !ruby/object:Gem::Requirement
|
93
107
|
requirements:
|
94
108
|
- - "~>"
|
95
109
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
110
|
+
version: '12.3'
|
97
111
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
112
|
+
name: rspec
|
99
113
|
requirement: !ruby/object:Gem::Requirement
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
103
|
-
version:
|
117
|
+
version: '3.2'
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
107
121
|
requirements:
|
108
122
|
- - "~>"
|
109
123
|
- !ruby/object:Gem::Version
|
110
|
-
version:
|
124
|
+
version: '3.2'
|
111
125
|
description: ''
|
112
126
|
email:
|
113
127
|
- team@percy.io
|
@@ -132,6 +146,7 @@ files:
|
|
132
146
|
- lib/percy/logger.rb
|
133
147
|
- lib/percy/network_helpers.rb
|
134
148
|
- lib/percy/process_helpers.rb
|
149
|
+
- lib/percy/redis_client.rb
|
135
150
|
- lib/percy/stats.rb
|
136
151
|
- percy-common.gemspec
|
137
152
|
homepage: ''
|
@@ -152,7 +167,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
152
167
|
- !ruby/object:Gem::Version
|
153
168
|
version: '0'
|
154
169
|
requirements: []
|
155
|
-
rubygems_version: 3.
|
170
|
+
rubygems_version: 3.1.2
|
156
171
|
signing_key:
|
157
172
|
specification_version: 4
|
158
173
|
summary: Server-side common library for Percy.
|