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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a36d99fd5b06fe4959e00e8f13b9bbf1f7d356832c2a56f42e1f177f285b11d
4
- data.tar.gz: a9ce522b6a66d1d96527cbdb774b1fd5dc92738d0c9953cb29ea4371de0bbc04
3
+ metadata.gz: 3bea1ecf4c83e6c7fcecd90d078bbe01bfde6debbc1db7285e4121f19188f270
4
+ data.tar.gz: 132308ac502faea1f7f03e3813b9b94f774ab69cb09f0970cabc1517bc23d1ca
5
5
  SHA512:
6
- metadata.gz: 3e18a43f607a28a9b6f450470bf7e0bb9c2acaf266cd134ecd499f8da3a9d37fc4f52b6fd8f550d08c8fea2cef83497948935d8025b23756c1cfba2b2dcac08d
7
- data.tar.gz: '0062099d255d3cc75ddf646a939c72b7a82dd77c2da97289134e6d9240e9628603c5d0dd14dfde8d461f76d5dcf389b67295e91bb1d6588325de0f3de9d4331a'
6
+ metadata.gz: 8e1ba4265af5f0a0a3735ec0c04d97e631d7f70ded3d932b44116b742fecceffec1e9cc3e247b0fb2c29007392ce2e3db011f8649ac2f9ce321e9496e7282706
7
+ data.tar.gz: 6d0efe97aeacf862f9043acf666996089b4677f86acc21cf1ebafa7295e249805e2c809eabe9cf5382b9b072a7f4ce49c89f0483d3bc7635957da66bb3f8b26b
@@ -1,3 +1,5 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
1
3
  inherit_gem:
2
4
  percy-style:
3
5
  - default.yml
@@ -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'
@@ -1,16 +1,13 @@
1
1
  # Releasing
2
2
 
3
- 1. `git pull origin master`
4
- 1. Bump the version number in `lib/percy/common/version.rb`
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
- 1. Document the release on Github by first [creating a new release](https://github.com/percy/percy-common/releases/new)
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.
@@ -1,5 +1,5 @@
1
1
  module Percy
2
2
  module Common
3
- VERSION = '3.1.1'.freeze
3
+ VERSION = '3.1.2-rc.2'.freeze
4
4
  end
5
5
  end
@@ -4,11 +4,14 @@ require 'redis'
4
4
 
5
5
  module Percy
6
6
  class RedisClient
7
- attr_reader :options
7
+ class InvalidConfiguration < ArgumentError
8
+ end
8
9
  attr_reader :client
10
+ attr_reader :options
9
11
 
10
- def initialize(options = {})
11
- @options = ssl_options.merge(options)
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
- options&.dig(:url)
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: certificate_authority_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
- ENV.fetch(
42
- 'REDIS_SSL_CLIENT_CERTIFICATE',
43
- File.read(client_certificate_path),
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 client_certificate_path
48
- ENV.fetch(
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
- ENV.fetch(
56
- 'REDIS_SSL_PRIVATE_KEY',
57
- File.read(private_key_path),
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 private_key_path
62
- ENV.fetch(
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 certificate_authority_file
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 cert_path
76
- ENV.fetch(
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
@@ -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', '~> 4.1.3'
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.6.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
@@ -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.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-05-07 00:00:00.000000000 Z
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.6.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.6.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: '0'
176
+ version: 1.3.1
169
177
  requirements: []
170
178
  rubygems_version: 3.1.2
171
179
  signing_key: