featureflags 0.1.0 → 0.2.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: 762724b4bba1d8809b3b4e7dbcbbd5b309831259
4
- data.tar.gz: f6aa09c1cf29e26ace2609fa1818b369579245f7
3
+ metadata.gz: 7d56c1020343b02144f62e0cc58ce0186e786065
4
+ data.tar.gz: 2175dae2e97db7819efd081333569cabd65b9d92
5
5
  SHA512:
6
- metadata.gz: bf00765f2ccb091f3e2d6f41e1eee9dee6c26ccde01a63cfa2171f233d0a00c4220f92171157ab574ccb83a5b19c33f3462faf6cb153de85027acedba08ac856
7
- data.tar.gz: 8564a2cbf4ca5ed41318a26c8b10d985f039e83b9cb42d914f2dbc2120e410052e16e1b1b395bad780fbf672c6bea3d3d3a41094e5b7c7edfe0984ffa4ae583c
6
+ metadata.gz: fbeaeeca2a990a1001b1125e0309ca03b2011d55e1091755c52b002b2bf93cd9db8d10ee455849bfdafbec015040c8bca5e86ce01dcbcdb322f425ad02e4a7ec
7
+ data.tar.gz: c6deb7147c54c7339f9b7b7f9fb51ff7a5bb307e4589bc256849a257347390032beccaedea6b3759836bb28b2fee102e6624bc6404ec645f8b42b88a7824e76c
@@ -3,7 +3,7 @@
3
3
  Simple implementation of the 'Feature Flags' pattern as a Ruby gem.
4
4
  Allows you to set defaults in a Hash of the form:
5
5
 
6
- ```{ feature_name_1: true, feature_name_2: false, feature_with_variations: 'A' }```
6
+ { feature_name_1: true, feature_name_2: false, feature_with_variations: 'A' }
7
7
 
8
8
  and override them with correspondingly-named environment variables.
9
9
  In the example above, you could enable the feature 'feature_name_2' with the environment variable 'FEATURE_NAME_2'.
@@ -12,18 +12,18 @@ In the example above, you could enable the feature 'feature_name_2' with the env
12
12
 
13
13
  In your gemfile:
14
14
 
15
- ```gem "ministryofjustice-featureflags"```
15
+ gem "ministryofjustice-featureflags"
16
16
 
17
17
  === If you're using Rails:
18
18
 
19
19
  You can set defaults during Rails initialization, usually with a dedicated file in config/initializers:
20
20
 
21
- defaults = {
22
- some_feature: true,
23
- some_other_feature: false,
24
- another_feature: 'variant-1' # <- any non-falsey value will be treated as enabled
25
- }
26
- Features::FeatureFlags.init!(defaults)
21
+ defaults = {
22
+ some_feature: true,
23
+ some_other_feature: false,
24
+ another_feature: 'variant-1' # <- any non-falsey value will be treated as enabled
25
+ }
26
+ Features::FeatureFlags.init!(defaults)
27
27
 
28
28
  === Setting Flags With Environment Variables
29
29
 
@@ -33,29 +33,29 @@ You can *also* override these values by starting Rails with the correspondingly-
33
33
 
34
34
  In your application code:
35
35
 
36
- ```
36
+
37
37
  if FeatureFlags::Features.enabled?(:some_feature)
38
38
  # do something
39
39
  else
40
40
  # do something different
41
- ```
41
+
42
42
 
43
43
  Groups of features:
44
44
 
45
- ```
45
+
46
46
  # ALL
47
47
  if FeatureFlags::Features.all_enabled?(:some_feature, :some_other_feature)
48
48
 
49
49
  # ANY
50
50
  if FeatureFlags::Features.any_enabled?(:some_feature, :some_other_feature)
51
51
 
52
- ```
52
+
53
53
  == Non-boolean Flags
54
54
 
55
55
  When checking enabled?, any non-false-y value will return true.
56
56
  This allows you to transparently store non-boolean values in flags, for instance in A/B testing:
57
57
 
58
- ```
58
+
59
59
  Features::FeatureFlags.init!(my_feature_variant: 'variant-A')
60
60
 
61
61
  case Features::FeatureFlags.flag(:my_feature)
@@ -64,7 +64,7 @@ This allows you to transparently store non-boolean values in flags, for instance
64
64
  when 'variant-B'
65
65
  # do something else...
66
66
  end
67
- ```
67
+
68
68
 
69
69
  == Contributing to featureflags
70
70
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: featureflags 0.1.0 ruby lib
5
+ # stub: featureflags 0.2.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "featureflags"
9
- s.version = "0.1.0"
9
+ s.version = "0.2.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Al Davidson"]
14
- s.date = "2015-08-26"
14
+ s.date = "2015-09-01"
15
15
  s.description = "Simple implementation of the 'Feature Flags' pattern as a Ruby gem.\nAllows you to set defaults in a Hash of the form:\n\n ```{ feature_name_1: true, feature_name_2: false, feature_with_variations: 'A' }```\n\nand override them with correspondingly-named environment variables. \nIn the example above, you could enable the feature 'feature_name_2' with the environment variable 'FEATURE_NAME_2'.\n\n"
16
16
  s.email = "apdavidson@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -0,0 +1 @@
1
+ require 'featureflags/features'
@@ -24,7 +24,7 @@ module FeatureFlags
24
24
  # return all features which are enabled by default
25
25
  # i.e. not-false, regardless of environment variables
26
26
  def self.enabled_by_default
27
- @flags.select{|k,v| v}.map{|k,v| k}
27
+ @flags.select{|k,v| v}.keys
28
28
  end
29
29
 
30
30
  def self.any_enabled?(*names)
@@ -12,8 +12,10 @@ SimpleCov.configure do
12
12
  load_adapter 'test_frameworks'
13
13
  end
14
14
 
15
- ENV["COVERAGE"] && SimpleCov.start do
16
- add_filter "/.rvm/"
15
+ unless ENV["NO_COVERAGE"]
16
+ SimpleCov.start do
17
+ add_filter "/.rvm/"
18
+ end
17
19
  end
18
20
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
19
21
  $LOAD_PATH.unshift(File.dirname(__FILE__))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: featureflags
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Al Davidson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-26 00:00:00.000000000 Z
11
+ date: 2015-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: byebug