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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c593e012df1b9d81b10115e9c06fef4fb12c6ea8
4
- data.tar.gz: de278173c63e93b84215eedef1624ad61350b6b9
3
+ metadata.gz: 615bede80a7e7c10557c59f8254d2051219a57c7
4
+ data.tar.gz: 33c0b5b506284d0322047c08249746ed88c9c1f2
5
5
  SHA512:
6
- metadata.gz: 80b4c8bdc3065a437c6e655ffd05a04955ccac9a0043f83ca881ee4d93e16457c042bebd363b7f7df9e3c119efb095033095370b31a2920ea45462fb8c60c720
7
- data.tar.gz: 55e0c876711a8053fa58a4516890982e94618f0c803f50d3720330f80784834b9ead22ff7ac2d2e845a9b04284d66146059642f52895b9e4834c993f934bc0cf
6
+ metadata.gz: 8685179d73245ea765adc5b81dc89b15b0ca1f3143730f36f6760a8ee364cedc3d1f801aa5b146dd16bbbcc5d1d45a9307482d5852728857aff6a424f1e5ecb4
7
+ data.tar.gz: 9b5f69484af6ec5eec5ed09cb365b307a308466daa775cb21916cf4a7cc4498f2404b8f5d02027ab49ff88ed109dab967e8c6d198bc4611716da62ab383c2fde
@@ -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
@@ -8,21 +8,30 @@ module Corral
8
8
  @disabled = disabled
9
9
  end
10
10
 
11
- def self.push(name, condition, disabled = true)
12
- @features ||= {}
13
- @features[name] = new(name, condition, disabled)
14
- end
11
+ class << self
12
+ def features
13
+ @features ||= {}
14
+ end
15
15
 
16
- def self.enable(name, condition)
17
- push(name, condition, false)
18
- end
16
+ def push(name, condition, disabled = true)
17
+ features[name] = new(name, condition, disabled)
18
+ end
19
19
 
20
- def self.disable(name, condition)
21
- push(name, condition, true)
22
- end
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
- def self.get(name)
25
- (@features ||= {})[name]
32
+ def all
33
+ features
34
+ end
26
35
  end
27
36
  end
28
37
  end
@@ -1,3 +1,3 @@
1
1
  module Corral
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -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 }.should == :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).should be_true
24
- enabled?("expiry_headers").should be_true
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).should be_false
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).should be_true
52
- disabled?(:torpedoes).should be_true
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).should be_true
66
- enabled?(:sunshine).should be_true
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).should be_true
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).should be_false
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).should be_false
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).should be_true
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).should be_false
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").should be_false
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").should be_true
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).should be_true
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).should be_true
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).should be_false
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).should be_true
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").should be_true
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").should be_false
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).should be_true
256
- disabled?(:everything).should be_false
255
+ expect(enabled?(:always_on)).to be true
256
+ expect(disabled?(:everything)).to be false
257
257
  end
258
258
  end
259
259
  end
@@ -1,3 +1,4 @@
1
1
  require 'rubygems'
2
2
  require 'bundler/setup'
3
3
  require 'corral'
4
+ require 'pry'
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.2
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: 2014-03-21 00:00:00.000000000 Z
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: '0'
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.2.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: