ldclient-rb 2.2.5 → 2.2.6

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
  SHA1:
3
- metadata.gz: 8e80f005cb0e766f2b7bc67ae26b9d33ef9f8df3
4
- data.tar.gz: 42ce3fee3713a80d14e0f250b8e541918a50fcf0
3
+ metadata.gz: 24cb1e607925c0fd32ea12ffc155593063b18844
4
+ data.tar.gz: 0e63183614a1c026464e5bfd111f5b10c27dcf9f
5
5
  SHA512:
6
- metadata.gz: 3c40490932b362914b7383a651f1fe36736eefbcacb1c1be72018420d917bf47606d21b40da8fde3033bd645a26d2c00426dba38f6a37596006625d952f96982
7
- data.tar.gz: 1fd96aa5d3c37eeb0dd6f17a69b075a300f546b1fee31ecbd82971cdf3d81ae7537b0e99c58cc41444f3e135a133f464f32d891c37d264e1b7c1cfd36b97d489
6
+ metadata.gz: be9d14db6cc4b87f272f8cdf24f4c22a9d0048d378704881be464232197f840b0e87d4f9900caa24e546e0b59abe7ad816b19ba6f5f30931abd384db0c2c1a69
7
+ data.tar.gz: 54bc837c099bef568dd14675955a38f10cafb8ea5fa9ca51eaba55c9bb2ee53af48a744ab44e3e6b0b5d41a814698b33f70688297554e1ec0ae35021f8fc83f6
data/.gitignore CHANGED
@@ -12,4 +12,5 @@
12
12
  *.a
13
13
  mkmf.log
14
14
  *.gem
15
- Gemfile.lock
15
+ Gemfile.lock
16
+ .DS_Store
data/.rubocop.yml CHANGED
@@ -94,7 +94,7 @@ Rails/Delegate:
94
94
  Description: 'Prefer delegate method for delegations.'
95
95
  Enabled: false
96
96
 
97
- Style/DeprecatedHashMethods:
97
+ Style/PreferredHashMethods:
98
98
  Description: 'Checks for use of deprecated Hash methods.'
99
99
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-key'
100
100
  Enabled: false
@@ -103,11 +103,6 @@ Style/Documentation:
103
103
  Description: 'Document classes and non-namespace modules.'
104
104
  Enabled: false
105
105
 
106
- Style/DotPosition:
107
- Description: 'Checks the position of the dot in multi-line method calls.'
108
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
109
- EnforcedStyle: trailing
110
-
111
106
  Style/DoubleNegation:
112
107
  Description: 'Checks for uses of double negation (!!).'
113
108
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-bang-bang'
@@ -133,10 +128,6 @@ Style/EvenOdd:
133
128
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
134
129
  Enabled: false
135
130
 
136
- Style/ExtraSpacing:
137
- Description: 'Do not use unnecessary spacing.'
138
- Enabled: true
139
-
140
131
  Style/FileName:
141
132
  Description: 'Use snake_case for source file names.'
142
133
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
@@ -196,9 +187,9 @@ Style/LineEndConcatenation:
196
187
  Enabled: false
197
188
 
198
189
  Metrics/LineLength:
199
- Description: 'Limit lines to 100 characters.'
190
+ Description: 'Limit lines to 150 characters.'
200
191
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#80-character-limits'
201
- Max: 100
192
+ Max: 150
202
193
 
203
194
  Metrics/MethodLength:
204
195
  Description: 'Avoid methods longer than 10 lines of code.'
@@ -210,13 +201,6 @@ Style/ModuleFunction:
210
201
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#module-function'
211
202
  Enabled: false
212
203
 
213
- Style/MultilineOperationIndentation:
214
- Description: >-
215
- Checks indentation of binary operations that span more than
216
- one line.
217
- Enabled: true
218
- EnforcedStyle: indented
219
-
220
204
  Style/NegatedIf:
221
205
  Description: >-
222
206
  Favor unless over if for negative conditions
@@ -334,13 +318,14 @@ Style/StringLiterals:
334
318
  EnforcedStyle: double_quotes
