togls 1.1.0 → 2.0.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
  SHA1:
3
- metadata.gz: e723acd976b3387ca90f419b1bb628f6aba617ab
4
- data.tar.gz: 528b2d7d8575d3c54e5fcec95a65c3f3d371d2a8
3
+ metadata.gz: 6f11f55bb24ae3654bcebd4c45ce99a10f325b5d
4
+ data.tar.gz: dcd73b550500f2c72bff92a9f7bf78ba6a8f2844
5
5
  SHA512:
6
- metadata.gz: 03327c8c5b355d7297a6c56274567be505f15cc267862a85d7c32cbb602614298e5fb00869abebbe3c9c90a02d6b320330507645470c4a4a3bc42b4c82f756b6
7
- data.tar.gz: daae0c8edfdac0b28a602200525679e9db989c5fc091a0aaf4077439d586ce449d44dbffdfc33ca3b8dbea6ea899f8c3d0694a55fe051bd5185fc735c0777f66
6
+ metadata.gz: 31e475eedfd5e2e93e2abc494afdb2ad98cc287ea7a2cbda630ecb23eb67490f40523dd046a6b41888f885d6cdc1cf5187dacd6b4ba8a22d48b0a1b2322da450
7
+ data.tar.gz: 7c9401b65661dd1be31e08528b06c5dc31d26f35f7035590e89881835eedf3eb251e6df9329498e5f046a9e07af3eb30b1c1c2d8213805a6d9ed460d15e76ad0
data/ChangeLog.md CHANGED
@@ -6,6 +6,14 @@ versions, as well as provide a rough history.
6
6
 
7
7
  #### Next Release
8
8
 
9
+ ### v2.0.0
10
+
11
+ * Add ability to create empty feature toggle set via `Togls.features`
12
+ * Add toggle definition expansion with multiple `Togls.features` blocks
13
+ * Add set FeatureToggleRegistry instance, `Togls.features = toggle_registry`
14
+ * Change `Togls.features` to return FeatureToggleRegistry instance
15
+ rather than an Array of Toggle objects.
16
+
9
17
  #### v1.1.0
10
18
 
11
19
  * Add `off?` method for asking if a defined feature is off
data/README.md CHANGED
@@ -212,6 +212,8 @@ Reference](https://github.com/codebreakdown/togls/wiki/Provided-Rules-Reference)
212
212
  Rules](https://github.com/codebreakdown/togls/wiki/Custom-Rules),
213
213
  [Review Feature
214
214
  Toggles](https://github.com/codebreakdown/togls/wiki/Review-Feature-Toggles),
215
+ [Testing with
216
+ Toggles](https://github.com/codebreakdown/togls/wiki/Testing-with-Toggles)
215
217
  etc.
216
218
 
217
219
  ## Development
data/lib/tasks/togls.rake CHANGED
@@ -1,7 +1,7 @@
1
1
  namespace :togls do
2
2
  desc "Output all features including status (on, off, ? - unknown due to complex rule), key, description"
3
3
  task :features do
4
- Togls.features.each do |toggle|
4
+ Togls.features.all.each do |toggle|
5
5
  puts toggle.to_s
6
6
  end
7
7
  end
@@ -18,12 +18,17 @@ module Togls
18
18
  @rule_repository.store(@boolean_true_rule)
19
19
  end
20
20
 
21
- def self.create(&feature_toggles)
21
+ def self.create(&block)
22
22
  feature_toggle_registry = self.new
23
- feature_toggle_registry.instance_eval(&feature_toggles)
23
+ feature_toggle_registry.instance_eval(&block)
24
24
  return feature_toggle_registry
25
25
  end
26
26
 
27
+ def expand(&block)
28
+ self.instance_eval(&block)
29
+ return self
30
+ end
31
+
27
32
  def feature(key, desc)
28
33
  feature = Togls::Feature.new(key, desc)
29
34
  toggle = Togls::Toggle.new(feature)
@@ -39,7 +44,7 @@ module Togls
39
44
  return toggle
40
45
  end
41
46
 
42
- def registry
47
+ def all
43
48
  @toggle_repository.all
44
49
  end
45
50
  end
data/lib/togls/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Togls
2
- VERSION = "1.1.0"
2
+ VERSION = "2.0.0"
3
3
  end
data/lib/togls.rb CHANGED
@@ -21,16 +21,20 @@ require "togls/rules"
21
21
  require "logger"
22
22
 
23
23
  module Togls
24
- def self.features(&feature_toggles)
25
- if !feature_toggles.nil?
26
- @feature_toggle_registry = FeatureToggleRegistry.create(&feature_toggles)
27
- else
28
- if @feature_toggle_registry.nil?
29
- raise Togls::NoFeaturesError, "Need to define features before you can get them"
30
- else
31
- @feature_toggle_registry.registry
32
- end
24
+ def self.features(&block)
25
+ if @feature_toggle_registry.nil?
26
+ @feature_toggle_registry = FeatureToggleRegistry.new
33
27
  end
28
+
29
+ if block
30
+ @feature_toggle_registry.expand(&block)
31
+ end
32
+
33
+ return @feature_toggle_registry
34
+ end
35
+
36
+ def self.features=(feature_toggle_registry)
37
+ @feature_toggle_registry = feature_toggle_registry
34
38
  end
35
39
 
36
40
  def self.feature(key)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: togls
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Miller
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2015-11-17 00:00:00.000000000 Z
13
+ date: 2015-11-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler