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.
@@ -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
@@ -3,20 +3,20 @@ class ThisFeature
3
3
  class Error < StandardError; end
4
4
 
5
5
  class UnimplementedError < Error
6
- def initialize(klass, fn_name)
7
- super("class #{klass.name} doesnt implement method .#{fn_name}")
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(adapter)
13
- super("adapter #{adapter.name} doesn't inherit from ThisFeature::Adapters::Base")
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 NoWriteAdapter < Error
17
+ class NoAdaptersError < Error
18
18
  def initialize
19
- super("Use the `ThisFeature.write_adapter=` setter before calling #enable or #disable")
19
+ super("No adapters configured.")
20
20
  end
21
21
  end
22
22
 
@@ -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
@@ -1,3 +1,3 @@
1
1
  class ThisFeature
2
- VERSION = "0.3.0"
2
+ VERSION = "0.5.2"
3
3
  end
@@ -18,6 +18,7 @@ Gem::Specification.new do |s|
18
18
  s.platform = Gem::Platform::RUBY
19
19
  s.require_paths = ['lib']
20
20
 
21
+ s.add_runtime_dependency "this_feature"
21
22
  s.add_runtime_dependency "flipper", "~> 0.16"
22
23
  s.add_runtime_dependency "flipper-active_record", "~> 0.16"
23
24
  end
@@ -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.3.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-08-26 00:00:00.000000000 Z
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.1.2
168
+ rubygems_version: 3.0.3
162
169
  signing_key:
163
170
  specification_version: 4
164
171
  summary: Feature flag control