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.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/CHANGELOG.md +107 -36
- data/README.md +12 -9
- data/lib/togls/default_feature_target_type_manager.rb +25 -0
- data/lib/togls/errors.rb +15 -4
- data/lib/togls/feature.rb +13 -1
- data/lib/togls/feature_repository.rb +28 -2
- data/lib/togls/feature_toggle_registry_manager.rb +138 -0
- data/lib/togls/helpers.rb +2 -2
- data/lib/togls/null_toggle.rb +4 -1
- data/lib/togls/rule.rb +29 -3
- data/lib/togls/rule_repository.rb +36 -3
- data/lib/togls/rule_repository_drivers/env_override_driver.rb +22 -0
- data/lib/togls/rule_type_registry.rb +38 -0
- data/lib/togls/rule_type_repository.rb +57 -0
- data/lib/togls/rule_type_repository_drivers/in_memory_driver.rb +52 -0
- data/lib/togls/rule_type_repository_drivers.rb +5 -0
- data/lib/togls/rules/boolean.rb +21 -1
- data/lib/togls/rules/group.rb +26 -0
- data/lib/togls/target_types.rb +9 -0
- data/lib/togls/toggle.rb +57 -13
- data/lib/togls/toggle_registry.rb +45 -0
- data/lib/togls/toggle_repository.rb +20 -5
- data/lib/togls/toggler.rb +6 -2
- data/lib/togls/version.rb +1 -1
- data/lib/togls.rb +11 -4
- data/togls.gemspec +1 -1
- metadata +15 -10
- data/lib/tasks/togls.rake +0 -9
- data/lib/togls/feature_toggle_registry.rb +0 -57
- data/lib/togls/release_toggle_registry_manager.rb +0 -43
- data/lib/togls/test_toggle_registry.rb +0 -26
@@ -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
|