abstract_feature_branch 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 70434039046d4abb530e0cfd2119066f020e7088
4
- data.tar.gz: 1290d3e5b1918f2d8a0b39c80f40f760b39964ac
3
+ metadata.gz: 451914f38c3eb82bf78fcf7549db4dbcaeab5103
4
+ data.tar.gz: df3f6c916c67c6774bd3db2077676e5cd67e1f06
5
5
  SHA512:
6
- metadata.gz: 3c407410469aced7ae3b7697a2721dd98d0286d8e625fb032aff73644e3da77ebe5d70075cb41118c35bc1e54e2c7b99ec73da205754754e0da32bd8b2660775
7
- data.tar.gz: 024882e33b5920f5ec1eb329e60e1b281af9148f84d3a3841855a8ca7659be41084861b078c13ab72b5c82448036c564f8ce769897ae7b094071e7828eca0287
6
+ metadata.gz: 5a04bab0e3a6fc22f177d2b63d11abd6589d7fccff5699381614ba05974a1d58b6f75c7e031c4fe73c999702c275549182dd318bc268ceb890cf1c2ffc9e0cbe
7
+ data.tar.gz: 509c4250df3b21ac9d9b17d05afbfcfd0ed86681e1f8308c9727e271b10315b1f818160ac8d8499dfe7202c16a8c09eb920c47072513bf1195da61f6043d05fb
data/README.md CHANGED
@@ -19,7 +19,7 @@ This gives developers the added benefit of being able to switch a feature off af
19
19
  release should big problems arise for a high risk feature.
20
20
 
