flipper-mongo 0.22.2 → 0.23.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
2
  SHA256:
3
- metadata.gz: 54281ecfd2133869dc9e3101dace69dba44414a076c89cef28f9deb42d6b716e
4
- data.tar.gz: c7f688c3fbd650129ee2bcae0cc73e7f48b5d2fe12d23aca50cce0f01af05452
3
+ metadata.gz: 4e2cc28a49335c3d4d289b2e250a799c56d012a76c07d6f922b4708cf29dcd7f
4
+ data.tar.gz: e1b01c71d6121b46bdb74e8395ebe280d3fcc648c6b723ae548b06e6c1f36f2d
5
5
  SHA512:
6
- metadata.gz: 71a103069685afc72c684433d09430fee52c2ea0a21726a06e4c0615c6071ecfb53483831588a10653898d4f33d9584f58d89a77484a328682c0779234477f3f
7
- data.tar.gz: 47883b86b7b38f92deb4986b8006e726203427b94371761f3ef2541067895ae30a33fd6ceec9d212c4b0d072217fcaa1382c2951142e504187c09422b897804a
6
+ metadata.gz: ccfd1669cb97c48225975195805218eb7054c644fd51f3de7cb7500484ec40dd96513608e739f0f743b480c7386c22fcefc46b8af9cb00adfefa012564147505
7
+ data.tar.gz: 42779b6f4fd919b9b78c07d638b3d6f35c7863d35a6648dd3d7b26dffc012fed405b5d54234ee8c9c056e74bd5389b9a71688a5c442d450031781f57fe916db4
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.22.2'.freeze
2
+ VERSION = '0.23.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.2
4
+ version: 0.23.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-10-06 00:00:00.000000000 Z
11
+ date: 2021-12-24 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.2
19
+ version: 0.23.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.2
26
+ version: 0.23.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,105 +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're using Mongoid**, you can add this to an initializer:
28
-
29
- ```ruby
30
- Flipper.configure do |config|
31
- config.adapter do
32
- Flipper::Adapters::Mongo.new(Mongoid.default_client['flipper'])
33
- end
34
- end
35
- ```
36
-
37
- Or **if you need to customize the adapter** in any other way, you can add this to an initializer:
38
-
39
- ```ruby
40
- Flipper.configure do |config|
41
- config.adapter do
42
- collection = Mongo::Client.new(ENV["MONGO_URL"])["flipper"]
43
- Flipper::Adapters::Mongo.new(collection)
44
- end
45
- end
46
- ```
47
-
48
- ## Internals
49
-
50
- Each feature is stored in a document, which means getting a feature is single query.
51
-
52
- ```ruby
53
- require 'flipper/adapters/mongo'
54
- collection = Mongo::Client.new(["127.0.0.1:27017"], database: 'testing')['flipper']
55
- adapter = Flipper::Adapters::Mongo.new(collection)
56
- flipper = Flipper.new(adapter)
57
-
58
- # Register a few groups.
59
- Flipper.register(:admins) { |thing| thing.admin? }
60
- Flipper.register(:early_access) { |thing| thing.early_access? }
61
-
62
- # Create a user class that has flipper_id instance method.
63
- User = Struct.new(:flipper_id)
64
-
65
- flipper[:stats].enable
66
- flipper[:stats].enable_group :admins
67
- flipper[:stats].enable_group :early_access
68
- flipper[:stats].enable_actor User.new('25')
69
- flipper[:stats].enable_actor User.new('90')
70
- flipper[:stats].enable_actor User.new('180')
71
- flipper[:stats].enable_percentage_of_time 15
72
- flipper[:stats].enable_percentage_of_actors 45
73
-
74
- flipper[:search].enable
75
-
76
- puts 'all docs in collection'
77
- pp collection.find.to_a
78
- # all docs in collection
79
- # [{"_id"=>"stats",
80
- # "actors"=>["25", "90", "180"],
81
- # "boolean"=>"true",
82
- # "groups"=>["admins", "early_access"],
83
- # "percentage_of_actors"=>"45",
84
- # "percentage_of_time"=>"15"},
85
- # {"_id"=>"flipper_features", "features"=>["stats", "search"]},
86
- # {"_id"=>"search", "boolean"=>"true"}]
87
- puts
88
-
89
- puts 'flipper get of feature'
90
- pp adapter.get(flipper[:stats])
91
- # flipper get of feature
92
- # {:boolean=>"true",
93
- # :groups=>#<Set: {"admins", "early_access"}>,
94
- # :actors=>#<Set: {"25", "90", "180"}>,
95
- # :percentage_of_actors=>"45",
96
- # :percentage_of_time=>"15"}
97
- ```
98
-
99
- ## Contributing
100
-
101
- 1. Fork it
102
- 2. Create your feature branch (`git checkout -b my-new-feature`)
103
- 3. Commit your changes (`git commit -am 'Added some feature'`)
104
- 4. Push to the branch (`git push origin my-new-feature`)
105
- 5. Create new Pull Request