abstract_feature_branch 0.6.4 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- OTZmZjg1MjYyZWNiOWEyOGU1YmFiYWI3YmEwYWYwNGVhYWNmMzAyYg==
5
- data.tar.gz: !binary |-
6
- YzlhNjZiOWJhNjE3NDMxMGYzOTY3MDRlZDM3OTI2NDA5YzQ0MzcyZg==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- ZTk0NjE0Njk4MDIwNTg5NTA0ZmQzM2JkOGJiNGUzN2JhYWM1ZmE0Mjg3OTFi
10
- OTkyODlhZjNkNDQxZDYxMTA3NGRmZDU2NzdmYzc4NmVhMTk5ZTk4YTAxZTFk
11
- YTFkZTNhZWUxZGQxMDg5NGYwNDJmYWQ3ZmE4ZjNjMjEyMjZkNjM=
12
- data.tar.gz: !binary |-
13
- ODViYmE4NTg4ZmRjZDY5MmM5MTAyNDIzYWY0ZmM3Njg1M2UxZTEyZTQ3ODNh
14
- MzkxNzE0NjY1ZjljYmE1OGZiZmRkODhlZTRiZDgwNzhkNmIyYzFmOWFhN2Fj
15
- NzE0ZDdkMGM1NzIxMTRhMmUzZjhlN2U2NzNkZTE1NzIyZjQzYTM=
2
+ SHA1:
3
+ metadata.gz: 73e3ea8bac7b5d86a2361282c395524039ad9ac5
4
+ data.tar.gz: 2160f9152209cf5e3a51e9a5f470031fa3561469
5
+ SHA512:
6
+ metadata.gz: f6de2cebd3d561fb4e42daff405bf075e9b46f01da13f65bb56bdf55e7c3adb71a4e6e3df11b1db6248aace07f78b4aa1ad88d6427ce5aaecccd2ee2f76f2e07
7
+ data.tar.gz: 2514d572fdff4b7ed0db2995948f67021fcc1ba86309a9e4f16d346c94a451fa382c250ebd7e2abf9ec1898223db5515ac7473c1d73c7afaaf05bb6437fb6324
@@ -0,0 +1,9 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ - 1.8.7
6
+ - ree
7
+ - jruby-18mode
8
+ - jruby-19mode
9
+ - rbx-2.1.1
data/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  Abstract Feature Branch
2
2
  =======================
