flipper-mongo 0.22.1 → 0.24.0

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: 472f2506e5298edc2bb29378d54a7abd80e507dd2712450953812f4440cdca5f
4
- data.tar.gz: 29f985975df09a5587783063fe733aebc22332ea290552aa48e2a862ddb1f765
3
+ metadata.gz: 82abdc9efbf82cc07c58102558651f18998d767a86b4af62989b48c2d1a9c4ed
4
+ data.tar.gz: 49af63a4e6633e5af89582ddb71c574cde6ae619391b8441b67cae8fb424ea80
5
5
  SHA512:
6
- metadata.gz: 90d965f4da52028744085412ce27f13a0fba811b4a0eb39234646bc57259e320b4c426d9da742ff09076c094bec2e19349bbddf9eb62017876d6b1aa860b08cf
7
- data.tar.gz: 77a9c590a09c679cd43312f580a6716ea189903515399e3e046d6a8578689764907b37548b83a19bff3c71aa18a142140a317102a09eff8a64583d7b79e2b651
6
+ metadata.gz: 19947ec9b70028ff99e1313c8eeb1a054c8cc5ad11446a488ecd7a4b8f47a62853d353939fdbbce2426481cdd8838d8b8c777388612464d7726d4b05a0cb0776
7
+ data.tar.gz: d7afa40ff3ccc9ff80d8019034af4cc1bad03c69fc4ae8b81656c24c629238ecd7fd2af2c24fc14a3e279958e1cafafbf79854545618d1c362bf509ff86b26a3
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.22.1'.freeze
2
+ VERSION = '0.24.0'.freeze
3
3
  end
@@ -1,6 +1,4 @@
1
- require 'helper'
2
1
  require 'flipper/adapters/mongo'
3
- require 'flipper/spec/shared_adapter_specs'
4
2
 
5
3
  Mongo::Logger.logger.level = Logger::INFO
6
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flipper-mongo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.1
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Nunemaker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-23 00:00:00.000000000 Z
11
+ date: 2022-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: flipper
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.22.1
19
+ version: 0.24.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.22.1
26
+ version: 0.24.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mongo
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -45,7 +45,6 @@ executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
47
47
  files:
48
- - docs/mongo/README.md
49
48
  - examples/mongo/basic.rb
50
49
  - examples/mongo/internals.rb
51
50
  - flipper-mongo.gemspec
@@ -74,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
73
  - !ruby/object:Gem::Version
75
74
  version: '0'
76
75
  requirements: []
77
- rubygems_version: 3.0.3
76
+ rubygems_version: 3.1.2
78
77
  signing_key:
79
78
  specification_version: 4
80
79
  summary: Mongo adapter for Flipper
data/docs/mongo/README.md DELETED
@@ -1,95 +0,0 @@
1
- # Flipper Mongo
2
-
3
- A [MongoDB](https://github.com/mongodb/mongo-ruby-driver) adapter for [Flipper](https://github.com/jnunemaker/flipper).
4
-
5
- ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'flipper-mongo'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself with:
16
-
17
- $ gem install flipper-mongo
18
-
19
- ## Usage
20
-
21
- In most cases, all you need to do is require the adapter. You must set the `MONGO_URL` or `FLIPPER_MONGO_URL` environment vairable to specify which Mongo database to connect to.
22
-
23
- ```ruby
24
- require 'flipper-mongo`
25
- ```
26
-
27
- **If you need to customize the adapter**, you can add this to an initializer:
28
-
29
- ```ruby
30
- Flipper.configure do |config|
31
- config.adapter do
32
- collection = Mongo::Client.new(ENV["MONGO_URL"])["flipper"]
33
- Flipper::Adapters::Mongo.new(collection)
34
- end
35
- end
36
- ```
37
-
38
- ## Internals
39
-
40
- Each feature is stored in a document, which means getting a feature is single query.
41
-
42
- ```ruby
43
- require 'flipper/adapters/mongo'
44
- collection = Mongo::Client.new(["127.0.0.1:27017"], database: 'testing')['flipper']
45
- adapter = Flipper::Adapters::Mongo.new(collection)
46
- flipper = Flipper.new(adapter)
47
-
48
- # Register a few groups.
49
- Flipper.register(:admins) { |thing| thing.admin? }
50
- Flipper.register(:early_access) { |thing| thing.early_access? }
51
-
52
- # Create a user class that has flipper_id instance method.
53
- User = Struct.new(:flipper_id)
54
-
55
- flipper[:stats].enable
56
- flipper[:stats].enable_group :admins
57
- flipper[:stats].enable_group :early_access
58
- flipper[:stats].enable_actor User.new('25')
59
- flipper[:stats].enable_actor User.new('90')
60
- flipper[:stats].enable_actor User.new('180')
61
- flipper[:stats].enable_percentage_of_time 15
62
- flipper[:stats].enable_percentage_of_actors 45
63
-
64
- flipper[:search].enable
65
-
66
- puts 'all docs in collection'
67
- pp collection.find.to_a
68
- # all docs in collection
69
- # [{"_id"=>"stats",
70
- # "actors"=>["25", "90", "180"],
71
- # "boolean"=>"true",
72
- # "groups"=>["admins", "early_access"],
73
- # "percentage_of_actors"=>"45",
74
- # "percentage_of_time"=>"15"},
75
- # {"_id"=>"flipper_features", "features"=>["stats", "search"]},
76
- # {"_id"=>"search", "boolean"=>"true"}]
77
- puts
78
-
79
- puts 'flipper get of feature'
80
- pp adapter.get(flipper[:stats])
81
- # flipper get of feature
82
- # {:boolean=>"true",
83
- # :groups=>#<Set: {"admins", "early_access"}>,
84
- # :actors=>#<Set: {"25", "90", "180"}>,
85
- # :percentage_of_actors=>"45",
86
- # :percentage_of_time=>"15"}
87
- ```
88
-
89
- ## Contributing
90
-
91
- 1. Fork it
92
- 2. Create your feature branch (`git checkout -b my-new-feature`)
93
- 3. Commit your changes (`git commit -am 'Added some feature'`)
94
- 4. Push to the branch (`git push origin my-new-feature`)
95
- 5. Create new Pull Request