corral 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/corral.gemspec +2 -1
- data/lib/corral/feature.rb +21 -12
- data/lib/corral/version.rb +1 -1
- data/spec/corral_spec.rb +23 -23
- data/spec/spec_helper.rb +1 -0
- metadata +21 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 615bede80a7e7c10557c59f8254d2051219a57c7
|
4
|
+
data.tar.gz: 33c0b5b506284d0322047c08249746ed88c9c1f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8685179d73245ea765adc5b81dc89b15b0ca1f3143730f36f6760a8ee364cedc3d1f801aa5b146dd16bbbcc5d1d45a9307482d5852728857aff6a424f1e5ecb4
|
7
|
+
data.tar.gz: 9b5f69484af6ec5eec5ed09cb365b307a308466daa775cb21916cf4a7cc4498f2404b8f5d02027ab49ff88ed109dab967e8c6d198bc4611716da62ab383c2fde
|
data/corral.gemspec
CHANGED
@@ -18,5 +18,6 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.require_paths = ["lib"]
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
-
spec.add_development_dependency "rake"
|
21
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
22
|
+
spec.add_development_dependency "pry", "~> 0.10.4"
|
22
23
|
end
|
data/lib/corral/feature.rb
CHANGED
@@ -8,21 +8,30 @@ module Corral
|
|
8
8
|
@disabled = disabled
|
9
9
|
end
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
class << self
|
12
|
+
def features
|
13
|
+
@features ||= {}
|
14
|
+
end
|
15
15
|
|
16
|
-
|
17
|
-
|
18
|
-
|
16
|
+
def push(name, condition, disabled = true)
|
17
|
+
features[name] = new(name, condition, disabled)
|
18
|
+
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
def enable(name, condition)
|
21
|
+
push(name, condition, false)
|
22
|
+
end
|
23
|
+
|
24
|
+
def disable(name, condition)
|
25
|
+
push(name, condition, true)
|
26
|
+
end
|
27
|
+
|
28
|
+
def get(name)
|
29
|
+
features[name]
|
30
|
+
end
|
23
31
|
|
24
|
-
|
25
|
-
|
32
|
+
def all
|
33
|
+
features
|
34
|
+
end
|
26
35
|
end
|
27
36
|
end
|
28
37
|
end
|
data/lib/corral/version.rb
CHANGED
data/spec/corral_spec.rb
CHANGED
@@ -6,7 +6,7 @@ describe Corral do
|
|
6
6
|
describe ".corral" do
|
7
7
|
context "when given a block" do
|
8
8
|
it "yields the block" do
|
9
|
-
corral { :cool_feature }.
|
9
|
+
expect(corral { :cool_feature }).to eq(:cool_feature)
|
10
10
|
end
|
11
11
|
|
12
12
|
context "when given known features" do
|
@@ -20,8 +20,8 @@ describe Corral do
|
|
20
20
|
end
|
21
21
|
|
22
22
|
it "disables the feature" do
|
23
|
-
disabled?(:caching).
|
24
|
-
enabled?("expiry_headers").
|
23
|
+
expect(disabled?(:caching)).to be true
|
24
|
+
expect(enabled?("expiry_headers")).to be true
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
@@ -33,7 +33,7 @@ describe Corral do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "does not disable the feature" do
|
36
|
-
disabled?(:debug_mode).
|
36
|
+
expect(disabled?(:debug_mode)).to be false
|
37
37
|
end
|
38
38
|
end
|
39
39
|
end
|
@@ -48,8 +48,8 @@ describe Corral do
|
|
48
48
|
end
|
49
49
|
|
50
50
|
it "is disabled" do
|
51
|
-
disabled?(:everything_free).
|
52
|
-
disabled?(:torpedoes).
|
51
|
+
expect(disabled?(:everything_free)).to be true
|
52
|
+
expect(disabled?(:torpedoes)).to be true
|
53
53
|
end
|
54
54
|
end
|
55
55
|
|
@@ -62,8 +62,8 @@ describe Corral do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "is enabled" do
|
65
|
-
enabled?(:payment_button).
|
66
|
-
enabled?(:sunshine).
|
65
|
+
expect(enabled?(:payment_button)).to be true
|
66
|
+
expect(enabled?(:sunshine)).to be true
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -81,7 +81,7 @@ describe Corral do
|
|
81
81
|
context "when not given a 'when' or 'if' condition" do
|
82
82
|
it "is disabled" do
|
83
83
|
corral { :my_feature }
|
84
|
-
disabled?(:my_feature).
|
84
|
+
expect(disabled?(:my_feature)).to be true
|
85
85
|
end
|
86
86
|
end
|
87
87
|
end
|
@@ -104,7 +104,7 @@ describe Corral do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it "is false" do
|
107
|
-
enabled?(:torpedoes).
|
107
|
+
expect(enabled?(:torpedoes)).to be false
|
108
108
|
end
|
109
109
|
end
|
110
110
|
|
@@ -117,7 +117,7 @@ describe Corral do
|
|
117
117
|
end
|
118
118
|
|
119
119
|
it "is false" do
|
120
|
-
enabled?(:torpedoes).
|
120
|
+
expect(enabled?(:torpedoes)).to be false
|
121
121
|
end
|
122
122
|
end
|
123
123
|
|
@@ -129,7 +129,7 @@ describe Corral do
|
|
129
129
|
end
|
130
130
|
|
131
131
|
it "is true" do
|
132
|
-
enabled?(:cupcakes).
|
132
|
+
expect(enabled?(:cupcakes)).to be true
|
133
133
|
end
|
134
134
|
end
|
135
135
|
end
|
@@ -137,7 +137,7 @@ describe Corral do
|
|
137
137
|
|
138
138
|
context "when the given feature does not exist" do
|
139
139
|
it "is false" do
|
140
|
-
enabled?(:unknown_feature).
|
140
|
+
expect(enabled?(:unknown_feature)).to be false
|
141
141
|
end
|
142
142
|
end
|
143
143
|
|
@@ -150,7 +150,7 @@ describe Corral do
|
|
150
150
|
end
|
151
151
|
|
152
152
|
it "is false" do
|
153
|
-
enabled?(:cupcakes, "Bryan").
|
153
|
+
expect(enabled?(:cupcakes, "Bryan")).to be false
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
@@ -162,7 +162,7 @@ describe Corral do
|
|
162
162
|
end
|
163
163
|
|
164
164
|
it "is false" do
|
165
|
-
enabled?(:cupcakes, "George").
|
165
|
+
expect(enabled?(:cupcakes, "George")).to be true
|
166
166
|
end
|
167
167
|
end
|
168
168
|
end
|
@@ -178,7 +178,7 @@ describe Corral do
|
|
178
178
|
end
|
179
179
|
|
180
180
|
it "is true" do
|
181
|
-
disabled?(:torpedoes).
|
181
|
+
expect(disabled?(:torpedoes)).to be true
|
182
182
|
end
|
183
183
|
end
|
184
184
|
|
@@ -191,7 +191,7 @@ describe Corral do
|
|
191
191
|
end
|
192
192
|
|
193
193
|
it "is true" do
|
194
|
-
disabled?(:torpedoes).
|
194
|
+
expect(disabled?(:torpedoes)).to be true
|
195
195
|
end
|
196
196
|
end
|
197
197
|
|
@@ -203,7 +203,7 @@ describe Corral do
|
|
203
203
|
end
|
204
204
|
|
205
205
|
it "is false" do
|
206
|
-
disabled?(:cupcakes).
|
206
|
+
expect(disabled?(:cupcakes)).to be false
|
207
207
|
end
|
208
208
|
end
|
209
209
|
end
|
@@ -211,7 +211,7 @@ describe Corral do
|
|
211
211
|
|
212
212
|
context "when the given feature does not exist" do
|
213
213
|
it "is true" do
|
214
|
-
disabled?(:unknown_feature).
|
214
|
+
expect(disabled?(:unknown_feature)).to be true
|
215
215
|
end
|
216
216
|
end
|
217
217
|
end
|
@@ -225,7 +225,7 @@ describe Corral do
|
|
225
225
|
end
|
226
226
|
|
227
227
|
it "is true" do
|
228
|
-
disabled?(:cupcakes, "Bryan").
|
228
|
+
expect(disabled?(:cupcakes, "Bryan")).to be true
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
@@ -237,7 +237,7 @@ describe Corral do
|
|
237
237
|
end
|
238
238
|
|
239
239
|
it "is false" do
|
240
|
-
disabled?(:cupcakes, "George").
|
240
|
+
expect(disabled?(:cupcakes, "George")).to be false
|
241
241
|
end
|
242
242
|
end
|
243
243
|
end
|
@@ -252,8 +252,8 @@ describe Corral do
|
|
252
252
|
end
|
253
253
|
|
254
254
|
it "enables the feature" do
|
255
|
-
enabled?(:always_on).
|
256
|
-
disabled?(:everything).
|
255
|
+
expect(enabled?(:always_on)).to be true
|
256
|
+
expect(disabled?(:everything)).to be false
|
257
257
|
end
|
258
258
|
end
|
259
259
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corral
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Woods
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -28,16 +28,30 @@ dependencies:
|
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '12.0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '12.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.10.4
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
54
|
+
version: 0.10.4
|
41
55
|
description:
|
42
56
|
email:
|
43
57
|
- bryanwoods4e@gmail.com
|
@@ -78,11 +92,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
78
92
|
version: '0'
|
79
93
|
requirements: []
|
80
94
|
rubyforge_project:
|
81
|
-
rubygems_version: 2.
|
95
|
+
rubygems_version: 2.6.8
|
82
96
|
signing_key:
|
83
97
|
specification_version: 4
|
84
98
|
summary: Use Corral to disable certain features in your application.
|
85
99
|
test_files:
|
86
100
|
- spec/corral_spec.rb
|
87
101
|
- spec/spec_helper.rb
|
88
|
-
has_rdoc:
|