savvy 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 28fa85fba714b4b39fd3723a0e82d9e9f8cc738f
4
- data.tar.gz: 62d432c2a84b8b971f22470e8e31b22956e712d1
2
+ SHA256:
3
+ metadata.gz: 6e10383bf235f89758f4e32e5979041420fd7e3326911837f44229ce53994146
4
+ data.tar.gz: 643531e121568f4a384ebd8e5564e74ab5e27e2d628fce3835b774ffddf7d5ca
5
5
  SHA512:
6
- metadata.gz: 36c6c67963c9becef1b00424d30ac738e6de263ba21bff7b9dda27d2b90a7944237ead68804e6a3e7a001775d2015588644c12faaff663d287b7749494388e74
7
- data.tar.gz: 9d6df66f86c22c58e82fc24951fdf2e88e606ffc6344958f391b510a15147d9ba1dd8a57f1452d7962f0ec828c229c6b1e29c1a951d47a95747e3eefb4579808
6
+ metadata.gz: 1514afc7924e4e176086b0be131da0fbdf961b32448f557ee5fb53929e52ef13b36ad45c5860d2c7cef597936eb725314af56cdc71c50caad92a73529d2ecb91
7
+ data.tar.gz: a89eead132c23c8cfc6d4be5101dbc8b5e283be109487178d784b009c9da1b3f242a6af93f955d423e5aee7a57ed87009ba749a6d39a697746765f4d655947f4
data/bin/rspec ADDED
@@ -0,0 +1,29 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ #
5
+ # This file was generated by Bundler.
6
+ #
7
+ # The application 'rspec' is installed as part of a gem, and
8
+ # this file is here to facilitate running it.
9
+ #
10
+
11
+ require "pathname"
12
+ ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13
+ Pathname.new(__FILE__).realpath)
14
+
15
+ bundle_binstub = File.expand_path("../bundle", __FILE__)
16
+
17
+ if File.file?(bundle_binstub)
18
+ if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19
+ load(bundle_binstub)
20
+ else
21
+ abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22
+ Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23
+ end
24
+ end
25
+
26
+ require "rubygems"
27
+ require "bundler/setup"
28
+
29
+ load Gem.bin_path("rspec-core", "rspec")
@@ -32,6 +32,9 @@ module Savvy
32
32
  host: @host,
33
33
  port: @port,
34
34
  db: @db,
35
+ scheme: @scheme,
36
+ password: @password,
37
+ ssl: uses_ssl?,
35
38
  }.tap do |h|
36
39
  ns = without_namespace ? @namespace_prefix : namespace(*parts)
37
40
 
@@ -72,6 +75,14 @@ module Savvy
72
75
  build_redis_url *parts
73
76
  end
74
77
 
78
+ # @!attribute [r] password
79
+ # @return [String, nil]
80
+ def password
81
+ check_validity!
82
+
83
+ @password
84
+ end
85
+
75
86
  # @!attribute [r] port
76
87
  # @return [Integer]
77
88
  def port
@@ -80,6 +91,14 @@ module Savvy
80
91
  @port
81
92
  end
82
93
 
94
+ # @!attribute [r] scheme
95
+ # @return ["rediss", "redis"]
96
+ def scheme
97
+ check_validity!
98
+
99
+ @scheme
100
+ end
101
+
83
102
  # The url as configured by the environment (sans namespace)
84
103
  #
85
104
  # @return [String]
@@ -89,6 +108,20 @@ module Savvy
89
108
  build_redis_url without_namespace: true
90
109
  end
91
110
 
111
+ # @!attribute [r] userinfo
112
+ # @return [String, nil]
113
+ def userinfo
114
+ check_validity!
115
+
116
+ @userinfo
117
+ end
118
+
119
+ def uses_ssl?
120
+ @scheme == "rediss"
121
+ end
122
+
123
+ alias has_ssl? uses_ssl?
124
+
92
125
  # @return [ConnectionPool]
93
126
  def build_connection_pool(*namespace_parts, size: 5, timeout: 5)
94
127
  raise Savvy::RedisError, 'Requires connection_pool gem' unless defined?(ConnectionPool)
@@ -130,8 +163,11 @@ module Savvy
130
163
 
131
164
  @parsed_url = URI.parse @provided_url
132
165
 
166
+ @scheme = @parsed_url.scheme == "rediss" ? "rediss" : "redis"
133
167
  @host = @parsed_url.host
134
168
  @port = @parsed_url.port
169
+ @password = @parsed_url.password
170
+ @userinfo = @parsed_url.userinfo
135
171
 
136
172
  path_match = PATH_PATTERN.match @parsed_url.path
137
173
 
@@ -148,7 +184,7 @@ module Savvy
148
184
  @namespace_prefix = captures['namespace_prefix']
149
185
  end
150
186
 
151
- @base_uri = URI::Generic.new 'redis', nil, @host, @port, nil, '', nil, nil, nil
187
+ @base_uri = URI::Generic.new @scheme, @userinfo, @host, @port, nil, '', nil, nil, nil
152
188
  rescue URI::InvalidURIError => e
153
189
  @error = "could not parse redis URL (#{@provided_url})"
154
190
  end
data/lib/savvy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Savvy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: savvy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexa Grey
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-30 00:00:00.000000000 Z
11
+ date: 2021-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cleanroom
@@ -159,6 +159,7 @@ files:
159
159
  - README.md
160
160
  - Rakefile
161
161
  - bin/console
162
+ - bin/rspec
162
163
  - bin/setup
163
164
  - exe/savvy
164
165
  - lib/savvy.rb
@@ -179,7 +180,7 @@ homepage: https://github.com/scryptmouse/savvy
179
180
  licenses:
180
181
  - MIT
181
182
  metadata: {}
182
- post_install_message:
183
+ post_install_message:
183
184
  rdoc_options: []
184
185
  require_paths:
185
186
  - lib
@@ -194,9 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
195
  - !ruby/object:Gem::Version
195
196
  version: '0'
196
197
  requirements: []
197
- rubyforge_project:
198
- rubygems_version: 2.4.5
199
- signing_key:
198
+ rubygems_version: 3.2.18
199
+ signing_key:
200
200
  specification_version: 4
201
201
  summary: ENV-backed configuration helper for Redis, Sidekiq, etc
202
202
  test_files: []