21
21
  abstract_feature_branch additionally supports [DDD](http://www.domaindrivendesign.org)'s pattern of
22
- [bounded contexts](http://dddcommunity.org/uncategorized/bounded-context/), but allowing developers to configure
22
+ [bounded contexts](http://dddcommunity.org/uncategorized/bounded-context/) by allowing developers to configure
23
23
  context-specific feature files if needed.
24
24
 
25
25
  Requirements
@@ -31,8 +31,8 @@ Setup
31
31
  -----
32
32
 
33
33
  1. Configure Rubygem
34
- - Rails (~> 4.0.0 or ~> 3.0): Add the following to Gemfile <pre>gem 'abstract_feature_branch', '0.6.2'</pre>
35
- - Rails (~> 2.0): Add the following to config/environment.rb <pre>config.gem 'absract_feature_branch', :version => '0.6.2'</pre>
34
+ - Rails (~> 4.0.0 or ~> 3.0): Add the following to Gemfile <pre>gem 'abstract_feature_branch', '0.6.3'</pre>
35
+ - Rails (~> 2.0): Add the following to config/environment.rb <pre>config.gem 'absract_feature_branch', :version => '0.6.3'</pre>
36
36
  2. Generate <code>config/features.yml</code> and <code>config/features.local.yml</code> in your Rails app directory by running <pre>rails g abstract_feature_branch:install</pre>
37
37
  3. (Optional) Generate <code>config/features/[context_path].yml</code> in your Rails app directory by running <pre>rails g abstract_feature_branch:context context_path</pre>
38
38
 
@@ -253,8 +253,11 @@ the former if overlap in features occurs:
253
253
  Release Notes
254
254
  -------------
255
255
 
256
- Version 0.6.2:
257
- - Added a context generator and support for reading feature configuration from context files config/features/**/*.yml and config/features/**/*.local.yml
256
+ Version 0.6.1 - 0.6.3:
257
+ - Fixed issues including making feature configuration files optional (in case one wants to get rid of <code>features.local.yml</code> or even <code>features.yml</code>)
258
+
259
+ Version 0.6.0:
260
+ - Added a context generator and support for reading feature configuration from context files <code>config/features/**/*.yml</code> and <code>config/features/**/*.local.yml</code>
258
261
 
259
262
  Version 0.5.0:
260
263
  - Added support for local configuration feature ignored by git + some performance optimizations via configuration caching and better algorithms.
@@ -269,24 +272,24 @@ Version 0.3.5:
269
272
  - Fixed issue with generator not allowing consuming client app to start Rails server successfully
270
273
 
271
274
  Version 0.3.4:
272
- - Added abstract_feature_branch:install generator to easily get started with a sample config/features.yml
275
+ - Added <code>abstract_feature_branch:install</code> generator to easily get started with a sample <code>config/features.yml</code>
273
276
 
274
277
  Version 0.3.3:
275
278
  - Removed version from README title
276
279
 
277
280
  Version 0.3.2:
278
- - Added AbstractFeatureBranch.features to delay YAML load until Rails.root has been established
281
+ - Added <code>AbstractFeatureBranch.features</code> to delay YAML load until <code>Rails.root</code> has been established
279
282
 
280
283
  Version 0.3.1:
281
284
  - Removed dependency on the rails_config gem
282
285
 
283
286
  Version 0.3.0:
284
- - Simplified features.yml requirement to have a features header under each environment
285
- - Moved feature storage from Settings object to AbstractFeatureBranch::FEATURES
287
+ - Simplified <code>features.yml</code> requirement to have a features header under each environment
288
+ - Moved feature storage from Settings object to <code>AbstractFeatureBranch::FEATURES</code>
286
289
 
287
290
  Version 0.2.0:
288
- - Support an "else" block to execute when a feature is off (via :true and :false lambda arguments)
289
- - Support ability to check if a feature is enabled or not (via feature_enabled?)
291
+ - Support an "else" block to execute when a feature is off (via <code>:true</code> and <code>:false</code> lambda arguments)
292
+ - Support ability to check if a feature is enabled or not (via <code>feature_enabled?</code>)
290
293
 
291
294
  Upcoming
292
295
  --------
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.6.3
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "abstract_feature_branch"
8
- s.version = "0.6.2"
8
+ s.version = "0.6.3"
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"]
@@ -32,7 +32,8 @@ Gem::Specification.new do |s|
32
32
  "lib/generators/abstract_feature_branch/install_generator.rb",
33
33
  "lib/generators/templates/config/features.example.yml",
34
34
  "lib/generators/templates/config/features.local.yml",
35
- "lib/generators/templates/config/features.yml"
35
+ "lib/generators/templates/config/features.yml",
36
+ "spec/application_no_config/no_config"
36
37
  ]
37
38
  s.homepage = "http://github.com/AndyObtiva/abstract_feature_branch"
38
39
  s.licenses = ["MIT"]
@@ -11,6 +11,15 @@ end
11
11
  require 'deep_merge' unless {}.respond_to?(:deep_merge!)
12
12
 
13
13
  module AbstractFeatureBranch
14
+ def self.application_root
15
+ @application_root ||= initialize_application_root
16
+ end
17
+ def self.initialize_application_root
18
+ @application_root = Rails.root
19
+ end
20
+ def self.application_root=(path)
21
+ @application_root = path
22
+ end
14
23
  def self.environment_variable_overrides
15
24
  @environment_variable_overrides ||= load_environment_variable_overrides
16
25
  end
@@ -22,20 +31,24 @@ module AbstractFeatureBranch
22
31
  end
23
32
  def self.load_local_features
24
33
  @local_features = {}
25
- Dir.glob(File.join(Rails.root, 'config', 'features', '**', '*.local.yml')).each do |feature_configuration_file|
34
+ Dir.glob(File.join(application_root, 'config', 'features', '**', '*.local.yml')).each do |feature_configuration_file|
26
35
  @local_features.deep_merge!(downcase_feature_hash_keys(YAML.load_file(feature_configuration_file)))
27
36
  end
28
- @local_features.deep_merge!(downcase_feature_hash_keys(YAML.load_file(File.join(Rails.root, 'config', 'features.local.yml'))))
37
+ main_local_features_file = File.join(application_root, 'config', 'features.local.yml')
38
+ @local_features.deep_merge!(downcase_feature_hash_keys(YAML.load_file(main_local_features_file))) if File.exists?(main_local_features_file)
39
+ @local_features
29
40
  end
30
41
  def self.features
31
42
  @features ||= load_features
32
43
  end
33
44
  def self.load_features
34
45
  @features = {}
35
- Dir.glob(File.join(Rails.root, 'config', 'features', '**', '*.yml')).each do |feature_configuration_file|
46
+ Dir.glob(File.join(application_root, 'config', 'features', '**', '*.yml')).each do |feature_configuration_file|
36
47
  @features.deep_merge!(downcase_feature_hash_keys(YAML.load_file(feature_configuration_file)))
37
48
  end
38
- @features.deep_merge!(downcase_feature_hash_keys(YAML.load_file(File.join(Rails.root, 'config', 'features.yml'))))
49
+ main_features_file = File.join(application_root, 'config', 'features.yml')
50
+ @features.deep_merge!(downcase_feature_hash_keys(YAML.load_file(main_features_file))) if File.exists?(main_features_file)
51
+ @features
39
52
  end
40
53
  # performance optimization via caching of feature values resolved through environment variable overrides and local features
41
54
  def self.environment_features(environment)
@@ -43,6 +56,8 @@ module AbstractFeatureBranch
43
56
  @environment_features[environment] ||= load_environment_features(environment)
44
57
  end
45
58
  def self.load_environment_features(environment)
59
+ features[environment] ||= {}
60
+ local_features[environment] ||= {}
46
61
  @environment_features[environment] = features[environment].merge(local_features[environment]).merge(environment_variable_overrides)
47
62
  end
48
63
 
@@ -0,0 +1 @@
1
+ # just a stub to allow directory to be committed to git
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.6.2
4
+ version: 0.6.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Annas "Andy" Maleh
@@ -101,6 +101,7 @@ files:
101
101
  - lib/generators/templates/config/features.example.yml
102
102
  - lib/generators/templates/config/features.local.yml
103
103
  - lib/generators/templates/config/features.yml
104
+ - spec/application_no_config/no_config
104
105
  homepage: http://github.com/AndyObtiva/abstract_feature_branch
105
106
  licenses:
106
107
  - MIT