percy-common 3.1.1 → 3.1.2.pre.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +2 -0
- data/.rubocop_todo.yml +12 -0
- data/RELEASING.md +7 -10
- data/lib/percy/common/version.rb +1 -1
- data/lib/percy/redis_client.rb +52 -33
- data/percy-common.gemspec +2 -2
- data/release.sh +67 -0
- metadata +16 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3bea1ecf4c83e6c7fcecd90d078bbe01bfde6debbc1db7285e4121f19188f270
|
4
|
+
data.tar.gz: 132308ac502faea1f7f03e3813b9b94f774ab69cb09f0970cabc1517bc23d1ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e1ba4265af5f0a0a3735ec0c04d97e631d7f70ded3d932b44116b742fecceffec1e9cc3e247b0fb2c29007392ce2e3db011f8649ac2f9ce321e9496e7282706
|
7
|
+
data.tar.gz: 6d0efe97aeacf862f9043acf666996089b4677f86acc21cf1ebafa7295e249805e2c809eabe9cf5382b9b072a7f4ce49c89f0483d3bc7635957da66bb3f8b26b
|
data/.rubocop.yml
CHANGED
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2020-04-30 16:00:36 -0700 using RuboCop version 0.77.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
RSpec/LeakyConstantDeclaration:
|
11
|
+
Exclude:
|
12
|
+
- 'spec/percy/keyword_struct_spec.rb'
|
data/RELEASING.md
CHANGED
@@ -1,16 +1,13 @@
|
|
1
1
|
# Releasing
|
2
2
|
|
3
|
-
1.
|
4
|
-
1.
|
5
|
-
1. `git add lib/percy/common/version.rb`
|
6
|
-
1. `git commit -m "version bump to X.X.X"`
|
7
|
-
1. `git push origin master`
|
8
|
-
1. `git tag vX.X.X`
|
9
|
-
1. `git push --tags`
|
10
|
-
1. `bundle exec rake build`
|
11
|
-
1. `gem push pkg/percy-common-X.X.X.gem`
|
3
|
+
1. Ensure you are on the expected branch (presumably `master`) and the current branch is up-to-date.
|
4
|
+
1. Run `./release.sh`
|
12
5
|
1. Visit [RubyGems.org](https://rubygems.org/gems/percy-common) and see the gem has been published
|
13
|
-
|
6
|
+
|
7
|
+
# Creating a Release on GitHub
|
8
|
+
|
9
|
+
Finish the pre-started release opened by the script, or [create a new release](https://github.com/percy/percy-common/releases/new):
|
10
|
+
|
14
11
|
1. Enter "vX.X.X" as the tag version. It should auto complete to say "Existing Tag"
|
15
12
|
1. Enter "vX.X.X" as the release title
|
16
13
|
1. Write a brief description as to what is included in this release. Linking to specific PRs is great.
|
data/lib/percy/common/version.rb
CHANGED
data/lib/percy/redis_client.rb
CHANGED
@@ -4,11 +4,14 @@ require 'redis'
|
|
4
4
|
|
5
5
|
module Percy
|
6
6
|
class RedisClient
|
7
|
-
|
7
|
+
class InvalidConfiguration < ArgumentError
|
8
|
+
end
|
8
9
|
attr_reader :client
|
10
|
+
attr_reader :options
|
9
11
|
|
10
|
-
def initialize(
|
11
|
-
@
|
12
|
+
def initialize(given_options = {})
|
13
|
+
@provided_options = given_options
|
14
|
+
@options = ssl_options.merge(given_options)
|
12
15
|
@client = ::Redis.new(options)
|
13
16
|
end
|
14
17
|
|
@@ -17,7 +20,7 @@ module Percy
|
|
17
20
|
end
|
18
21
|
|
19
22
|
private def provided_url
|
20
|
-
|
23
|
+
@provided_options&.dig(:url)
|
21
24
|
end
|
22
25
|
|
23
26
|
private def ssl_options
|
@@ -31,52 +34,68 @@ module Percy
|
|
31
34
|
return {} unless ssl_enabled?
|
32
35
|
|
33
36
|
{
|
34
|
-
ca_file:
|
37
|
+
ca_file: certificate_authority,
|
35
38
|
cert: OpenSSL::X509::Certificate.new(client_certificate),
|
36
39
|
key: OpenSSL::PKey::RSA.new(private_key),
|
37
40
|
}
|
38
41
|
end
|
39
42
|
|
40
43
|
private def client_certificate
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
44
|
+
@provided_options&.dig(:ssl_params, :cert) ||
|
45
|
+
client_certificate_from_env ||
|
46
|
+
client_certificate_from_path
|
47
|
+
end
|
48
|
+
|
49
|
+
private def client_certificate_from_env
|
50
|
+
ENV['REDIS_SSL_CLIENT_CERTIFICATE']
|
45
51
|
end
|
46
52
|
|
47
|
-
private def
|
48
|
-
|
49
|
-
'REDIS_SSL_CLIENT_CERTIFICATE_PATH',
|
50
|
-
File.join(cert_path, 'user.crt'),
|
51
|
-
)
|
53
|
+
private def client_certificate_from_path
|
54
|
+
File.read(fetch_key('REDIS_SSL_CLIENT_CERTIFICATE_PATH'))
|
52
55
|
end
|
53
56
|
|
54
57
|
private def private_key
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
58
|
+
provided_private_key ||
|
59
|
+
private_key_from_env ||
|
60
|
+
private_key_from_path
|
61
|
+
end
|
62
|
+
|
63
|
+
private def provided_private_key
|
64
|
+
@provided_options&.dig(:ssl_params, :key)
|
65
|
+
end
|
66
|
+
|
67
|
+
private def private_key_from_env
|
68
|
+
ENV['REDIS_SSL_PRIVATE_KEY']
|
69
|
+
end
|
70
|
+
|
71
|
+
private def private_key_from_path
|
72
|
+
File.read(fetch_key('REDIS_SSL_PRIVATE_KEY_PATH'))
|
73
|
+
end
|
74
|
+
|
75
|
+
private def certificate_authority
|
76
|
+
provided_certificate_authority ||
|
77
|
+
certificate_authority_from_env ||
|
78
|
+
certificate_authority_from_path
|
79
|
+
end
|
80
|
+
|
81
|
+
private def provided_certificate_authority
|
82
|
+
@provided_options&.dig(:ssl_params, :ca_file)
|
83
|
+
end
|
84
|
+
|
85
|
+
private def certificate_authority_from_env
|
86
|
+
ENV['REDIS_SSL_CERTIFICATE_AUTHORITY']
|
59
87
|
end
|
60
88
|
|
61
|
-
private def
|
62
|
-
|
63
|
-
'REDIS_SSL_PRIVATE_KEY_PATH',
|
64
|
-
File.join(cert_path, 'user_private.key'),
|
65
|
-
)
|
89
|
+
private def certificate_authority_from_path
|
90
|
+
File.read(fetch_key('REDIS_SSL_CERTIFICATE_AUTHORITY_PATH'))
|
66
91
|
end
|
67
92
|
|
68
|
-
private def
|
69
|
-
ENV.fetch(
|
70
|
-
'REDIS_SSL_CERTIFICATE_AUTHORITY_PATH',
|
71
|
-
File.join(cert_path, 'server_ca.pem'),
|
72
|
-
)
|
93
|
+
private def fetch_key(key)
|
94
|
+
ENV.fetch(key) { missing_key(key) }
|
73
95
|
end
|
74
96
|
|
75
|
-
private def
|
76
|
-
|
77
|
-
'REDIS_SSL_CERTIFICATE_PATH',
|
78
|
-
File.expand_path('../../redis', __dir__),
|
79
|
-
)
|
97
|
+
private def missing_key(key)
|
98
|
+
raise InvalidConfiguration, "#{key} is not defined"
|
80
99
|
end
|
81
100
|
end
|
82
101
|
end
|
data/percy-common.gemspec
CHANGED
@@ -19,11 +19,11 @@ Gem::Specification.new do |spec|
|
|
19
19
|
|
20
20
|
spec.add_dependency 'dogstatsd-ruby', '~> 4.4.0'
|
21
21
|
spec.add_dependency 'excon', '~> 0.57'
|
22
|
-
spec.add_dependency 'redis', '
|
22
|
+
spec.add_dependency 'redis', '>= 4.1.3', '< 5.0.0'
|
23
23
|
|
24
24
|
spec.add_development_dependency 'bundler', '~> 2.1.4'
|
25
25
|
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
26
|
-
spec.add_development_dependency 'percy-style', '~> 0.
|
26
|
+
spec.add_development_dependency 'percy-style', '~> 0.7.0'
|
27
27
|
spec.add_development_dependency 'rake', '~> 12.3'
|
28
28
|
spec.add_development_dependency 'rspec', '~> 3.2'
|
29
29
|
end
|
data/release.sh
ADDED
@@ -0,0 +1,67 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
cd "$(dirname "$0")" || exit 1
|
6
|
+
CURDIR="$(pwd)"
|
7
|
+
|
8
|
+
PERCY_COMMON_VERSION="$(grep "VERSION" lib/percy/common/version.rb | awk -F "'" '{print $2}')"
|
9
|
+
|
10
|
+
echo "Current percy-common version: $PERCY_COMMON_VERSION"
|
11
|
+
|
12
|
+
if [[ $# -lt 1 ]]; then
|
13
|
+
echo "Usage $0 <version>"
|
14
|
+
exit 1
|
15
|
+
fi
|
16
|
+
|
17
|
+
rm "$CURDIR/"percy-common*.gem >/dev/null 2>&1 || true
|
18
|
+
|
19
|
+
delete_existing_version() {
|
20
|
+
git tag -d "v$1" || true
|
21
|
+
git push origin ":v$1" || true
|
22
|
+
gem yank percy-common -v "$1" || true
|
23
|
+
}
|
24
|
+
|
25
|
+
if [[ $1 =~ ^.*delete$ ]]; then
|
26
|
+
shift
|
27
|
+
echo "Preparing to delete $1"
|
28
|
+
sleep 3
|
29
|
+
delete_existing_version "$PERCY_COMMON_VERSION"
|
30
|
+
else
|
31
|
+
CLEAN=$(
|
32
|
+
git diff-index --quiet HEAD --
|
33
|
+
echo $?
|
34
|
+
)
|
35
|
+
if [[ "$CLEAN" == "0" ]]; then
|
36
|
+
if [[ $1 == '--force' ]]; then
|
37
|
+
shift
|
38
|
+
if [[ -n $1 ]]; then
|
39
|
+
echo "Deleting version $1"
|
40
|
+
sleep 1
|
41
|
+
delete_existing_version "$1"
|
42
|
+
else
|
43
|
+
echo "Missing release version"
|
44
|
+
exit 1
|
45
|
+
fi
|
46
|
+
fi
|
47
|
+
VERSION=$1
|
48
|
+
echo "Releasing $VERSION"
|
49
|
+
sleep 1
|
50
|
+
|
51
|
+
sed -i "" -e "s/$PERCY_COMMON_VERSION/$VERSION/g" "lib/percy/common/version.rb"
|
52
|
+
git add "lib/percy/common/version.rb"
|
53
|
+
git commit -a -m "Release $VERSION" || true
|
54
|
+
|
55
|
+
git tag -a "v$VERSION" -m "$1" || true
|
56
|
+
git push origin "v$VERSION" || true
|
57
|
+
|
58
|
+
bundle exec rake build
|
59
|
+
gem push "$CURDIR/pkg/percy-common-"*.gem
|
60
|
+
open "https://github.com/percy/percy-common/releases/new?tag=v$VERSION&title=$VERSION"
|
61
|
+
rm "$CURDIR/pkg/percy-common-"*.gem
|
62
|
+
else
|
63
|
+
echo "Please commit your changes and try again"
|
64
|
+
exit 1
|
65
|
+
fi
|
66
|
+
fi
|
67
|
+
echo "Done"
|
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.1.
|
4
|
+
version: 3.1.2.pre.rc.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Perceptual Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dogstatsd-ruby
|
@@ -42,16 +42,22 @@ dependencies:
|
|
42
42
|
name: redis
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 4.1.3
|
48
|
+
- - "<"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: 5.0.0
|
48
51
|
type: :runtime
|
49
52
|
prerelease: false
|
50
53
|
version_requirements: !ruby/object:Gem::Requirement
|
51
54
|
requirements:
|
52
|
-
- - "
|
55
|
+
- - ">="
|
53
56
|
- !ruby/object:Gem::Version
|
54
57
|
version: 4.1.3
|
58
|
+
- - "<"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 5.0.0
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: bundler
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +92,14 @@ dependencies:
|
|
86
92
|
requirements:
|
87
93
|
- - "~>"
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
95
|
+
version: 0.7.0
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
100
|
- - "~>"
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
102
|
+
version: 0.7.0
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
104
|
name: rake
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,6 +139,7 @@ files:
|
|
133
139
|
- ".gitignore"
|
134
140
|
- ".rspec"
|
135
141
|
- ".rubocop.yml"
|
142
|
+
- ".rubocop_todo.yml"
|
136
143
|
- Gemfile
|
137
144
|
- Guardfile
|
138
145
|
- LICENSE
|
@@ -149,6 +156,7 @@ files:
|
|
149
156
|
- lib/percy/redis_client.rb
|
150
157
|
- lib/percy/stats.rb
|
151
158
|
- percy-common.gemspec
|
159
|
+
- release.sh
|
152
160
|
homepage: ''
|
153
161
|
licenses: []
|
154
162
|
metadata: {}
|
@@ -163,9 +171,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
163
171
|
version: '0'
|
164
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
165
173
|
requirements:
|
166
|
-
- - "
|
174
|
+
- - ">"
|
167
175
|
- !ruby/object:Gem::Version
|
168
|
-
version:
|
176
|
+
version: 1.3.1
|
169
177
|
requirements: []
|
170
178
|
rubygems_version: 3.1.2
|
171
179
|
signing_key:
|