launchdarkly-server-sdk 6.2.0 → 6.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +4 -1
- data/.ldrelease/circleci/template/build.sh +2 -12
- data/.ldrelease/circleci/template/gems-setup.sh +16 -0
- data/.ldrelease/circleci/template/prepare.sh +17 -0
- data/.ldrelease/circleci/template/publish.sh +5 -9
- data/.ldrelease/circleci/template/test.sh +2 -2
- data/CHANGELOG.md +16 -0
- data/launchdarkly-server-sdk.gemspec +4 -6
- data/lib/ldclient-rb/impl/diagnostic_events.rb +1 -1
- data/lib/ldclient-rb/ldclient.rb +6 -0
- data/lib/ldclient-rb/requestor.rb +1 -1
- data/lib/ldclient-rb/version.rb +1 -1
- data/spec/diagnostic_events_spec.rb +9 -7
- data/spec/ldclient_spec.rb +3 -11
- data/spec/requestor_spec.rb +13 -0
- metadata +24 -17
- data/.ldrelease/circleci/template/set-gem-home.sh +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 326e10ac69bf7d73c5727c555a2981b7d271d1651d9521b976005d93646a188b
|
4
|
+
data.tar.gz: 608205f6ac545e410aaa9e507180b8ad097ebe1ed23c6dc011b2c522209d9e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1b648a1d796ad1b65feffd9ee83fcd3dcb63c3146d513e44173d5cb6da32fd29b993d8b7343957094b801b69da5c0873b458fb568e6d174e4c402e158d129c4
|
7
|
+
data.tar.gz: 433d7761a4386538c25a8db6a0520b7d1e8c7184dcc9967e9770bbf5639e3f0a74476f2a0ef20f50bf53a5c6da4df62aacfd444f5fad5cfb1d64bc73a113374f
|
data/.circleci/config.yml
CHANGED
@@ -20,10 +20,13 @@ jobs:
|
|
20
20
|
LD_RELEASE_DOCS_TITLE: ""
|
21
21
|
LD_RELEASE_PROJECT: "ruby-server-sdk"
|
22
22
|
LD_RELEASE_PROJECT_TEMPLATE: "ruby"
|
23
|
-
LD_RELEASE_VERSION: "6.2.
|
23
|
+
LD_RELEASE_VERSION: "6.2.4"
|
24
24
|
LD_SKIP_DATABASE_TESTS: "1"
|
25
25
|
steps:
|
26
26
|
- checkout
|
27
|
+
- run:
|
28
|
+
name: "Releaser: prepare"
|
29
|
+
command: .ldrelease/circleci/mac/execute.sh prepare .ldrelease/circleci/template/prepare.sh
|
27
30
|
- run:
|
28
31
|
name: "Releaser: build"
|
29
32
|
command: .ldrelease/circleci/mac/execute.sh build .ldrelease/circleci/template/build.sh
|
@@ -7,20 +7,10 @@ set -ue
|
|
7
7
|
echo "Using gem $(gem --version)"
|
8
8
|
|
9
9
|
#shellcheck source=/dev/null
|
10
|
-
source "$(dirname "$0")/
|
11
|
-
|
12
|
-
# If the gemspec specifies a certain version of bundler, we need to make sure we install that version.
|
13
|
-
echo "Installing bundler"
|
14
|
-
GEMSPEC_BUNDLER_VERSION=$(sed -n -e "s/.*['\"]bundler['\"], *['\"]\([^'\"]*\)['\"]/\1/p" ./*.gemspec | tr -d ' ')
|
15
|
-
if [ -n "${GEMSPEC_BUNDLER_VERSION}" ]; then
|
16
|
-
GEMSPEC_OPTIONS="-v ${GEMSPEC_BUNDLER_VERSION}"
|
17
|
-
else
|
18
|
-
GEMSPEC_OPTIONS=""
|
19
|
-
fi
|
20
|
-
gem install bundler ${GEMSPEC_OPTIONS} || { echo "installing bundler failed" >&2; exit 1; }
|
10
|
+
source "$(dirname "$0")/gems-setup.sh"
|
21
11
|
|
22
12
|
echo; echo "Installing dependencies"
|
23
|
-
|
13
|
+
${BUNDLER_COMMAND} install
|
24
14
|
|
25
15
|
# Build Ruby Gem - this assumes there is a single .gemspec file in the main project directory
|
26
16
|
# Note that the gemspec must be able to get the project version either from $LD_RELEASE_VERSION,
|
@@ -0,0 +1,16 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
# helper script to set GEM_HOME, PATH, and BUNDLER_COMMAND for Ruby - must be sourced, not executed
|
4
|
+
|
5
|
+
mkdir -p "${LD_RELEASE_TEMP_DIR}/gems"
|
6
|
+
export GEM_HOME="${LD_RELEASE_TEMP_DIR}/gems"
|
7
|
+
export PATH="${GEM_HOME}/bin:${PATH}"
|
8
|
+
|
9
|
+
# also, determine whether we'll need to run a specific version of Bundler
|
10
|
+
|
11
|
+
GEMSPEC_BUNDLER_VERSION=$(sed -n -e "s/.*['\"]bundler['\"], *['\"]\([^'\"]*\)['\"]/\1/p" ./*.gemspec | tr -d ' ')
|
12
|
+
if [ -n "${GEMSPEC_BUNDLER_VERSION}" ]; then
|
13
|
+
BUNDLER_COMMAND="bundler _${GEMSPEC_BUNDLER_VERSION}_"
|
14
|
+
else
|
15
|
+
BUNDLER_COMMAND="bundler"
|
16
|
+
fi
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -ue
|
4
|
+
|
5
|
+
echo "Using gem $(gem --version)"
|
6
|
+
|
7
|
+
#shellcheck source=/dev/null
|
8
|
+
source "$(dirname "$0")/gems-setup.sh"
|
9
|
+
|
10
|
+
# If the gemspec specifies a certain version of bundler, we need to make sure we install that version.
|
11
|
+
echo "Installing bundler"
|
12
|
+
if [ -n "${GEMSPEC_BUNDLER_VERSION:-}" ]; then
|
13
|
+
GEMSPEC_OPTIONS="-v ${GEMSPEC_BUNDLER_VERSION}"
|
14
|
+
else
|
15
|
+
GEMSPEC_OPTIONS=""
|
16
|
+
fi
|
17
|
+
gem install bundler ${GEMSPEC_OPTIONS} || { echo "installing bundler failed" >&2; exit 1; }
|
@@ -4,17 +4,13 @@ set -ue
|
|
4
4
|
|
5
5
|
# Standard publish.sh for Ruby-based projects - we can assume build.sh has already been run
|
6
6
|
|
7
|
-
|
7
|
+
#shellcheck source=/dev/null
|
8
|
+
source "$(dirname "$0")/gems-setup.sh"
|
8
9
|
|
9
10
|
# If we're running in CircleCI, the RubyGems credentials will be in an environment
|
10
|
-
# variable and
|
11
|
-
if [ -n "${LD_RELEASE_RUBYGEMS_API_KEY}" ]; then
|
12
|
-
|
13
|
-
cat >~/.gem/credentials <<EOF
|
14
|
-
---
|
15
|
-
:rubygems_api_key: $LD_RELEASE_RUBYGEMS_API_KEY
|
16
|
-
EOF
|
17
|
-
chmod 0600 ~/.gem/credentials
|
11
|
+
# variable and should be copied to the variable the gem command expects
|
12
|
+
if [ -n "${LD_RELEASE_RUBYGEMS_API_KEY:-}" ]; then
|
13
|
+
export GEM_HOST_API_KEY="${LD_RELEASE_RUBYGEMS_API_KEY}"
|
18
14
|
fi
|
19
15
|
|
20
16
|
# Since all Releaser builds are clean builds, we can assume that the only .gem file here
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,22 @@
|
|
2
2
|
|
3
3
|
All notable changes to the LaunchDarkly Ruby SDK will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org).
|
4
4
|
|
5
|
+
## [6.2.3] - 2021-08-06
|
6
|
+
### Fixed:
|
7
|
+
- Diagnostic events did not properly set the `usingProxy` attribute when a proxy was configured with the `HTTPS_PROXY` environment variable. ([#182](https://github.com/launchdarkly/ruby-server-sdk/issues/182))
|
8
|
+
|
9
|
+
## [6.2.2] - 2021-07-23
|
10
|
+
### Fixed:
|
11
|
+
- Enabling debug logging in polling mode could cause polling to fail with a `NameError`. (Thanks, [mmurphy-notarize](https://github.com/launchdarkly/ruby-server-sdk/pull/180)!)
|
12
|
+
|
13
|
+
## [6.2.1] - 2021-07-15
|
14
|
+
### Changed:
|
15
|
+
- If `variation` or `variation_detail` is called with a user object that has no `key` (an invalid condition that will always result in the default value being returned), the SDK now logs a `warn`-level message to alert you to this incorrect usage. This makes the Ruby SDK's logging behavior consistent with the other server-side LaunchDarkly SDKs. ([#177](https://github.com/launchdarkly/ruby-server-sdk/issues/177))
|
16
|
+
|
17
|
+
## [6.2.0] - 2021-06-17
|
18
|
+
### Added:
|
19
|
+
- The SDK now supports the ability to control the proportion of traffic allocation to an experiment. This works in conjunction with a new platform feature now available to early access customers.
|
20
|
+
|
5
21
|
## [6.1.1] - 2021-05-27
|
6
22
|
### Fixed:
|
7
23
|
- Calling `variation` with a nil user parameter is invalid, causing the SDK to log an error and return a fallback value, but the SDK was still sending an analytics event for this. An event without a user is meaningless and can't be processed by LaunchDarkly. This is now fixed so the SDK will not send one.
|
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.required_ruby_version = ">= 2.5.0"
|
23
23
|
|
24
24
|
spec.add_development_dependency "aws-sdk-dynamodb", "~> 1.57"
|
25
|
-
spec.add_development_dependency "bundler", "
|
25
|
+
spec.add_development_dependency "bundler", "2.2.10"
|
26
26
|
spec.add_development_dependency "rspec", "~> 3.10"
|
27
27
|
spec.add_development_dependency "diplomat", "~> 2.4.2"
|
28
28
|
spec.add_development_dependency "redis", "~> 4.2"
|
@@ -36,10 +36,8 @@ Gem::Specification.new do |spec|
|
|
36
36
|
|
37
37
|
spec.add_runtime_dependency "semantic", "~> 1.6"
|
38
38
|
spec.add_runtime_dependency "concurrent-ruby", "~> 1.1"
|
39
|
-
spec.add_runtime_dependency "ld-eventsource", "
|
39
|
+
spec.add_runtime_dependency "ld-eventsource", "2.0.1"
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
spec.add_runtime_dependency "json", "~> 2.3.1"
|
44
|
-
spec.add_runtime_dependency "http", "~> 4.4.1"
|
41
|
+
spec.add_runtime_dependency "json", "~> 2.3"
|
42
|
+
spec.add_runtime_dependency "http", ">= 4.4.0", "< 6.0.0"
|
45
43
|
end
|
@@ -79,7 +79,7 @@ module LaunchDarkly
|
|
79
79
|
streamingDisabled: !config.stream?,
|
80
80
|
userKeysCapacity: config.user_keys_capacity,
|
81
81
|
userKeysFlushIntervalMillis: self.seconds_to_millis(config.user_keys_flush_interval),
|
82
|
-
usingProxy: ENV.has_key?('http_proxy') || ENV.has_key?('https_proxy') || ENV.has_key?('HTTP_PROXY'),
|
82
|
+
usingProxy: ENV.has_key?('http_proxy') || ENV.has_key?('https_proxy') || ENV.has_key?('HTTP_PROXY') || ENV.has_key?('HTTPS_PROXY'),
|
83
83
|
usingRelayDaemon: config.use_ldd?,
|
84
84
|
}
|
85
85
|
ret
|
data/lib/ldclient-rb/ldclient.rb
CHANGED
@@ -407,6 +407,12 @@ module LaunchDarkly
|
|
407
407
|
return detail
|
408
408
|
end
|
409
409
|
|
410
|
+
if user[:key].nil?
|
411
|
+
@config.logger.warn { "[LDClient] Variation called with nil user key; returning default value" }
|
412
|
+
detail = Evaluator.error_result(EvaluationReason::ERROR_USER_NOT_SPECIFIED, default)
|
413
|
+
return detail
|
414
|
+
end
|
415
|
+
|
410
416
|
if !initialized?
|
411
417
|
if @store.initialized?
|
412
418
|
@config.logger.warn { "[LDClient] Client has not finished initializing; using last known values from feature store" }
|
@@ -60,9 +60,9 @@ module LaunchDarkly
|
|
60
60
|
headers: headers
|
61
61
|
})
|
62
62
|
status = response.status.code
|
63
|
-
@config.logger.debug { "[LDClient] Got response from uri: #{uri}\n\tstatus code: #{status}\n\theaders: #{response.headers}\n\tbody: #{res.to_s}" }
|
64
63
|
# must fully read body for persistent connections
|
65
64
|
body = response.to_s
|
65
|
+
@config.logger.debug { "[LDClient] Got response from uri: #{uri}\n\tstatus code: #{status}\n\theaders: #{response.headers.to_h}\n\tbody: #{body}" }
|
66
66
|
if status == 304 && !cached.nil?
|
67
67
|
body = cached.body
|
68
68
|
else
|
data/lib/ldclient-rb/version.rb
CHANGED
@@ -79,13 +79,15 @@ module LaunchDarkly
|
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
82
|
+
['http_proxy', 'https_proxy', 'HTTP_PROXY', 'HTTPS_PROXY'].each do |name|
|
83
|
+
it "detects proxy #{name}" do
|
84
|
+
begin
|
85
|
+
ENV[name] = 'http://my-proxy'
|
86
|
+
event = default_acc.create_init_event(Config.new)
|
87
|
+
expect(event[:configuration][:usingProxy]).to be true
|
88
|
+
ensure
|
89
|
+
ENV[name] = nil
|
90
|
+
end
|
89
91
|
end
|
90
92
|
end
|
91
93
|
|
data/spec/ldclient_spec.rb
CHANGED
@@ -171,20 +171,12 @@ describe LaunchDarkly::LDClient do
|
|
171
171
|
client.variation("key", user_anonymous, "default")
|
172
172
|
end
|
173
173
|
|
174
|
-
it "
|
174
|
+
it "does not queue a feature event for an existing feature when user key is nil" do
|
175
175
|
config.feature_store.init({ LaunchDarkly::FEATURES => {} })
|
176
176
|
config.feature_store.upsert(LaunchDarkly::FEATURES, feature_with_value)
|
177
177
|
bad_user = { name: "Bob" }
|
178
|
-
expect(event_processor).
|
179
|
-
|
180
|
-
key: "key",
|
181
|
-
version: 100,
|
182
|
-
user: bad_user,
|
183
|
-
value: "default",
|
184
|
-
default: "default",
|
185
|
-
trackEvents: true,
|
186
|
-
debugEventsUntilDate: 1000
|
187
|
-
))
|
178
|
+
expect(event_processor).not_to receive(:add_event)
|
179
|
+
expect(logger).to receive(:warn)
|
188
180
|
client.variation("key", bad_user, "default")
|
189
181
|
end
|
190
182
|
|
data/spec/requestor_spec.rb
CHANGED
@@ -40,6 +40,19 @@ describe LaunchDarkly::Requestor do
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
+
it "logs debug output" do
|
44
|
+
logger = ::Logger.new($stdout)
|
45
|
+
logger.level = ::Logger::DEBUG
|
46
|
+
with_server do |server|
|
47
|
+
with_requestor(server.base_uri.to_s, { logger: logger }) do |requestor|
|
48
|
+
server.setup_ok_response("/", { flags: { x: { key: "y" } } }.to_json)
|
49
|
+
expect do
|
50
|
+
requestor.request_all_data()
|
51
|
+
end.to output(/\[LDClient\] Got response from uri\:/).to_stdout_from_any_process
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
43
56
|
it "sends etag from previous response" do
|
44
57
|
etag = "xyz"
|
45
58
|
with_server do |server|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: launchdarkly-server-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.2.
|
4
|
+
version: 6.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- LaunchDarkly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-dynamodb
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 2.2.10
|
34
34
|
type: :development
|
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:
|
40
|
+
version: 2.2.10
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -196,44 +196,50 @@ dependencies:
|
|
196
196
|
name: ld-eventsource
|
197
197
|
requirement: !ruby/object:Gem::Requirement
|
198
198
|
requirements:
|
199
|
-
- -
|
199
|
+
- - '='
|
200
200
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
201
|
+
version: 2.0.1
|
202
202
|
type: :runtime
|
203
203
|
prerelease: false
|
204
204
|
version_requirements: !ruby/object:Gem::Requirement
|
205
205
|
requirements:
|
206
|
-
- -
|
206
|
+
- - '='
|
207
207
|
- !ruby/object:Gem::Version
|
208
|
-
version:
|
208
|
+
version: 2.0.1
|
209
209
|
- !ruby/object:Gem::Dependency
|
210
210
|
name: json
|
211
211
|
requirement: !ruby/object:Gem::Requirement
|
212
212
|
requirements:
|
213
213
|
- - "~>"
|
214
214
|
- !ruby/object:Gem::Version
|
215
|
-
version: 2.3
|
215
|
+
version: '2.3'
|
216
216
|
type: :runtime
|
217
217
|
prerelease: false
|
218
218
|
version_requirements: !ruby/object:Gem::Requirement
|
219
219
|
requirements:
|
220
220
|
- - "~>"
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 2.3
|
222
|
+
version: '2.3'
|
223
223
|
- !ruby/object:Gem::Dependency
|
224
224
|
name: http
|
225
225
|
requirement: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
|
-
- - "
|
227
|
+
- - ">="
|
228
|
+
- !ruby/object:Gem::Version
|
229
|
+
version: 4.4.0
|
230
|
+
- - "<"
|
228
231
|
- !ruby/object:Gem::Version
|
229
|
-
version:
|
232
|
+
version: 6.0.0
|
230
233
|
type: :runtime
|
231
234
|
prerelease: false
|
232
235
|
version_requirements: !ruby/object:Gem::Requirement
|
233
236
|
requirements:
|
234
|
-
- - "
|
237
|
+
- - ">="
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: 4.4.0
|
240
|
+
- - "<"
|
235
241
|
- !ruby/object:Gem::Version
|
236
|
-
version:
|
242
|
+
version: 6.0.0
|
237
243
|
description: Official LaunchDarkly SDK for Ruby
|
238
244
|
email:
|
239
245
|
- team@launchdarkly.com
|
@@ -252,8 +258,9 @@ files:
|
|
252
258
|
- ".ldrelease/circleci/linux/execute.sh"
|
253
259
|
- ".ldrelease/circleci/mac/execute.sh"
|
254
260
|
- ".ldrelease/circleci/template/build.sh"
|
261
|
+
- ".ldrelease/circleci/template/gems-setup.sh"
|
262
|
+
- ".ldrelease/circleci/template/prepare.sh"
|
255
263
|
- ".ldrelease/circleci/template/publish.sh"
|
256
|
-
- ".ldrelease/circleci/template/set-gem-home.sh"
|
257
264
|
- ".ldrelease/circleci/template/test.sh"
|
258
265
|
- ".ldrelease/circleci/template/update-version.sh"
|
259
266
|
- ".ldrelease/circleci/windows/execute.ps1"
|