flipper-mongo 0.22.0 → 0.23.1

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: 2fd4b4c082d607eeddc08d1ebdb206553ce1814fe9d9c8811d65aa0a3bfa8bfd
4
- data.tar.gz: 5f7ac3bfbd3dfd8a397522b82a600d7a0d189d10fcb6c31b1849dcca6b6ea812
3
+ metadata.gz: 1a7e9989edcdff6f4708ad5cc7a8fa19928a2d5f4112ec1d5d71d20e110c7895
4
+ data.tar.gz: 28c85443d94301bdb17c8b487c5e8f6b35bba36183e1252ddc4dcfc900bf3f08
5
5
  SHA512:
6
- metadata.gz: 0f4745eade20a35ea4d016da1b3a13faf0694524255e10f1aea4d990b548c4acb1bada50d42faa44d6dc4fd3b974f9a6dd6c747f23bffb2ba4ce7cbe70c18c65
7
- data.tar.gz: 838b7a4b7745bd9b10fcdee0c87294f236901e1f4263f369b0359260070fcc936333e1a310a5ab222062bf8ce5abb6264a5abc4d266c9eebec52476533820259
6
+ metadata.gz: 32b85972330c8344802cfa1951efa9edd3cabf8d3053777def63275458d3af0897ad463ac51646ab32c8ff67030cce2bd5f84a005f31dfb68fef4b668cb63565
7
+ data.tar.gz: 35628f28d0191727d21eead217a9cb7e77c20a2f4e65c759ff410fb07a819f745c0c252629ac19f04d21e2b59d272a0edcbb424ea81613215b02968e4f4f8e3a
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.22.0'.freeze
2
+ VERSION = '0.23.1'.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.0
4
+ version: 0.23.1
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-07-08 00:00:00.000000000 Z
11
+ date: 2022-01-19 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.0
19
+ version: 0.23.1
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.0
26
+ version: 0.23.1
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