feature 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/feature/repository/simple_repository.rb +1 -1
- data/lib/feature/repository/yaml_repository.rb +1 -1
- data/lib/feature/repository.rb +0 -1
- data/lib/feature.rb +4 -3
- data/spec/feature/feature_spec.rb +1 -1
- metadata +8 -10
- data/lib/feature/repository/abstract_repository.rb +0 -24
- data/spec/feature/abstract_repository_spec.rb +0 -9
data/CHANGELOG.md
CHANGED
data/lib/feature/repository.rb
CHANGED
data/lib/feature.rb
CHANGED
@@ -13,12 +13,13 @@ module Feature
|
|
13
13
|
@active_features = nil
|
14
14
|
|
15
15
|
# Set the feature repository
|
16
|
+
# The given repository has to respond to method 'active_features' with an array of symbols
|
16
17
|
#
|
17
|
-
# @param [
|
18
|
+
# @param [Object] repository the repository to get the features from
|
18
19
|
#
|
19
20
|
def self.set_repository(repository)
|
20
|
-
if !repository.
|
21
|
-
raise ArgumentError, "given
|
21
|
+
if !repository.respond_to?(:active_features)
|
22
|
+
raise ArgumentError, "given repository does not respond to active_features"
|
22
23
|
end
|
23
24
|
|
24
25
|
@repository = repository
|
@@ -38,7 +38,7 @@ describe Feature do
|
|
38
38
|
it "should raise an exception when add repository with wrong class" do
|
39
39
|
lambda do
|
40
40
|
Feature.set_repository("not a repository")
|
41
|
-
end.should raise_error(ArgumentError, "given
|
41
|
+
end.should raise_error(ArgumentError, "given repository does not respond to active_features")
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should set a feature repository" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: feature
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 15
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
8
|
+
- 4
|
9
9
|
- 0
|
10
|
-
version: 0.
|
10
|
+
version: 0.4.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Markus Gerdes
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-11-
|
18
|
+
date: 2011-11-28 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|
@@ -28,15 +28,13 @@ extensions: []
|
|
28
28
|
extra_rdoc_files: []
|
29
29
|
|
30
30
|
files:
|
31
|
-
- lib/feature.rb
|
32
31
|
- lib/feature/repository/simple_repository.rb
|
33
|
-
- lib/feature/repository/abstract_repository.rb
|
34
32
|
- lib/feature/repository/yaml_repository.rb
|
35
33
|
- lib/feature/repository.rb
|
34
|
+
- lib/feature.rb
|
35
|
+
- spec/feature/feature_spec.rb
|
36
36
|
- spec/feature/simple_repository_spec.rb
|
37
37
|
- spec/feature/yaml_repository_spec.rb
|
38
|
-
- spec/feature/abstract_repository_spec.rb
|
39
|
-
- spec/feature/feature_spec.rb
|
40
38
|
- spec/spec_helper.rb
|
41
39
|
- Rakefile
|
42
40
|
- Gemfile
|
@@ -72,7 +70,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
72
70
|
requirements: []
|
73
71
|
|
74
72
|
rubyforge_project:
|
75
|
-
rubygems_version: 1.
|
73
|
+
rubygems_version: 1.6.2
|
76
74
|
signing_key:
|
77
75
|
specification_version: 3
|
78
76
|
summary: Feature Toggle library for ruby
|
@@ -1,24 +0,0 @@
|
|
1
|
-
module Feature
|
2
|
-
module Repository
|
3
|
-
# Abstract class for subclassing and building repository classes which
|
4
|
-
# provide lists of active features
|
5
|
-
#
|
6
|
-
class AbstractRepository
|
7
|
-
# Constructor
|
8
|
-
#
|
9
|
-
# Should be overridden in derived class to initialize repository with all data needed
|
10
|
-
#
|
11
|
-
def initialize
|
12
|
-
raise "abstract class #{self.class.name}!"
|
13
|
-
end
|
14
|
-
|
15
|
-
# Returns list of active features
|
16
|
-
#
|
17
|
-
# @return [Array<Symbol>] list of active features
|
18
|
-
#
|
19
|
-
def active_features
|
20
|
-
raise "#{__method__} has to be overridden in derived class"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Feature::Repository::AbstractRepository do
|
4
|
-
it "should raise error on creating a new instance" do
|
5
|
-
lambda do
|
6
|
-
Feature::Repository::AbstractRepository.new
|
7
|
-
end.should raise_error("abstract class Feature::Repository::AbstractRepository!")
|
8
|
-
end
|
9
|
-
end
|