togls 2.2.1 → 3.0.0.pre.rc.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,43 +0,0 @@
1
- module Togls
2
- # Release Toggle Registry Manager
3
- #
4
- # This is the primary DSL interface. It provides a DSL to facilitate housing
5
- # and managing a toggle registry.
6
- module ReleaseToggleRegistryManager
7
- def self.included(mod)
8
- mod.extend(ClassMethods)
9
- end
10
-
11
- # Release Toggle Registry Manager Class Methods
12
- #
13
- # The class methods that should be extended onto the module/class when
14
- # ReleaseToggleRegistryManager is included.
15
- module ClassMethods
16
- def features(&block)
17
- if @feature_toggle_registry.nil?
18
- @feature_toggle_registry = FeatureToggleRegistry.new
19
- end
20
-
21
- @feature_toggle_registry.expand(&block) if block
22
-
23
- @feature_toggle_registry
24
- end
25
-
26
- def features=(feature_toggle_registry)
27
- @feature_toggle_registry = feature_toggle_registry
28
- end
29
-
30
- def feature(key)
31
- if @feature_toggle_registry.nil?
32
- @feature_toggle_registry = FeatureToggleRegistry.new
33
- end
34
-
35
- @feature_toggle_registry.get(key)
36
- end
37
-
38
- def logger
39
- @logger ||= Logger.new(STDOUT)
40
- end
41
- end
42
- end
43
- end
@@ -1,26 +0,0 @@
1
- module Togls
2
- # Test Toggle Registry
3
- #
4
- # The Test Toggle Registry is a toggle feature toggle registry specifically
5
- # intended to be used in the use case of automated test suites. The difference
6
- # between this toggle registry and the normal FeatureToggleRegistry is that
7
- # this registry only uses in-memory drivers and the FeatureToggleRegistry uses
8
- # in-memory drivers as well as the environment override drivers.
9
- class TestToggleRegistry < FeatureToggleRegistry
10
- def initialize
11
- @toggle_repository_drivers = [
12
- Togls::ToggleRepositoryDrivers::InMemoryDriver.new]
13
- @feature_repository_drivers =
14
- [Togls::FeatureRepositoryDrivers::InMemoryDriver.new]
15
- @rule_repository_drivers =
16
- [Togls::RuleRepositoryDrivers::InMemoryDriver.new]
17
- @feature_repository = Togls::FeatureRepository.new(
18
- @feature_repository_drivers)
19
- @rule_repository = Togls::RuleRepository.new(@rule_repository_drivers)
20
- @toggle_repository = Togls::ToggleRepository.new(
21
- @toggle_repository_drivers, @feature_repository, @rule_repository)
22
- @rule_repository.store(Togls::Rules::Boolean.new(true))
23
- @rule_repository.store(Togls::Rules::Boolean.new(false))
24
- end
25
- end
26
- end