padlock 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +3 -0
- data/Gemfile +4 -0
- data/README.md +2 -2
- data/Rakefile +12 -0
- data/lib/padlock.rb +1 -1
- data/padlock.gemspec +20 -0
- data/spec/padlock_spec.rb +21 -21
- metadata +28 -10
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
CHANGED
@@ -27,12 +27,12 @@ You name it, we got it.
|
|
27
27
|
## Usage
|
28
28
|
|
29
29
|
# Check if component is enabled
|
30
|
-
if component(:perimeter_fence)
|
30
|
+
if Padlock.component(:perimeter_fence)
|
31
31
|
# do work
|
32
32
|
end
|
33
33
|
|
34
34
|
# Guard a block
|
35
|
-
component(:perimeter_fence) do
|
35
|
+
Padlock.component(:perimeter_fence) do
|
36
36
|
# do work
|
37
37
|
end
|
38
38
|
|
data/Rakefile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rspec/core'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
require 'bundler'
|
6
|
+
Bundler::GemHelper.install_tasks
|
7
|
+
|
8
|
+
task :default => :spec
|
9
|
+
|
10
|
+
desc "Run all specs in spec directory (excluding plugin specs)"
|
11
|
+
RSpec::Core::RakeTask.new(:spec)
|
12
|
+
|
data/lib/padlock.rb
CHANGED
data/padlock.gemspec
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "padlock"
|
5
|
+
s.version = "0.1.1"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Pat Nakajima, Brandon Keene & Todd Persen"]
|
9
|
+
s.email = %q{casecommons-dev@googlegroups.com}
|
10
|
+
s.homepage = %q{http://github.com/CaseCommons/padlock}
|
11
|
+
s.summary = %q{Padlock is an environment-based component switch system.}
|
12
|
+
|
13
|
+
s.add_development_dependency('rspec', '>= 2.1')
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
end
|
20
|
+
|
data/spec/padlock_spec.rb
CHANGED
@@ -10,7 +10,7 @@ describe Padlock('development') do
|
|
10
10
|
|
11
11
|
it "raises a ComponentNotFound error when the component don't not exist none" do
|
12
12
|
proc {
|
13
|
-
component(:raptor_fences)
|
13
|
+
Padlock.component(:raptor_fences)
|
14
14
|
}.should raise_error(Padlock::ComponentNotFound)
|
15
15
|
end
|
16
16
|
|
@@ -24,12 +24,12 @@ describe Padlock('development') do
|
|
24
24
|
|
25
25
|
it "runs the component block always" do
|
26
26
|
called = false
|
27
|
-
component(:perimeter_fence) { called = true }
|
27
|
+
Padlock.component(:perimeter_fence) { called = true }
|
28
28
|
called.should be_true
|
29
29
|
end
|
30
30
|
|
31
31
|
it "always returns true on component check" do
|
32
|
-
component(:perimeter_fence).should be_true
|
32
|
+
Padlock.component(:perimeter_fence).should be_true
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
@@ -47,12 +47,12 @@ describe Padlock('development') do
|
|
47
47
|
|
48
48
|
it "runs the component block" do
|
49
49
|
called = false
|
50
|
-
component(:perimeter_fence) { called = true }
|
50
|
+
Padlock.component(:perimeter_fence) { called = true }
|
51
51
|
called.should be_true
|
52
52
|
end
|
53
53
|
|
54
54
|
it "returns true from the component check" do
|
55
|
-
component(:perimeter_fence).should be_true
|
55
|
+
Padlock.component(:perimeter_fence).should be_true
|
56
56
|
end
|
57
57
|
|
58
58
|
it "is indifferent to strings/symbols" do
|
@@ -61,7 +61,7 @@ describe Padlock('development') do
|
|
61
61
|
end
|
62
62
|
|
63
63
|
called = false
|
64
|
-
component(:perimeter_fence) { called = true }
|
64
|
+
Padlock.component(:perimeter_fence) { called = true }
|
65
65
|
called.should be_true
|
66
66
|
end
|
67
67
|
end
|
@@ -81,12 +81,12 @@ describe Padlock('development') do
|
|
81
81
|
|
82
82
|
it "runs the component block" do
|
83
83
|
called = false
|
84
|
-
component(:perimeter_fence) { called = true }
|
84
|
+
Padlock.component(:perimeter_fence) { called = true }
|
85
85
|
called.should be_true
|
86
86
|
end
|
87
87
|
|
88
88
|
it "returns true from the component check" do
|
89
|
-
component(:perimeter_fence).should be_true
|
89
|
+
Padlock.component(:perimeter_fence).should be_true
|
90
90
|
end
|
91
91
|
|
92
92
|
it "is indifferent to strings/symbols" do
|
@@ -95,7 +95,7 @@ describe Padlock('development') do
|
|
95
95
|
end
|
96
96
|
|
97
97
|
called = false
|
98
|
-
component(:perimeter_fence) { called = true }
|
98
|
+
Padlock.component(:perimeter_fence) { called = true }
|
99
99
|
called.should be_true
|
100
100
|
end
|
101
101
|
end
|
@@ -107,12 +107,12 @@ describe Padlock('development') do
|
|
107
107
|
|
108
108
|
it "does not run the component block when not in an appropriate environment" do
|
109
109
|
called = false
|
110
|
-
component(:perimeter_fence) { called = true }
|
110
|
+
Padlock.component(:perimeter_fence) { called = true }
|
111
111
|
called.should be_false
|
112
112
|
end
|
113
113
|
|
114
114
|
it "returns false from the component check" do
|
115
|
-
component(:perimeter_fence).should be_false
|
115
|
+
Padlock.component(:perimeter_fence).should be_false
|
116
116
|
end
|
117
117
|
end
|
118
118
|
end
|
@@ -127,12 +127,12 @@ describe Padlock('development') do
|
|
127
127
|
|
128
128
|
it "does not run the component block when not in an appropriate environment" do
|
129
129
|
called = false
|
130
|
-
component(:perimeter_fence) { called = true }
|
130
|
+
Padlock.component(:perimeter_fence) { called = true }
|
131
131
|
called.should be_false
|
132
132
|
end
|
133
133
|
|
134
134
|
it "returns false from the component check" do
|
135
|
-
component(:perimeter_fence).should be_false
|
135
|
+
Padlock.component(:perimeter_fence).should be_false
|
136
136
|
end
|
137
137
|
end
|
138
138
|
|
@@ -145,12 +145,12 @@ describe Padlock('development') do
|
|
145
145
|
|
146
146
|
it "does not run the component block when not in an appropriate environment" do
|
147
147
|
called = false
|
148
|
-
component(:perimeter_fence) { called = true }
|
148
|
+
Padlock.component(:perimeter_fence) { called = true }
|
149
149
|
called.should be_false
|
150
150
|
end
|
151
151
|
|
152
152
|
it "returns false from the component check" do
|
153
|
-
component(:perimeter_fence).should be_false
|
153
|
+
Padlock.component(:perimeter_fence).should be_false
|
154
154
|
end
|
155
155
|
|
156
156
|
it "is indifferent to strings/symbols" do
|
@@ -159,7 +159,7 @@ describe Padlock('development') do
|
|
159
159
|
end
|
160
160
|
|
161
161
|
called = false
|
162
|
-
component(:perimeter_fence) { called = true }
|
162
|
+
Padlock.component(:perimeter_fence) { called = true }
|
163
163
|
called.should be_true
|
164
164
|
end
|
165
165
|
end
|
@@ -173,12 +173,12 @@ describe Padlock('development') do
|
|
173
173
|
|
174
174
|
it "does not run the component block when not in an appropriate environment" do
|
175
175
|
called = false
|
176
|
-
component(:perimeter_fence) { called = true }
|
176
|
+
Padlock.component(:perimeter_fence) { called = true }
|
177
177
|
called.should be_true
|
178
178
|
end
|
179
179
|
|
180
180
|
it "returns false from the component check" do
|
181
|
-
component(:perimeter_fence).should be_true
|
181
|
+
Padlock.component(:perimeter_fence).should be_true
|
182
182
|
end
|
183
183
|
|
184
184
|
it "is indifferent to strings/symbols" do
|
@@ -187,7 +187,7 @@ describe Padlock('development') do
|
|
187
187
|
end
|
188
188
|
|
189
189
|
called = false
|
190
|
-
component(:perimeter_fence) { called = true }
|
190
|
+
Padlock.component(:perimeter_fence) { called = true }
|
191
191
|
called.should be_true
|
192
192
|
end
|
193
193
|
end
|
@@ -202,10 +202,10 @@ describe Padlock('development') do
|
|
202
202
|
|
203
203
|
it "restores original component behavior" do
|
204
204
|
Padlock.disable :enabled_component
|
205
|
-
component(:enabled_component).should be_false
|
205
|
+
Padlock.component(:enabled_component).should be_false
|
206
206
|
|
207
207
|
Padlock.reset!
|
208
|
-
component(:enabled_component).should be_true
|
208
|
+
Padlock.component(:enabled_component).should be_true
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: padlock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Pat Nakajima, Brandon Keene & Todd Persen
|
@@ -15,12 +15,26 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date:
|
18
|
+
date: 2011-05-16 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
|
-
dependencies:
|
21
|
-
|
20
|
+
dependencies:
|
21
|
+
- !ruby/object:Gem::Dependency
|
22
|
+
name: rspec
|
23
|
+
prerelease: false
|
24
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
hash: 1
|
30
|
+
segments:
|
31
|
+
- 2
|
32
|
+
- 1
|
33
|
+
version: "2.1"
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
22
36
|
description:
|
23
|
-
email:
|
37
|
+
email: casecommons-dev@googlegroups.com
|
24
38
|
executables: []
|
25
39
|
|
26
40
|
extensions: []
|
@@ -28,12 +42,16 @@ extensions: []
|
|
28
42
|
extra_rdoc_files: []
|
29
43
|
|
30
44
|
files:
|
45
|
+
- .gitignore
|
46
|
+
- Gemfile
|
31
47
|
- LICENSE
|
32
48
|
- README.md
|
49
|
+
- Rakefile
|
33
50
|
- lib/padlock.rb
|
51
|
+
- padlock.gemspec
|
34
52
|
- spec/padlock_spec.rb
|
35
53
|
has_rdoc: true
|
36
|
-
homepage: http://github.com/
|
54
|
+
homepage: http://github.com/CaseCommons/padlock
|
37
55
|
licenses: []
|
38
56
|
|
39
57
|
post_install_message:
|
@@ -66,5 +84,5 @@ rubygems_version: 1.3.7
|
|
66
84
|
signing_key:
|
67
85
|
specification_version: 3
|
68
86
|
summary: Padlock is an environment-based component switch system.
|
69
|
-
test_files:
|
70
|
-
|
87
|
+
test_files:
|
88
|
+
- spec/padlock_spec.rb
|