this_feature 0.3.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +33 -5
- data/README.md +44 -29
- data/docs/flipper.html +1087 -0
- data/docs/flipper.md +41 -0
- data/docs/memory.md +88 -0
- data/docs/splitio.md +35 -0
- data/docs/writing_an_adapter.md +9 -0
- data/lib/this_feature.rb +6 -3
- data/lib/this_feature/adapters/base.rb +4 -17
- data/lib/this_feature/adapters/flipper.rb +20 -30
- data/lib/this_feature/adapters/memory.rb +22 -13
- data/lib/this_feature/adapters/split_io.rb +52 -0
- data/lib/this_feature/configuration.rb +8 -5
- data/lib/this_feature/errors.rb +6 -6
- data/lib/this_feature/flag.rb +0 -8
- data/lib/this_feature/version.rb +1 -1
- data/this_feature-adapters-flipper.gemspec +1 -0
- data/this_feature-adapters-split_io.gemspec +23 -0
- metadata +10 -3
@@ -1,17 +1,16 @@
|
|
1
|
-
|
2
1
|
class ThisFeature
|
3
2
|
class Configuration
|
4
|
-
attr_writer :adapters, :default_adapter
|
3
|
+
attr_writer :adapters, :default_adapter, :test_adapter
|
5
4
|
|
6
5
|
def init
|
7
6
|
validate_adapters!
|
8
|
-
|
9
|
-
adapters.each(&:setup)
|
10
7
|
end
|
11
8
|
|
12
9
|
def validate_adapters!
|
10
|
+
raise(NoAdaptersError.new) unless adapters.any?
|
11
|
+
|
13
12
|
adapters.each do |adapter|
|
14
|
-
raise BadAdapterError.new(adapter) unless adapter < Adapters::Base
|
13
|
+
raise BadAdapterError.new(adapter) unless adapter.class < Adapters::Base
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
@@ -22,5 +21,9 @@ class ThisFeature
|
|
22
21
|
def default_adapter
|
23
22
|
@default_adapter ||= adapters.first
|
24
23
|
end
|
24
|
+
|
25
|
+
def test_adapter
|
26
|
+
@test_adapter ||= Adapters::Memory.new
|
27
|
+
end
|
25
28
|
end
|
26
29
|
end
|
data/lib/this_feature/errors.rb
CHANGED
@@ -3,20 +3,20 @@ class ThisFeature
|
|
3
3
|
class Error < StandardError; end
|
4
4
|
|
5
5
|
class UnimplementedError < Error
|
6
|
-
def initialize(
|
7
|
-
super("class #{
|
6
|
+
def initialize(adapter_instance, fn_name)
|
7
|
+
super("class #{adapter_instance.class.name} doesnt implement method .#{fn_name}")
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
11
|
class BadAdapterError < Error
|
12
|
-
def initialize(
|
13
|
-
super("adapter #{
|
12
|
+
def initialize(adapter_instance)
|
13
|
+
super("adapter #{adapter_instance.class.name} doesn't inherit from #{ThisFeature::Adapters::Base.name}")
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
class
|
17
|
+
class NoAdaptersError < Error
|
18
18
|
def initialize
|
19
|
-
super("
|
19
|
+
super("No adapters configured.")
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
data/lib/this_feature/flag.rb
CHANGED
@@ -20,13 +20,5 @@ class ThisFeature
|
|
20
20
|
def control?
|
21
21
|
adapter.control?(flag_name, context: context, data: data)
|
22
22
|
end
|
23
|
-
|
24
|
-
def on!
|
25
|
-
adapter.on!(flag_name, context: context, data: data)
|
26
|
-
end
|
27
|
-
|
28
|
-
def off!
|
29
|
-
adapter.off!(flag_name, context: context, data: data)
|
30
|
-
end
|
31
23
|
end
|
32
24
|
end
|
data/lib/this_feature/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
$:.unshift File.expand_path('../lib', __FILE__)
|
4
|
+
|
5
|
+
require 'this_feature/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = 'this_feature-adapters-split_io'
|
9
|
+
s.version = ThisFeature::VERSION
|
10
|
+
s.authors = ['Max Pleaner', 'Matt Fong']
|
11
|
+
s.email = ['maxpleaner@gmail.com', 'matthewjf@gmail.com']
|
12
|
+
s.homepage = 'http://hover.to'
|
13
|
+
s.licenses = ['MIT']
|
14
|
+
s.summary = '[summary]'
|
15
|
+
s.description = '[description]'
|
16
|
+
|
17
|
+
s.files = Dir.glob('{bin/*,lib/**/*,[A-Z]*}')
|
18
|
+
s.platform = Gem::Platform::RUBY
|
19
|
+
s.require_paths = ['lib']
|
20
|
+
|
21
|
+
s.add_runtime_dependency "this_feature"
|
22
|
+
s.add_runtime_dependency "splitclient-rb"
|
23
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: this_feature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Max Pleaner
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -127,16 +127,23 @@ files:
|
|
127
127
|
- Rakefile
|
128
128
|
- bin/console
|
129
129
|
- bin/setup
|
130
|
+
- docs/flipper.html
|
131
|
+
- docs/flipper.md
|
132
|
+
- docs/memory.md
|
133
|
+
- docs/splitio.md
|
134
|
+
- docs/writing_an_adapter.md
|
130
135
|
- lib/this_feature.rb
|
131
136
|
- lib/this_feature/adapters.rb
|
132
137
|
- lib/this_feature/adapters/base.rb
|
133
138
|
- lib/this_feature/adapters/flipper.rb
|
134
139
|
- lib/this_feature/adapters/memory.rb
|
140
|
+
- lib/this_feature/adapters/split_io.rb
|
135
141
|
- lib/this_feature/configuration.rb
|
136
142
|
- lib/this_feature/errors.rb
|
137
143
|
- lib/this_feature/flag.rb
|
138
144
|
- lib/this_feature/version.rb
|
139
145
|
- this_feature-adapters-flipper.gemspec
|
146
|
+
- this_feature-adapters-split_io.gemspec
|
140
147
|
- this_feature.gemspec
|
141
148
|
homepage: https://github.com/hoverinc/this_feature
|
142
149
|
licenses: []
|
@@ -158,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
165
|
- !ruby/object:Gem::Version
|
159
166
|
version: '0'
|
160
167
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
168
|
+
rubygems_version: 3.0.3
|
162
169
|
signing_key:
|
163
170
|
specification_version: 4
|
164
171
|
summary: Feature flag control
|