feature_flipper 1.2.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -5,6 +5,9 @@ FeatureFlipper is a simple library that allows you to restrict certain blocks
5
5
  of code to certain environments. This is mainly useful in projects where
6
6
  you deploy your application from HEAD and don't use branches.
7
7
 
8
+ Read more about the motivation in the
9
+ [introductory blog post](http://engineering.qype.com/2010/06/03/how-we-work-flipping-features/).
10
+
8
11
  Install
9
12
  -------
10
13
 
data/Rakefile CHANGED
@@ -11,11 +11,3 @@ Rake::TestTask.new(:test) do |t|
11
11
  t.pattern = 'test/**/*_test.rb'
12
12
  t.verbose = true
13
13
  end
14
-
15
- begin
16
- require 'mg'
17
- MG.new('feature_flipper.gemspec')
18
- rescue LoadError
19
- warn 'mg not available.'
20
- warn 'Install it with: gem install mg'
21
- end
@@ -38,6 +38,10 @@ module FeatureFlipper
38
38
  @states = states
39
39
  end
40
40
 
41
+ def self.active_features
42
+ features.keys.select { |feature| is_active?(feature) }
43
+ end
44
+
41
45
  def self.get_state(feature_name)
42
46
  feature = features[feature_name]
43
47
  feature ? feature[:state] : nil
@@ -9,5 +9,9 @@ module FeatureFlipper
9
9
  def show_feature?(feature_name)
10
10
  FeatureFlipper::Config.is_active?(feature_name)
11
11
  end
12
+
13
+ def active_features
14
+ FeatureFlipper::Config.active_features
15
+ end
12
16
  end
13
17
  end
@@ -1,3 +1,3 @@
1
1
  module FeatureFlipper
2
- Version = VERSION = '1.2.0'
2
+ Version = VERSION = '1.3.0'
3
3
  end
@@ -70,6 +70,18 @@ context 'DSL based FeatureFlipper' do
70
70
  assert_equal :dev, all_features[:dev_feature][:state]
71
71
  assert_equal 'dev feature', all_features[:dev_feature][:description]
72
72
  end
73
+
74
+ test 'should be able to get active features' do
75
+ Rails.stubs(:env).returns('production')
76
+ FeatureFlipper::Config.ensure_config_is_loaded
77
+ active_features = FeatureFlipper::Config.active_features
78
+
79
+ assert_equal 3, active_features.size
80
+ assert active_features.include?(:live_feature)
81
+ assert active_features.include?(:boolean_feature)
82
+ assert active_features.include?(:proc_feature)
83
+ end
84
+
73
85
  end
74
86
 
75
87
  context 'dynamic feature groups' do
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: feature_flipper
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 1
7
- - 2
8
- - 0
9
- version: 1.2.0
4
+ prerelease:
5
+ version: 1.3.0
10
6
  platform: ruby
11
7
  authors:
12
8
  - Florian Munz
@@ -14,7 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2010-06-01 00:00:00 +02:00
13
+ date: 2011-02-28 00:00:00 +01:00
18
14
  default_executable:
19
15
  dependencies: []
20
16
 
@@ -23,7 +19,7 @@ description: |
23
19
  of code to certain environments. This is mainly useful in projects where
24
20
  you deploy your application from HEAD and don't use branches.
25
21
 
26
- email: florian@qype.com
22
+ email: surf@theflow.de
27
23
  executables: []
28
24
 
29
25
  extensions: []
@@ -55,23 +51,21 @@ rdoc_options: []
55
51
  require_paths:
56
52
  - lib
57
53
  required_ruby_version: !ruby/object:Gem::Requirement
54
+ none: false
58
55
  requirements:
59
56
  - - ">="
60
57
  - !ruby/object:Gem::Version
61
- segments:
62
- - 0
63
58
  version: "0"
64
59
  required_rubygems_version: !ruby/object:Gem::Requirement
60
+ none: false
65
61
  requirements:
66
62
  - - ">="
67
63
  - !ruby/object:Gem::Version
68
- segments:
69
- - 0
70
64
  version: "0"
71
65
  requirements: []
72
66
 
73
67
  rubyforge_project:
74
- rubygems_version: 1.3.6
68
+ rubygems_version: 1.5.0
75
69
  signing_key:
76
70
  specification_version: 3
77
71
  summary: FeatureFlipper helps you flipping features