3
3
  [![Gem Version](https://badge.fury.io/rb/abstract_feature_branch.png)](http://badge.fury.io/rb/abstract_feature_branch)
4
+ [![Build Status](https://api.travis-ci.org/AndyObtiva/abstract_feature_branch.png?branch=master)](https://travis-ci.org/AndyObtiva/abstract_feature_branch)
4
5
 
5
- abstract_feature_branch is a Rails gem that enables developers to easily branch by
6
- abstraction as per this pattern: http://paulhammant.com/blog/branch_by_abstraction.html
6
+ abstract_feature_branch is a Rails gem that enables developers to easily branch by abstraction as per this pattern:
7
+ http://paulhammant.com/blog/branch_by_abstraction.html
7
8
 
8
9
  It is a productivity and fault tolerance enhancing team practice that has been utilized by professional software development
9
10
  teams at large corporations, such as Sears and Groupon.
@@ -11,13 +12,13 @@ teams at large corporations, such as Sears and Groupon.
11
12
  It gives ability to wrap blocks of code with an abstract feature branch name, and then
12
13
  specify which features to be switched on or off in a configuration file.
13
14
 
14
- The goal is to build out future features with full integration into the codebase, thus
15
- ensuring no delay in integration in the future, while releasing currently done features
16
- at the same time. Developers then disable future features until they are ready to be
17
- switched on in production, but do enable them in staging and locally.
15
+ The goal is to build out upcoming features in the same source code repository branch, regardless of whether all are
16
+ completed by the next release date or not, thus increasing team productivity by preventing integration delays.
17
+ Developers then disable in-progress features until they are ready to be switched on in production, yet enable them
18
+ locally and in staging environments for in-progress testing.
18
19
 
19
- This gives developers the added benefit of being able to switch a feature off after
20
- release should big problems arise for a high risk feature.
20
+ This gives developers the added benefit of being able to switch a feature off after release should big problems arise
21
+ for a high risk feature.
21
22
 
22
23
  abstract_feature_branch additionally supports [DDD](http://www.domaindrivendesign.org)'s pattern of
23
24
  [bounded contexts](http://dddcommunity.org/uncategorized/bounded-context/) by allowing developers to configure
@@ -26,16 +27,30 @@ context-specific feature files if needed.
26
27
  Requirements
27
28
  ------------
28
29
  - Ruby ~> 2.0.0, ~> 1.9 or ~> 1.8.7
29
- - Rails ~> 4.0.0, ~> 3.0 or ~> 2.0
30
+ - (Optional) Rails ~> 4.0.0, ~> 3.0 or ~> 2.0
30
31
 
31
32
  Setup
32
33
  -----
33
34
 
35
+ ### Rails Application
36
+
34
37
  1. Configure Rubygem
35
- - Rails (~> 4.0.0 or ~> 3.0): Add the following to Gemfile <pre>gem 'abstract_feature_branch', '0.6.4'</pre>
36
- - Rails (~> 2.0): Add the following to config/environment.rb <pre>config.gem 'absract_feature_branch', :version => '0.6.4'</pre>
37
- 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>
38
- 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
+ - Rails (~> 4.0.0 or ~> 3.0): Add the following to Gemfile <pre>gem 'abstract_feature_branch', '0.7.0'</pre>
39
+ - Rails (~> 2.0): Add the following to config/environment.rb <pre>config.gem 'abstract_feature_branch', :version => '0.7.0'</pre>
40
+ 2. Generate <code>config/initializers/abstract_feature_branch.rb</code>, <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>
41
+ 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> (more details under **instructions**)
42
+ 4. (Optional and rarely needed) Customize configuration in <code>config/initializers/abstract_feature_branch.rb</code> (can be useful for changing location of feature files in Rails application or troubleshooting a specific Rails environment feature configuration)
43
+
44
+ ### Ruby Application (general use)
45
+
46
+ 1. <pre>gem install abstract_feature_branch -v 0.7.0</pre>
47
+ 2. Add code <code>require 'abstract_feature_branch'</code>
48
+ 3. Create <code>config/features.yml</code> under <code>AbstractFeatureBranch.application_root</code> and fill it with content similar to that of the sample <code>config/features.yml</code> mentioned under **instructions**.
49
+ 4. (Optional) Create <code>config/features.local.yml</code> under <code>AbstractFeatureBranch.application_root</code> (more details under **instructions**)
50
+ 5. (Optional) Create <code>config/features/[context_path].yml</code> under <code>AbstractFeatureBranch.application_root</code> (more details under **instructions**)
51
+ 6. (Optional) Add code <code>AbstractFeatureBranch.application_root = "[your_application_path]"</code> to configure the location of feature files (it defaults to <code>'.'</code>)
52
+ 7. (Optional) Add code <code>AbstractFeatureBranch.application_environment = "[your_application_environment]"</code> (it defaults to <code>'development'</code>). Alternatively, you can set <code>ENV['APP_ENV']</code> before the <code>require</code> statement or an an external environment variable.
53
+ 8. (Optional) Add code <code>AbstractFeatureBranch.load_application_features</code> to pre-load application features for improved first-use performance
39
54
 
40
55
  Instructions
41
56
  ------------
@@ -53,7 +68,7 @@ These files are rarely necessary as any feature (even a context feature) can be
53
68
  so these additional <code>*.local.yml</code> files are only recommended to be utilized once <code>config/features.local.yml</code> grows
54
69
  too big (e.g. 20+ features).
55
70
 
56
- Here are the contents of the generated sample config/features.yml, which you can modify with your own features, each
71
+ Here are the contents of the generated sample <code>config/features.yml</code>, which you can modify with your own features, each
57
72
  enabled (true) or disabled (false) per environment (e.g. production).
58
73
 
59
74
  > defaults: &defaults
@@ -113,6 +128,20 @@ Note that <code>feature_branch</code> executes the false branch if the feature i
113
128
 
114
129
  Note that <code>feature_enabled?</code> returns false if the feature is disabled and nil if the feature is non-existent (practically the same effect, but nil can sometimes be useful to detect if a feature is referenced).
115
130
 
131
+ Initializer
132
+ -----------
133
+
134
+ Here is the content of the generated initializer (<code>config/initializers/abstract_feature_branch.rb</code>), which contains instructions on how to customize:
135
+
136
+ > # Application root where config/features.yml or config/features/ is found
137
+ > AbstractFeatureBranch.application_root = Rails.root
138
+ >
139
+ > # Application environment (e.g. "development", "staging" or "production")
140
+ > AbstractFeatureBranch.application_environment = Rails.env.to_s
141
+ >
142
+ > # Pre-loads application features to improve performance of first web-page hit
143
+ > AbstractFeatureBranch.load_application_features
144
+
116
145
  Recommendations
117
146
  ---------------
118
147
 
@@ -169,9 +198,9 @@ simply switching off the URL route to them. Example:
169
198
  > display: inline;
170
199
  > }
171
200
 
172
- - Once a feature has been released and switched on in production, and it has worked well for a while,
173
- it is recommended that its feature branching code is plucked out of the code base to simplify the code
174
- for better maintenance as the need is not longer there for feature branching at that point.
201
+ - Once a feature has been released and switched on in production, and it has worked well for a while (e.g. for two consecutive releases),
202
+ it is recommended that its feature branching code is plucked out of the codebase to simplify and improve
203
+ future maintainability given that it is no longer needed at that point.
175
204
 
176
205
  - Split <code>config/features.yml</code> into multiple context-specific feature files once it grows too big (e.g. 20+ features) by
177
206
  utilizing the context generator mentioned above: <pre>rails g abstract_feature_branch:context context_path</pre>
@@ -254,6 +283,9 @@ the former if overlap in features occurs:
254
283
  Release Notes
255
284
  -------------
256
285
 
286
+ Version 0.7.0:
287
+ - Added support for general Ruby use (without Rails) by externalizing AbstractFeatureBranch.application_root and AbstractFeatureBranch.application_environment. Added initializer to optionally configure them. Supported case-insensitive feature names.
288
+
257
289
  Version 0.6.1 - 0.6.4:
258
290
  - 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>)
259
291
 
@@ -295,7 +327,6 @@ Version 0.2.0:
295
327
  Upcoming
296
328
  --------
297
329
 
298
- - Support general Ruby (non-Rails) use
299
330
  - Add rake task to reorder feature entries in feature.yml alphabetically
300
331
  - Support runtime read of features yml in development for easy testing purposes (trading off performance)
301
332
  - Support configuring per environment whether features yml is read at runtime or not (given performance trade-off)
@@ -311,6 +342,14 @@ Contributing to abstract_feature_branch
311
342
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
312
343
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
313
344
 
345
+ Committers
346
+ ---------------------------------------
347
+ [Annas "Andy" Maleh (Author)](https://github.com/AndyObtiva)
348
+
349
+ Contributors
350
+ ---------------------------------------
351
+ [Christian Nennemann](https://github.com/XORwell)
352
+
314
353
  Copyright
315
354
  ---------------------------------------
316
355
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.4
1
+ 0.7.0
@@ -5,17 +5,18 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "abstract_feature_branch"
8
- s.version = "0.6.4"
8
+ s.version = "0.7.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 = "2013-11-23"
12
+ s.date = "2013-11-25"
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",
16
16
  "README.md"
17
17
  ]
18
18
  s.files = [
19
+ ".travis.yml",
19
20
  "LICENSE.txt",
20
21
  "README.md",
21
22
  "VERSION",
@@ -33,12 +34,15 @@ Gem::Specification.new do |s|
33
34
  "lib/generators/templates/config/features.example.yml",
34
35
  "lib/generators/templates/config/features.local.yml",
35
36
  "lib/generators/templates/config/features.yml",
36
- "spec/application_no_config/no_config"
37
+ "lib/generators/templates/config/initializers/abstract_feature_branch.rb",
38
+ "spec/application_no_config/no_config",
39
+ "spec/application_rails_config/config/features.local.yml",
40
+ "spec/application_rails_config/config/features.yml"
37
41
  ]
38
42
  s.homepage = "http://github.com/AndyObtiva/abstract_feature_branch"
39
43
  s.licenses = ["MIT"]
40
44
  s.require_paths = ["lib"]
41
- s.rubygems_version = "2.0.7"
45
+ s.rubygems_version = "2.0.6"
42
46
  s.summary = "abstract_feature_branch is a Rails gem that enables developers to easily branch by abstraction as per this pattern: http://paulhammant.com/blog/branch_by_abstraction.html"
43
47
 
44
48
  if s.respond_to? :specification_version then
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
2
  require 'bundler'
3
3
  require 'yaml'
4
- YAML::ENGINE.yamler = "syck"
4
+ YAML::ENGINE.yamler = "syck" if RUBY_VERSION.start_with?('1.9')
5
5
  begin
6
6
  Bundler.setup(:default)
7
7
  rescue Bundler::BundlerError => e
@@ -15,12 +15,21 @@ module AbstractFeatureBranch
15
15
  def self.application_root
16
16
  @application_root ||= initialize_application_root
17
17
  end
18
- def self.initialize_application_root
19
- @application_root = Rails.root
20
- end
21
18
  def self.application_root=(path)
22
19
  @application_root = path
23
20
  end
21
+ def self.initialize_application_root
22
+ self.application_root = Object.const_defined?(:Rails) ? Rails.root : '.'
23
+ end
24
+ def self.application_environment
25
+ @application_environment ||= initialize_application_environment
26
+ end
27
+ def self.application_environment=(environment)
28
+ @application_environment = environment
29
+ end
30
+ def self.initialize_application_environment
31
+ self.application_environment = Object.const_defined?(:Rails) ? Rails.env.to_s : ENV['APP_ENV'] || 'development'
32
+ end
24
33
  def self.environment_variable_overrides
25
34
  @environment_variable_overrides ||= load_environment_variable_overrides
26
35
  end
@@ -61,6 +70,15 @@ module AbstractFeatureBranch
61
70
  local_features[environment] ||= {}
62
71
  @environment_features[environment] = features[environment].merge(local_features[environment]).merge(environment_variable_overrides)
63
72
  end
73
+ def self.application_features
74
+ environment_features(application_environment)
75
+ end
76
+ def self.load_application_features
77
+ AbstractFeatureBranch.load_environment_variable_overrides
78
+ AbstractFeatureBranch.load_features
79
+ AbstractFeatureBranch.load_local_features
80
+ AbstractFeatureBranch.load_environment_features(application_environment)
81
+ end
64
82
 
65
83
  private
66
84
 
@@ -9,7 +9,7 @@ class Object
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
- AbstractFeatureBranch.environment_features(Rails.env.to_s)[feature_name.to_s]
12
+ AbstractFeatureBranch.application_features[feature_name.to_s.downcase]
13
13
  end
14
14
 
15
15
  raise 'Abstract feature branch conflicts with another Ruby library' if Object.new.respond_to?(:feature_branch)
@@ -5,6 +5,7 @@ module AbstractFeatureBranch
5
5
 
6
6
  desc "Installs Abstract Feature Branch by generating basic configuration files, including git ignored local one."
7
7
  def copy_config
8
+ template "config/initializers/abstract_feature_branch.rb", "config/initializers/abstract_feature_branch.rb"
8
9
  template "config/features.example.yml", "config/features.yml"
9
10
  template "config/features.local.yml", "config/features.local.yml"
10
11
  append_to_file '.gitignore', <<-GIT_IGNORE_CONTENT
@@ -0,0 +1,8 @@
1
+ # Application root where config/features.yml or config/features/ is found
2
+ AbstractFeatureBranch.application_root = Rails.root
3
+
4
+ # Application environment (e.g. "development", "staging" or "production")
5
+ AbstractFeatureBranch.application_environment = Rails.env.to_s
6
+
7
+ # Pre-loads application features to improve performance of first web-page hit
8
+ AbstractFeatureBranch.load_application_features
@@ -0,0 +1,15 @@
1
+ defaults: &defaults
2
+
3
+ development:
4
+ <<: *defaults
5
+
6
+ test:
7
+ <<: *defaults
8
+
9
+ staging:
10
+ <<: *defaults
11
+ feature3: false
12
+
13
+ production:
14
+ <<: *defaults
15
+
@@ -0,0 +1,20 @@
1
+ defaults: &defaults
2
+ FEATURE1: true
3
+ Feature2: true
4
+ feature3: true
5
+
6
+ development:
7
+ <<: *defaults
8
+
9
+ test:
10
+ <<: *defaults
11
+
12
+ staging:
13
+ <<: *defaults
14
+ FEATURE1: true
15
+ Feature2: false
16
+ feature3: true
17
+
18
+ production:
19
+ <<: *defaults
20
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: abstract_feature_branch
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Annas "Andy" Maleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-23 00:00:00.000000000 Z
11
+ date: 2013-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: deep_merge
@@ -66,28 +66,17 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.8.8
69
- description: ! 'It gives ability to wrap blocks of code with an abstract feature branch
70
- name, and then
71
-
69
+ description: |
70
+ It gives ability to wrap blocks of code with an abstract feature branch name, and then
72
71
  specify which features to be switched on or off in a configuration file.
73
72
 
74
-
75
- The goal is to build out future features with full integration into the codebase,
76
- thus
77
-
73
+ The goal is to build out future features with full integration into the codebase, thus
78
74
  ensuring no delay in integration in the future, while releasing currently done features
79
-
80
- at the same time. Developers then disable future features until they are ready to
81
- be
82
-
75
+ at the same time. Developers then disable future features until they are ready to be
83
76
  switched on in production, but do enable them in staging and locally.
84
77
 
85
-
86
78
  This gives developers the added benefit of being able to switch a feature off after
87
-
88
79
  release should big problems arise for a high risk feature.
89
-
90
- '
91
80
  email:
92
81
  executables: []
93
82
  extensions: []
@@ -95,6 +84,7 @@ extra_rdoc_files:
95
84
  - LICENSE.txt
96
85
  - README.md
97
86
  files:
87
+ - .travis.yml
98
88
  - LICENSE.txt
99
89
  - README.md
100
90
  - VERSION
@@ -112,7 +102,10 @@ files:
112
102
  - lib/generators/templates/config/features.example.yml
113
103
  - lib/generators/templates/config/features.local.yml
114
104
  - lib/generators/templates/config/features.yml
105
+ - lib/generators/templates/config/initializers/abstract_feature_branch.rb
115
106
  - spec/application_no_config/no_config
107
+ - spec/application_rails_config/config/features.local.yml
108
+ - spec/application_rails_config/config/features.yml
116
109
  homepage: http://github.com/AndyObtiva/abstract_feature_branch
117
110
  licenses:
118
111
  - MIT
@@ -123,19 +116,19 @@ require_paths:
123
116
  - lib
124
117
  required_ruby_version: !ruby/object:Gem::Requirement
125
118
  requirements:
126
- - - ! '>='
119
+ - - '>='
127
120
  - !ruby/object:Gem::Version
128
121
  version: '0'
129
122
  required_rubygems_version: !ruby/object:Gem::Requirement
130
123
  requirements:
131
- - - ! '>='
124
+ - - '>='
132
125
  - !ruby/object:Gem::Version
133
126
  version: '0'
134
127
  requirements: []
135
128
  rubyforge_project:
136
- rubygems_version: 2.0.7
129
+ rubygems_version: 2.0.6
137
130
  signing_key:
138
131
  specification_version: 4
139
- summary: ! 'abstract_feature_branch is a Rails gem that enables developers to easily
132
+ summary: 'abstract_feature_branch is a Rails gem that enables developers to easily
140
133
  branch by abstraction as per this pattern: http://paulhammant.com/blog/branch_by_abstraction.html'
141
134
  test_files: []