335
319
  Enabled: true
336
320
 
337
- Style/TrailingComma:
338
- Description: 'Checks for trailing comma in parameter lists and literals.'
339
- StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
340
- EnforcedStyleForMultiline: comma
341
- SupportedStyles:
342
- - comma
343
- - no_comma
321
+ Style/TrailingCommaInArguments:
322
+ Description: 'Checks for trailing comma in argument lists.'
323
+ StyleGuide: '#no-trailing-params-comma'
324
+ Enabled: true
325
+
326
+ Style/TrailingCommaInLiteral:
327
+ Description: 'Checks for trailing comma in array and hash literals.'
328
+ StyleGuide: '#no-trailing-array-commas'
344
329
  Enabled: true
345
330
 
346
331
  Style/TrivialAccessors:
@@ -372,6 +357,29 @@ Style/WordArray:
372
357
  StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-w'
373
358
  Enabled: false
374
359
 
360
+ # Layout
361
+ Layout/DotPosition:
362
+ Description: 'Checks the position of the dot in multi-line method calls.'
363
+ StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
364
+ EnforcedStyle: trailing
365
+
366
+ Layout/ExtraSpacing:
367
+ Description: 'Do not use unnecessary spacing.'
368
+ Enabled: true
369
+
370
+ Layout/MultilineOperationIndentation:
371
+ Description: >-
372
+ Checks indentation of binary operations that span more than
373
+ one line.
374
+ Enabled: true
375
+ EnforcedStyle: indented
376
+
377
+ Layout/InitialIndentation:
378
+ Description: >-
379
+ Checks the indentation of the first non-blank non-comment line in a file.
380
+ Enabled: false
381
+
382
+
375
383
  # Lint
376
384
 
377
385
  Lint/AmbiguousOperator:
@@ -434,11 +442,6 @@ Lint/InvalidCharacterLiteral:
434
442
  whitespace character.
435
443
  Enabled: false
436
444
 
437
- Style/InitialIndentation:
438
- Description: >-
439
- Checks the indentation of the first non-blank non-comment line in a file.
440
- Enabled: false
441
-
442
445
  Lint/LiteralInCondition:
443
446
  Description: 'Checks of literals used in conditions.'
444
447
  Enabled: false
@@ -560,10 +563,6 @@ Rails/Date:
560
563
  such as Date.today, Date.current etc.
561
564
  Enabled: false
562
565
 
563
- Rails/DefaultScope:
564
- Description: 'Checks if the argument passed to default_scope is a block.'
565
- Enabled: false
566
-
567
566
  Rails/FindBy:
568
567
  Description: 'Prefer find_by over where.first.'
569
568
  Enabled: false
data/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
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
+ ## [2.2.6] - 2017-07-26
6
+ ## Changed
7
+ - Update Readme to fix instructions on installing gem using command line
8
+ - Cleaned up formatting on various files (Rubocop)
9
+ ## [2.2.5] - 2017-05-08
10
+ ## Changed
11
+ - Added proxy support to streaming and http connections. Respects `HTTP_PROXY` and `http_proxy` environment variables as well as the `:proxy => protocol://user:pass@host` configuration parameter.
12
+
5
13
  ## [2.1.5] - 2017-03-28
6
14
  ## Changed
7
15
  - Updated changelog
data/README.md CHANGED
@@ -14,8 +14,9 @@ Quick setup
14
14
  0. Install the Ruby SDK with `gem`
15
15
 
16
16
  ```shell
17
- gem install ldclient-rb
17
+ gem install ldclient-rb --prerelease
18
18
  ```
19
+ Note: The `--prerelease` flag is there to satisfy the dependency of celluloid 0.18pre which we have tested extensively and have found stable in our use case. Unfortunately, the upstream provider has not promoted this version to stable yet. See [here](https://github.com/celluloid/celluloid/issues/762) This is not required for use in a Gemfile.
19
20
 
20
21
  1. Require the LaunchDarkly client:
21
22
 
@@ -115,19 +116,19 @@ About LaunchDarkly
115
116
  * Grant access to certain features based on user attributes, like payment plan (eg: users on the ‘gold’ plan get access to more features than users in the ‘silver’ plan). Disable parts of your application to facilitate maintenance, without taking everything offline.
116
117
  * LaunchDarkly provides feature flag SDKs for
117
118
  * [Java](http://docs.launchdarkly.com/docs/java-sdk-reference "Java SDK")
118
- * [JavaScript] (http://docs.launchdarkly.com/docs/js-sdk-reference "LaunchDarkly JavaScript SDK")
119
- * [PHP] (http://docs.launchdarkly.com/docs/php-sdk-reference "LaunchDarkly PHP SDK")
120
- * [Python] (http://docs.launchdarkly.com/docs/python-sdk-reference "LaunchDarkly Python SDK")
121
- * [Python Twisted] (http://docs.launchdarkly.com/docs/python-twisted-sdk-reference "LaunchDarkly Python Twisted SDK")
122
- * [Go] (http://docs.launchdarkly.com/docs/go-sdk-reference "LaunchDarkly Go SDK")
123
- * [Node.JS] (http://docs.launchdarkly.com/docs/node-sdk-reference "LaunchDarkly Node SDK")
124
- * [.NET] (http://docs.launchdarkly.com/docs/dotnet-sdk-reference "LaunchDarkly .Net SDK")
125
- * [Ruby] (http://docs.launchdarkly.com/docs/ruby-sdk-reference "LaunchDarkly Ruby SDK")
126
- * [iOS] (http://docs.launchdarkly.com/docs/ios-sdk-reference "LaunchDarkly iOS SDK")
127
- * [Android] (http://docs.launchdarkly.com/docs/android-sdk-reference "LaunchDarkly Android SDK")
119
+ * [JavaScript](http://docs.launchdarkly.com/docs/js-sdk-reference "LaunchDarkly JavaScript SDK")
120
+ * [PHP](http://docs.launchdarkly.com/docs/php-sdk-reference "LaunchDarkly PHP SDK")
121
+ * [Python](http://docs.launchdarkly.com/docs/python-sdk-reference "LaunchDarkly Python SDK")
122
+ * [Python Twisted](http://docs.launchdarkly.com/docs/python-twisted-sdk-reference "LaunchDarkly Python Twisted SDK")
123
+ * [Go](http://docs.launchdarkly.com/docs/go-sdk-reference "LaunchDarkly Go SDK")
124
+ * [Node.JS](http://docs.launchdarkly.com/docs/node-sdk-reference "LaunchDarkly Node SDK")
125
+ * [.NET](http://docs.launchdarkly.com/docs/dotnet-sdk-reference "LaunchDarkly .Net SDK")
126
+ * [Ruby](http://docs.launchdarkly.com/docs/ruby-sdk-reference "LaunchDarkly Ruby SDK")
127
+ * [iOS](http://docs.launchdarkly.com/docs/ios-sdk-reference "LaunchDarkly iOS SDK")
128
+ * [Android](http://docs.launchdarkly.com/docs/android-sdk-reference "LaunchDarkly Android SDK")
128
129
  * Explore LaunchDarkly
129
- * [launchdarkly.com] (http://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
130
- * [docs.launchdarkly.com] (http://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDKs
131
- * [apidocs.launchdarkly.com] (http://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
132
- * [blog.launchdarkly.com] (http://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
133
- * [Feature Flagging Guide] (https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
130
+ * [launchdarkly.com](http://www.launchdarkly.com/ "LaunchDarkly Main Website") for more information
131
+ * [docs.launchdarkly.com](http://docs.launchdarkly.com/ "LaunchDarkly Documentation") for our documentation and SDKs
132
+ * [apidocs.launchdarkly.com](http://apidocs.launchdarkly.com/ "LaunchDarkly API Documentation") for our API documentation
133
+ * [blog.launchdarkly.com](http://blog.launchdarkly.com/ "LaunchDarkly Blog Documentation") for the latest product updates
134
+ * [Feature Flagging Guide](https://github.com/launchdarkly/featureflags/ "Feature Flagging Guide") for best practices and strategies
data/ext/mkrf_conf.rb CHANGED
@@ -1,11 +1,11 @@
1
- require 'rubygems'
1
+ require "rubygems"
2
2
 
3
3
 
4
4
  # From http://stackoverflow.com/questions/5830835/how-to-add-openssl-dependency-to-gemspec
5
5
  # the whole reason this file exists: to return an error if openssl
6
6
  # isn't installed.
7
- require 'openssl'
7
+ require "openssl"
8
8
 
9
9
  f = File.open(File.join(File.dirname(__FILE__), "Rakefile"), "w") # create dummy rakefile to indicate success
10
10
  f.write("task :default\n")
11
- f.close
11
+ f.close
data/ldclient-rb.gemspec CHANGED
@@ -1,8 +1,10 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path("../lib", __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
5
  require "ldclient-rb/version"
5
6
 
7
+ # rubocop:disable Metrics/BlockLength
6
8
  Gem::Specification.new do |spec|
7
9
  spec.name = "ldclient-rb"
8
10
  spec.version = LaunchDarkly::VERSION
@@ -33,8 +35,8 @@ Gem::Specification.new do |spec|
33
35
  spec.add_runtime_dependency "hashdiff", "~> 0.2"
34
36
  spec.add_runtime_dependency "ld-celluloid-eventsource", "~> 0.10.0"
35
37
  spec.add_runtime_dependency "celluloid", "~> 0.18.0.pre" # transitive dep; specified here for more control
36
-
37
- if RUBY_VERSION >= '2.2.2'
38
+
39
+ if RUBY_VERSION >= "2.2.2"
38
40
  spec.add_runtime_dependency "nio4r", "< 3" # for maximum ruby version compatibility.
39
41
  else
40
42
  spec.add_runtime_dependency "nio4r", "~> 1.1" # for maximum ruby version compatibility.
@@ -42,6 +42,7 @@ module LaunchDarkly
42
42
  # @option opts [Boolean] :stream (true) Whether or not the streaming API should be used to receive flag updates.
43
43
  #
44
44
  # @return [type] [description]
45
+ # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
45
46
  def initialize(opts = {})
46
47
  @base_uri = (opts[:base_uri] || Config.default_base_uri).chomp("/")
47
48
  @stream_uri = (opts[:stream_uri] || Config.default_stream_uri).chomp("/")
@@ -1,20 +1,19 @@
1
1
  require "date"
2
2
 
3
3
  module LaunchDarkly
4
-
5
4
  module Evaluation
6
5
  BUILTINS = [:key, :ip, :country, :email, :firstName, :lastName, :avatar, :name, :anonymous]
7
6
 
8
7
  OPERATORS = {
9
- in:
8
+ in:
10
9
  lambda do |a, b|
11
10
  a == b
12
11
  end,
13
- endsWith:
12
+ endsWith:
14
13
  lambda do |a, b|
15
14
  (a.is_a? String) && (a.end_with? b)
16
15
  end,
17
- startsWith:
16
+ startsWith:
18
17
  lambda do |a, b|
19
18
  (a.is_a? String) && (a.start_with? b)
20
19
  end,
@@ -50,7 +49,7 @@ module LaunchDarkly
50
49
  end
51
50
  if b.is_a? String
52
51
  b = DateTime.rfc3339(b).strftime('%Q').to_i
53
- end
52
+ end
54
53
  (a.is_a? Numeric) ? a < b : false
55
54
  rescue => e
56
55
  false
@@ -60,11 +59,11 @@ module LaunchDarkly
60
59
  lambda do |a, b|
61
60
  begin
62
61
  if a.is_a? String
63
- a = DateTime.rfc3339(a).strftime('%Q').to_i
62
+ a = DateTime.rfc3339(a).strftime("%Q").to_i
64
63
  end
65
64
  if b.is_a? String
66
- b = DateTime.rfc3339(b).strftime('%Q').to_i
67
- end
65
+ b = DateTime.rfc3339(b).strftime("%Q").to_i
66
+ end
68
67
  (a.is_a? Numeric) ? a > b : false
69
68
  rescue => e
70
69
  false
@@ -93,15 +92,15 @@ module LaunchDarkly
93
92
  if flag[:on]
94
93
  res = eval_internal(flag, user, store, events)
95
94
 
96
- return {value: res, events: events} if !res.nil?
95
+ return { value: res, events: events } if !res.nil?
97
96
  end
98
97
 
99
98
  if !flag[:offVariation].nil? && flag[:offVariation] < flag[:variations].length
100
99
  value = flag[:variations][flag[:offVariation]]
101
- return {value: value, events: events}
100
+ return { value: value, events: events }
102
101
  end
103
102
 
104
- {value: nil, events: events}
103
+ { value: nil, events: events }
105
104
  end
106
105
 
107
106
  def eval_internal(flag, user, store, events)
@@ -109,7 +108,6 @@ module LaunchDarkly
109
108
  # Evaluate prerequisites, if any
110
109
  if !flag[:prerequisites].nil?
111
110
  flag[:prerequisites].each do |prerequisite|
112
-
113
111
  prereq_flag = store.get(prerequisite[:key])
114
112
 
115
113
  if prereq_flag.nil? || !prereq_flag[:on]
@@ -119,7 +117,7 @@ module LaunchDarkly
119
117
  prereq_res = eval_internal(prereq_flag, user, store, events)
120
118
  variation = get_variation(prereq_flag, prerequisite[:variation])
121
119
  events.push(kind: "feature", key: prereq_flag[:key], value: prereq_res, version: prereq_flag[:version], prereqOf: flag[:key])
122
- if prereq_res.nil? || prereq_res!= variation
120
+ if prereq_res.nil? || prereq_res != variation
123
121
  failed_prereq = true
124
122
  end
125
123
  rescue => exn
@@ -149,7 +147,7 @@ module LaunchDarkly
149
147
  end
150
148
  end
151
149
  end
152
- end
150
+ end
153
151
 
154
152
  # Check custom rules
155
153
  if !flag[:rules].nil?
@@ -202,7 +200,7 @@ module LaunchDarkly
202
200
  end
203
201
 
204
202
  maybe_negate(clause, match_any(op, val, clause[:values]))
205
- end
203
+ end
206
204
 
207
205
  def variation_for_user(rule, user, flag)
208
206
  if !rule[:variation].nil? # fixed variation
@@ -234,7 +232,7 @@ module LaunchDarkly
234
232
  hash_key = "%s.%s.%s" % [key, salt, id_hash]
235
233
 
236
234
  hash_val = (Digest::SHA1.hexdigest(hash_key))[0..14]
237
- hash_val.to_i(16) / Float(0xFFFFFFFFFFFFFFF)
235
+ hash_val.to_i(16) / Float(0xFFFFFFFFFFFFFFF)
238
236
  end
239
237
 
240
238
  def user_value(user, attribute)
@@ -260,6 +258,4 @@ module LaunchDarkly
260
258
  return false
261
259
  end
262
260
  end
263
-
264
261
  end
265
-
@@ -2,7 +2,6 @@ require "thread"
2
2
  require "faraday"
3
3
 
4
4
  module LaunchDarkly
5
-
6
5
  class EventProcessor
7
6
  def initialize(sdk_key, config)
8
7
  @queue = Queue.new
@@ -67,9 +66,8 @@ module LaunchDarkly
67
66
  else
68
67
  @config.logger.warn("[LDClient] Exceeded event queue capacity. Increase capacity to avoid dropping events.")
69
68
  end
70
- end
69
+ end
71
70
 
72
71
  private :create_worker, :post_flushed_events
73
-
74
72
  end
75
- end
73
+ end
@@ -1,7 +1,6 @@
1
1
  require "concurrent/atomics"
2
2
 
3
3
  module LaunchDarkly
4
-
5
4
  class InMemoryFeatureStore
6
5
  def initialize
7
6
  @features = Hash.new
@@ -57,4 +56,4 @@ module LaunchDarkly
57
56
  @initialized.value
58
57
  end
59
58
  end
60
- end
59
+ end
@@ -32,7 +32,7 @@ module LaunchDarkly
32
32
  if !@config.offline?
33
33
  if @config.stream?
34
34
  @update_processor = StreamProcessor.new(sdk_key, config, requestor)
35
- else
35
+ else
36
36
  @update_processor = PollingProcessor.new(config, requestor)
37
37
  end
38
38
  @update_processor.start
@@ -42,7 +42,7 @@ module LaunchDarkly
42
42
 
43
43
  if !@config.offline? && wait_for_sec > 0
44
44
  begin
45
- WaitUtil.wait_for_condition("LaunchDarkly client initialization", :timeout_sec => wait_for_sec, :delay_sec => 0.1) do
45
+ WaitUtil.wait_for_condition("LaunchDarkly client initialization", timeout_sec: wait_for_sec, delay_sec: 0.1) do
46
46
  @update_processor.initialized?
47
47
  end
48
48
  rescue WaitUtil::TimeoutError
@@ -61,7 +61,7 @@ module LaunchDarkly
61
61
  end
62
62
 
63
63
  def secure_mode_hash(user)
64
- OpenSSL::HMAC.hexdigest('sha256', @sdk_key, user[:key].to_s)
64
+ OpenSSL::HMAC.hexdigest("sha256", @sdk_key, user[:key].to_s)
65
65
  end
66
66
 
67
67
  # Returns whether the client has been initialized and is ready to serve feature flag requests
@@ -107,13 +107,13 @@ module LaunchDarkly
107
107
 
108
108
  unless user
109
109
  @config.logger.error("[LDClient] Must specify user")
110
- @event_processor.add_event(kind: "feature", key: key, value: default, default: default, user: user)
110
+ @event_processor.add_event(kind: "feature", key: key, value: default, default: default, user: user)
111
111
  return default
112
112
  end
113
113
 
114
114
  if !@update_processor.initialized?
115
115
  @config.logger.error("[LDClient] Client has not finished initializing. Returning default value")
116
- @event_processor.add_event(kind: "feature", key: key, value: default, default: default, user: user)
116
+ @event_processor.add_event(kind: "feature", key: key, value: default, default: default, user: user)
117
117
  return default
118
118
  end
119
119
 
@@ -138,8 +138,8 @@ module LaunchDarkly
138
138
  return res[:value]
139
139
  else
140
140
  @config.logger.debug("[LDClient] Result value is null in toggle")
141
- @event_processor.add_event(kind: "feature", key: key, user: user, value: default, default: default, version: feature[:version])
142
- return default
141
+ @event_processor.add_event(kind: "feature", key: key, user: user, value: default, default: default, version: feature[:version])
142
+ return default
143
143
  end
144
144
  rescue => exn
145
145
  @config.logger.warn("[LDClient] Error evaluating feature flag: #{exn.inspect}. \nTrace: #{exn.backtrace}")
@@ -188,7 +188,7 @@ module LaunchDarkly
188
188
  features = @store.all
189
189
 
190
190
  # TODO rescue if necessary
191
- Hash[features.map{|k,f| [k, evaluate(f, user, @store)[:value]] }]
191
+ Hash[features.map{ |k, f| [k, evaluate(f, user, @store)[:value]] }]
192
192
  rescue => exn
193
193
  @config.logger.warn("[LDClient] Error evaluating all flags: #{exn.inspect}. \nTrace: #{exn.backtrace}")
194
194
  return Hash.new
@@ -3,7 +3,6 @@ require "thread"
3
3
 
4
4
  module LaunchDarkly
5
5
  class PollingProcessor
6
-
7
6
  def initialize(config, requestor)
8
7
  @config = config
9
8
  @requestor = requestor
@@ -44,13 +43,12 @@ module LaunchDarkly
44
43
  end
45
44
  rescue StandardError => exn
46
45
  @config.logger.error("[LDClient] Exception while polling: #{exn.inspect}")
47
- # TODO: log_exception(__method__.to_s, exn)
46
+ # TODO: log_exception(__method__.to_s, exn)
48
47
  end
49
48
  end
50
49
  end
51
50
  end
52
51
 
53
-
54
52
  private :poll, :create_worker
55
53
  end
56
- end
54
+ end
@@ -56,7 +56,5 @@ module LaunchDarkly
56
56
  end
57
57
 
58
58
  private :make_request
59
-
60
59
  end
61
-
62
- end
60
+ end
@@ -61,7 +61,7 @@ module LaunchDarkly
61
61
  @initialized.make_true
62
62
  @config.logger.info("[LDClient] Stream initialized (via indirect message)")
63
63
  elsif method == INDIRECT_PATCH
64
- @store.upsert(message.data, @requestor.request_flag(message.data))
64
+ @store.upsert(message.data, @requestor.request_flag(message.data))
65
65
  else
66
66
  @config.logger.warn("[LDClient] Unknown message received: #{method}")
67
67
  end
@@ -1,3 +1,3 @@
1
1
  module LaunchDarkly
2
- VERSION = "2.2.5"
2
+ VERSION = "2.2.6"
3
3
  end
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env bash
2
+ # This script updates the version for the ldclient library and releases it to RubyGems
3
+ # It will only work if you have the proper credentials set up in ~/.gem/credentials
4
+
5
+ # It takes exactly one argument: the new version.
6
+ # It should be run from the root of this git repo like this:
7
+ # ./scripts/release.sh 4.0.9
8
+
9
+ # When done you should commit and push the changes made.
10
+
11
+ set -uxe
12
+ echo "Starting ruby-client release."
13
+
14
+ VERSION=$1
15
+
16
+ #Update version in ldclient/version.py
17
+ VERSION_RB_TEMP=./version.rb.tmp
18
+ sed "s/VERSION =.*/VERSION = \"${VERSION}\"/g" lib/ldclient-rb/version.rb > ${VERSION_RB_TEMP}
19
+ mv ${VERSION_RB_TEMP} lib/ldclient-rb/version.rb
20
+
21
+ # Build Ruby Gem
22
+ gem build ldclient-rb.gemspec
23
+
24
+ # Publish Ruby Gem
25
+ gem push ldclient-rb-${VERSION}.gem
26
+
27
+ echo "Done with ruby-client release"
@@ -3,7 +3,7 @@ require "spec_helper"
3
3
 
4
4
  describe LaunchDarkly::LDClient do
5
5
  subject { LaunchDarkly::LDClient }
6
- let(:config) { LaunchDarkly::Config.new({:offline => true}) }
6
+ let(:config) { LaunchDarkly::Config.new({offline: true}) }
7
7
  let(:client) do
8
8
  subject.new("secret", config)
9
9
  end
@@ -33,7 +33,7 @@ describe LaunchDarkly::LDClient do
33
33
 
34
34
  describe '#secure_mode_hash' do
35
35
  it "will return the expected value for a known message and secret" do
36
- result = client.secure_mode_hash({:key => :Message})
36
+ result = client.secure_mode_hash({key: :Message})
37
37
  expect(result).to eq "aa747c502a898200f9e4fa21bac68136f886a0e27aec70ba06daf2e2a5cb5597"
38
38
  end
39
39
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ldclient-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - LaunchDarkly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-08 00:00:00.000000000 Z
11
+ date: 2017-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -254,6 +254,7 @@ files:
254
254
  - lib/ldclient-rb/requestor.rb
255
255
  - lib/ldclient-rb/stream.rb
256
256
  - lib/ldclient-rb/version.rb
257
+ - scripts/release.sh
257
258
  - spec/config_spec.rb
258
259
  - spec/fixtures/feature.json
259
260
  - spec/fixtures/numeric_key_user.json
@@ -286,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
286
287
  version: '0'
287
288
  requirements: []
288
289
  rubyforge_project:
289
- rubygems_version: 2.6.11
290
+ rubygems_version: 2.5.2
290
291
  signing_key:
291
292
  specification_version: 4
292
293
  summary: LaunchDarkly SDK for Ruby