abstract_feature_branch 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -28,10 +28,9 @@ Setup
28
28
  - Configure config/features.yml in your Rails app directory as follows:
29
29
 
30
30
  > defaults: &defaults
31
- > features:
32
- > feature1: true
33
- > feature2: true
34
- > feature3: false
31
+ > feature1: true
32
+ > feature2: true
33
+ > feature3: false
35
34
  >
36
35
  > development:
37
36
  > <<: *defaults
@@ -41,13 +40,12 @@ Setup
41
40
  >
42
41
  > staging:
43
42
  > <<: *defaults
44
- > feature2: false
43
+ > feature2: false
45
44
  >
46
45
  > production:
47
46
  > <<: *defaults
48
- > features:
49
- > feature1: false
50
- > feature2: false
47
+ > feature1: false
48
+ > feature2: false
51
49
 
52
50
  Notice how the feature "feature1" was configured as true (enabled) by default, but
53
51
  overridden as false (disabled) in production. This is a recommended practice.
@@ -113,6 +111,12 @@ for better maintenance as the need is not longer there for feature branching at
113
111
  Release Notes
114
112
  -------------
115
113
 
114
+ Version 0.3.0:
115
+
116
+ - Simplified features.yml requirement to have a features header under each environment
117
+ - Removed dependency on the rails_config gem
118
+ - Moved feature storage from Settings object to AbstractFeatureBranch::FEATURES
119
+
116
120
  Version 0.2.0:
117
121
 
118
122
  - Support an "else" block to execute when a feature is off (via :true and :false lambda arguments)
@@ -124,7 +128,6 @@ Upcoming
124
128
  - Support the option of having multiple features.yml files, one per environment, as opposed to one for all environments
125
129
  - Support general Ruby (non-Rails) use
126
130
  - Support contexts of features to group features, once they grow beyond a certain size, in separate files, one per context
127
- - Simplify features.yml requirement to have a features header under each environment
128
131
  - Add rake task to reorder feature entries in feature.yml alphabetically
129
132
 
130
133
  Contributing to abstract_feature_branch
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "abstract_feature_branch"
8
- s.version = "0.2.0"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Annas \"Andy\" Maleh"]
12
- s.date = "2012-11-25"
12
+ s.date = "2012-12-13"
13
13
  s.description = "It gives ability to wrap blocks of code with an abstract feature branch name, and then\nspecify which features to be switched on or off in a configuration file.\n\nThe goal is to build out future features with full integration into the codebase, thus\nensuring no delay in integration in the future, while releasing currently done features\nat the same time. Developers then disable future features until they are ready to be\nswitched on in production, but do enable them in staging and locally.\n\nThis gives developers the added benefit of being able to switch a feature off after\nrelease should big problems arise for a high risk feature.\n"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
@@ -33,20 +33,17 @@ Gem::Specification.new do |s|
33
33
  s.specification_version = 3
34
34
 
35
35
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
36
- s.add_runtime_dependency(%q<rails_config>, [">= 0.3.1"])
37
36
  s.add_development_dependency(%q<rspec>, ["= 2.11.0"])
38
37
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
39
38
  s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
40
39
  s.add_runtime_dependency(%q<rails_config>, [">= 0.3.1"])
41
40
  else
42
- s.add_dependency(%q<rails_config>, [">= 0.3.1"])
43
41
  s.add_dependency(%q<rspec>, ["= 2.11.0"])
44
42
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
45
43
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
46
44
  s.add_dependency(%q<rails_config>, [">= 0.3.1"])
47
45
  end
48
46
  else
49
- s.add_dependency(%q<rails_config>, [">= 0.3.1"])
50
47
  s.add_dependency(%q<rspec>, ["= 2.11.0"])
51
48
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
52
49
  s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
+ require 'yaml'
3
4
  begin
4
5
  Bundler.setup(:default)
5
6
  rescue Bundler::BundlerError => e
@@ -7,16 +8,9 @@ rescue Bundler::BundlerError => e
7
8
  $stderr.puts "Run `bundle install` to install missing gems"
8
9
  exit e.status_code
9
10
  end
10
- require 'rails_config'
11
11
 
12
- RailsConfig.setup do |config|
13
- config.const_name = "Settings"
12
+ module AbstractFeatureBranch
13
+ FEATURES = YAML.load_file(File.join(Rails.root, 'config', 'features.yml'))
14
14
  end
15
- RailsConfig.load_and_set_settings("#{Rails.root}/config/features.yml")
16
-
17
- # Add this line if you need a local override. Make sure it is added to .gitignore
18
- #Settings.add_source!("#{Rails.root}/config/features.local.yml")
19
-
20
- Settings.reload!
21
15
 
22
16
  require File.join(File.dirname(__FILE__), 'ext', 'feature_branch')
@@ -3,22 +3,22 @@ class Object
3
3
  def self.feature_branch(feature_name, branches = {}, &feature_work)
4
4
  branches[:true] ||= feature_work
5
5
  branches[:false] ||= lambda {}
6
- feature_status = Settings[Rails.env.to_s]['features'][feature_name].to_s.to_sym
6
+ feature_status = AbstractFeatureBranch::FEATURES[Rails.env.to_s][feature_name.to_s].to_s.to_sym
7
7
  branches[feature_status].call
8
8
  end
9
9
 
10
10
  raise 'Abstract feature branch conflicts with another Ruby library' if respond_to?(:feature_enabled?)
11
11
  def self.feature_enabled?(feature_name)
12
- Settings[Rails.env.to_s]['features'][feature_name]
12
+ AbstractFeatureBranch::FEATURES[Rails.env.to_s][feature_name.to_s]
13
13
  end
14
14
 
15
15
  raise 'Abstract feature branch conflicts with another Ruby library' if Object.new.respond_to?(:feature_branch)
16
16
  def feature_branch(feature_name, branches = {}, &feature_work)
17
- Object.feature_branch(feature_name, branches, &feature_work)
17
+ Object.feature_branch(feature_name.to_s, branches, &feature_work)
18
18
  end
19
19
 
20
20
  raise 'Abstract feature branch conflicts with another Ruby library' if Object.new.respond_to?(:feature_enabled?)
21
21
  def feature_enabled?(feature_name)
22
- Object.feature_enabled?(feature_name)
22
+ Object.feature_enabled?(feature_name.to_s)
23
23
  end
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstract_feature_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,24 +9,8 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-11-25 00:00:00.000000000 Z
12
+ date: 2012-12-13 00:00:00.000000000 Z
13
13
  dependencies:
14
- - !ruby/object:Gem::Dependency
15
- name: rails_config
16
- requirement: !ruby/object:Gem::Requirement
17
- none: false
18
- requirements:
19
- - - ! '>='
20
- - !ruby/object:Gem::Version
21
- version: 0.3.1
22
- type: :runtime
23
- prerelease: false
24
- version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ! '>='
28
- - !ruby/object:Gem::Version
29
- version: 0.3.1
30
14
  - !ruby/object:Gem::Dependency
31
15
  name: rspec
32
16
  requirement: !ruby/object:Gem::Requirement
@@ -141,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
141
125
  version: '0'
142
126
  segments:
143
127
  - 0
144
- hash: 2916198605962621809
128
+ hash: 1701296870089000917
145
129
  required_rubygems_version: !ruby/object:Gem::Requirement
146
130
  none: false
147
131
  requirements: