flipper-mongo 0.21.0 → 0.23.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: 656ce494cea1f36610fece84fe1557426d4843b430d4b845170632a4dd621615
4
- data.tar.gz: 487e7251d6f36477ba2eb8696675ae2acbeddf21d1b3185f91887a8b27982164
3
+ metadata.gz: 4e2cc28a49335c3d4d289b2e250a799c56d012a76c07d6f922b4708cf29dcd7f
4
+ data.tar.gz: e1b01c71d6121b46bdb74e8395ebe280d3fcc648c6b723ae548b06e6c1f36f2d
5
5
  SHA512:
6
- metadata.gz: ca358dde4ef62bcb98feb576dc64244366aa82e9e5a57d40ebdeb66e707e8fb316480906c74f77766aef8e2e396b42047023d95a34c4995f591abe56bcb4d823
7
- data.tar.gz: de6d0e904fbdc71fb00cac63d0474b9da3b2ee8124964020c0f6119ee6895c3ca286f2080af5c0098af20f09fdf374b227dcb5ead87691dfaad19c5bb18b312d
6
+ metadata.gz: ccfd1669cb97c48225975195805218eb7054c644fd51f3de7cb7500484ec40dd96513608e739f0f743b480c7386c22fcefc46b8af9cb00adfefa012564147505
7
+ data.tar.gz: 42779b6f4fd919b9b78c07d638b3d6f35c7863d35a6648dd3d7b26dffc012fed405b5d54234ee8c9c056e74bd5389b9a71688a5c442d450031781f57fe916db4
@@ -1,3 +1,3 @@
1
1
  module Flipper
2
- VERSION = '0.21.0'.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.21.0
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-05-09 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.21.0
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.21.0
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,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