Skip to content

Commit

Permalink
prepare 5.5.0 release (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
eli-darkly authored Jan 18, 2019
1 parent fb0b709 commit 1203b75
Show file tree
Hide file tree
Showing 59 changed files with 2,733 additions and 1,711 deletions.
39 changes: 33 additions & 6 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ruby-docker-template: &ruby-docker-template
gem install jruby-openssl; # required by bundler, no effect on Ruby MRI
fi
- run: ruby -v
- run: gem install bundler -v "~> 1.7"
- run: gem install bundler -v 1.17.3
- run: bundle install
- run: mkdir ./rspec
- run: bundle exec rspec --format progress --format RspecJunitFormatter -o ./rspec/rspec.xml spec
Expand All @@ -32,28 +32,38 @@ jobs:
test-2.2:
<<: *ruby-docker-template
docker:
- image: circleci/ruby:2.2.9-jessie
- image: circleci/ruby:2.2.10-jessie
- image: consul
- image: redis
- image: amazon/dynamodb-local
test-2.3:
<<: *ruby-docker-template
docker:
- image: circleci/ruby:2.3.6-jessie
- image: circleci/ruby:2.3.7-jessie
- image: consul
- image: redis
- image: amazon/dynamodb-local
test-2.4:
<<: *ruby-docker-template
docker:
- image: circleci/ruby:2.4.4-stretch
- image: circleci/ruby:2.4.5-stretch
- image: consul
- image: redis
- image: amazon/dynamodb-local
test-2.5:
<<: *ruby-docker-template
docker:
- image: circleci/ruby:2.5.1-stretch
- image: circleci/ruby:2.5.3-stretch
- image: consul
- image: redis
- image: amazon/dynamodb-local
test-jruby-9.2:
<<: *ruby-docker-template
docker:
- image: circleci/jruby:9-jdk
- image: consul
- image: redis
- image: amazon/dynamodb-local

# The following very slow job uses an Ubuntu container to run the Ruby versions that
# CircleCI doesn't provide Docker images for.
Expand All @@ -63,8 +73,11 @@ jobs:
environment:
- RUBIES: "jruby-9.1.17.0"
steps:
- run: sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
- run: sudo apt-get -q update
- run: sudo apt-get -qy install redis-server
- run: sudo apt-cache policy docker-ce
- run: sudo apt-get -qy install docker-ce
- checkout
- run:
name: install all Ruby versions
Expand All @@ -82,10 +95,24 @@ jobs:
fi
# bundler 2.0 may be preinstalled, we need to remove it if so
yes | gem uninstall bundler --version '>=2.0' || true;
gem install bundler -v "~> 1.7";
gem install bundler -v 1.17.3;
bundle install;
mv Gemfile.lock "Gemfile.lock.$i"
done
- run:
name: start DynamoDB
command: docker run -p 8000:8000 amazon/dynamodb-local
background: true
- run:
name: download Consul
command: wget https://releases.hashicorp.com/consul/0.8.0/consul_0.8.0_linux_amd64.zip
- run:
name: extract Consul
command: unzip consul_0.8.0_linux_amd64.zip
- run:
name: start Consul
command: ./consul agent -dev
background: true
- run:
name: run tests for all versions
shell: /bin/bash -leo pipefail
Expand Down
12 changes: 0 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,3 @@ Contributing to LaunchDarkly SDK for Ruby
=========================================

We encourage pull-requests and other contributions from the community. We've also published an [SDK contributor's guide](http://docs.launchdarkly.com/docs/sdk-contributors-guide) that provides a detailed explanation of how our SDKs work.

Dependencies
------------
[ld-em-eventsource](https://github.com/launchdarkly/em-eventsource)


Style
-----

Our pull requests have [Hound CI](https://houndci.com/) set up to do style checking.
We also run [Rubocop](https://github.com/bbatsov/rubocop).

25 changes: 22 additions & 3 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,33 @@ PATH
concurrent-ruby (~> 1.0)
faraday (>= 0.9, < 2)
faraday-http-cache (>= 1.3.0, < 3)
http_tools (~> 0.4.5)
json (>= 1.8, < 3)
ld-eventsource (~> 1.0)
net-http-persistent (>= 2.9, < 4.0)
semantic (~> 1.6)
socketry (~> 0.5.1)

GEM
remote: https://rubygems.org/
specs:
aws-eventstream (1.0.1)
aws-partitions (1.128.0)
aws-sdk-core (3.44.2)
aws-eventstream (~> 1.0)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-dynamodb (1.19.0)
aws-sdk-core (~> 3, >= 3.39.0)
aws-sigv4 (~> 1.0)
aws-sigv4 (1.0.3)
codeclimate-test-reporter (0.6.0)
simplecov (>= 0.7.1, < 1.0.0)
concurrent-ruby (1.1.4)
connection_pool (2.2.1)
diff-lcs (1.3)
diplomat (2.0.2)
faraday (~> 0.9)
json
docile (1.1.5)
faraday (0.15.4)
multipart-post (>= 1.2, < 3)
Expand All @@ -27,10 +40,14 @@ GEM
ffi (1.9.25)
ffi (1.9.25-java)
hitimes (1.3.0)
hitimes (1.3.0-java)
http_tools (0.4.5)
jmespath (1.4.0)
json (1.8.6)
json (1.8.6-java)
ld-eventsource (1.0.0)
concurrent-ruby (~> 1.0)
http_tools (~> 0.4.5)
socketry (~> 0.5.1)
listen (3.1.5)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
Expand Down Expand Up @@ -74,9 +91,11 @@ PLATFORMS
ruby

DEPENDENCIES
aws-sdk-dynamodb (~> 1.18)
bundler (~> 1.7)
codeclimate-test-reporter (~> 0)
connection_pool (>= 2.1.2)
diplomat (>= 2.0.2)
ldclient-rb!
listen (~> 3.0)
rake (~> 10.0)
Expand Down
76 changes: 41 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@ This version of the LaunchDarkly SDK has a minimum Ruby version of 2.2.6, or 9.1
Quick setup
-----------

0. Install the Ruby SDK with `gem`
1. Install the Ruby SDK with `gem`

```shell
```shell
gem install ldclient-rb
```

1. Require the LaunchDarkly client:
2. Require the LaunchDarkly client:

```ruby
```ruby
require 'ldclient-rb'
```

2. Create a new LDClient with your SDK key:
3. Create a new LDClient with your SDK key:

```ruby
```ruby
client = LaunchDarkly::LDClient.new("your_sdk_key")
```

### Ruby on Rails

0. Add `gem 'ldclient-rb'` to your Gemfile and `bundle install`
1. Add `gem 'ldclient-rb'` to your Gemfile and `bundle install`

1. Initialize the launchdarkly client in `config/initializers/launchdarkly.rb`:
2. Initialize the launchdarkly client in `config/initializers/launchdarkly.rb`:

```ruby
```ruby
Rails.configuration.ld_client = LaunchDarkly::LDClient.new("your_sdk_key")
```

2. You may want to include a function in your ApplicationController
3. You may want to include a function in your ApplicationController

```ruby
```ruby
def launchdarkly_settings
if current_user.present?
{
Expand All @@ -72,31 +72,44 @@ Rails.configuration.ld_client = LaunchDarkly::LDClient.new("your_sdk_key")
end
```

3. In your controllers, access the client using
4. In your controllers, access the client using

```ruby
```ruby
Rails.application.config.ld_client.variation('your.flag.key', launchdarkly_settings, false)
```

Note that this gem will automatically switch to using the Rails logger it is detected.


Your first feature flag
-----------------------

1. Create a new feature flag on your [dashboard](https://app.launchdarkly.com).
2. In your application code, use the feature's key to check whether the flag is on for each user:

```ruby
if client.variation("your.flag.key", {key: "user@test.com"}, false)
# application code to show the feature
else
# the code to run if the feature is off
end
```

HTTPS proxy
------------
The Ruby SDK uses Faraday and Socketry to handle its network traffic. Both of these provide built-in support for the use of an HTTPS proxy. If the HTTPS_PROXY environment variable is present then the SDK will proxy all network requests through the URL provided.
-----------

The Ruby SDK uses Faraday and Socketry to handle its network traffic. Both of these provide built-in support for the use of an HTTPS proxy. If the HTTPS_PROXY environment variable is present then the SDK will proxy all network requests through the URL provided. (HTTP_PROXY is not used because all LaunchDarkly services require HTTPS.)

How to set the HTTPS_PROXY environment variable on Mac/Linux systems:
```
export HTTPS_PROXY=https://web-proxy.domain.com:8080
```


How to set the HTTPS_PROXY environment variable on Windows systems:
```
set HTTPS_PROXY=https://web-proxy.domain.com:8080
```


If your proxy requires authentication then you can prefix the URN with your login information:
```
export HTTPS_PROXY=http://user:pass@web-proxy.domain.com:8080
Expand All @@ -106,29 +119,22 @@ or
set HTTPS_PROXY=http://user:pass@web-proxy.domain.com:8080
```

Database integrations
---------------------

Your first feature flag
-----------------------

1. Create a new feature flag on your [dashboard](https://app.launchdarkly.com)
2. In your application code, use the feature's key to check whether the flag is on for each user:

```ruby
if client.variation("your.flag.key", {key: "user@test.com"}, false)
# application code to show the feature
else
# the code to run if the feature is off
end
```
Feature flag data can be kept in a persistent store using Redis, DynamoDB, or Consul. These adapters are implemented in the `LaunchDarkly::Integrations::Redis`, `LaunchDarkly::Integrations::DynamoDB`, and `LaunchDarkly::Integrations::Consul` modules; to use them, call the `new_feature_store` method in the module, and put the returned object in the `feature_store` property of your client configuration. See the [API documentation](https://www.rubydoc.info/gems/ldclient-rb/LaunchDarkly/Integrations) and the [SDK reference guide](https://docs.launchdarkly.com/v2.0/docs/using-a-persistent-feature-store) for more information.

Using flag data from a file
---------------------------
For testing purposes, the SDK can be made to read feature flag state from a file or files instead of connecting to LaunchDarkly. See [`file_data_source.rb`](https://github.com/launchdarkly/ruby-client/blob/master/lib/ldclient-rb/file_data_source.rb) for more details.

For testing purposes, the SDK can be made to read feature flag state from a file or files instead of connecting to LaunchDarkly. See `LaunchDarkly::FileDataSource` or the [SDK reference guide](https://docs.launchdarkly.com/v2.0/docs/reading-flags-from-a-file) for more details.

Learn more
-----------

Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [complete reference guide for this SDK](http://docs.launchdarkly.com/docs/ruby-sdk-reference).
Check out our [documentation](http://docs.launchdarkly.com) for in-depth instructions on configuring and using LaunchDarkly. You can also head straight to the [reference guide for this SDK](http://docs.launchdarkly.com/docs/ruby-sdk-reference).

Generated API documentation is on [RubyDoc.info](https://www.rubydoc.info/gems/ldclient-rb).

Testing
-------
Expand All @@ -138,10 +144,10 @@ We run integration tests for all our SDKs using a centralized test harness. This
Contributing
------------

See [Contributing](https://github.com/launchdarkly/ruby-client/blob/master/CONTRIBUTING.md)
See [Contributing](https://github.com/launchdarkly/ruby-client/blob/master/CONTRIBUTING.md).

About LaunchDarkly
-----------
------------------

* LaunchDarkly is a continuous delivery platform that provides feature flags as a service and allows developers to iterate quickly and safely. We allow you to easily flag your features and manage them from the LaunchDarkly dashboard. With LaunchDarkly, you can:
* Roll out a new feature to a subset of your users (like a group of users who opt-in to a beta tester group), gathering feedback and bug reports from real-world use cases.
Expand All @@ -153,9 +159,9 @@ About LaunchDarkly
* [JavaScript](http://docs.launchdarkly.com/docs/js-sdk-reference "LaunchDarkly JavaScript SDK")
* [PHP](http://docs.launchdarkly.com/docs/php-sdk-reference "LaunchDarkly PHP SDK")
* [Python](http://docs.launchdarkly.com/docs/python-sdk-reference "LaunchDarkly Python SDK")
* [Python Twisted](http://docs.launchdarkly.com/docs/python-twisted-sdk-reference "LaunchDarkly Python Twisted SDK")
* [Go](http://docs.launchdarkly.com/docs/go-sdk-reference "LaunchDarkly Go SDK")
* [Node.JS](http://docs.launchdarkly.com/docs/node-sdk-reference "LaunchDarkly Node SDK")
* [Electron](http://docs.launchdarkly.com/docs/electron-sdk-reference "LaunchDarkly Electron SDK")
* [.NET](http://docs.launchdarkly.com/docs/dotnet-sdk-reference "LaunchDarkly .Net SDK")
* [Ruby](http://docs.launchdarkly.com/docs/ruby-sdk-reference "LaunchDarkly Ruby SDK")
* [iOS](http://docs.launchdarkly.com/docs/ios-sdk-reference "LaunchDarkly iOS SDK")
Expand Down
7 changes: 4 additions & 3 deletions ldclient-rb.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,19 @@ Gem::Specification.new do |spec|
spec.summary = "LaunchDarkly SDK for Ruby"
spec.description = "Official LaunchDarkly SDK for Ruby"
spec.homepage = "https://github.com/launchdarkly/ruby-client"
spec.license = "Apache 2.0"
spec.license = "Apache-2.0"

spec.files = `git ls-files -z`.split("\x0")
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
spec.require_paths = ["lib"]
spec.extensions = 'ext/mkrf_conf.rb'

spec.add_development_dependency "aws-sdk-dynamodb", "~> 1.18"
spec.add_development_dependency "bundler", "~> 1.7"
spec.add_development_dependency "rspec", "~> 3.2"
spec.add_development_dependency "codeclimate-test-reporter", "~> 0"
spec.add_development_dependency "diplomat", ">= 2.0.2"
spec.add_development_dependency "redis", "~> 3.3.5"
spec.add_development_dependency "connection_pool", ">= 2.1.2"
spec.add_development_dependency "rake", "~> 10.0"
Expand All @@ -37,6 +39,5 @@ Gem::Specification.new do |spec|
spec.add_runtime_dependency "semantic", "~> 1.6"
spec.add_runtime_dependency "net-http-persistent", [">= 2.9", "< 4.0"]
spec.add_runtime_dependency "concurrent-ruby", "~> 1.0"
spec.add_runtime_dependency "http_tools", '~> 0.4.5'
spec.add_runtime_dependency "socketry", "~> 0.5.1"
spec.add_runtime_dependency "ld-eventsource", '~> 1.0'
end
10 changes: 9 additions & 1 deletion lib/ldclient-rb.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@

#
# Namespace for the LaunchDarkly Ruby SDK.
#
module LaunchDarkly
end

require "ldclient-rb/version"
require "ldclient-rb/interfaces"
require "ldclient-rb/util"
require "ldclient-rb/evaluation"
require "ldclient-rb/flags_state"
Expand All @@ -16,6 +24,6 @@
require "ldclient-rb/non_blocking_thread_pool"
require "ldclient-rb/event_summarizer"
require "ldclient-rb/events"
require "ldclient-rb/redis_store"
require "ldclient-rb/requestor"
require "ldclient-rb/file_data_source"
require "ldclient-rb/integrations"
1 change: 1 addition & 0 deletions lib/ldclient-rb/cache_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ module LaunchDarkly
#
# @see https://github.com/plataformatec/faraday-http-cache
# @see https://github.com/ruby-concurrency
# @private
#
class ThreadSafeMemoryStore
#
Expand Down
Loading

0 comments on commit 1203b75

Please sign in to comment.