aegis 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/aegis.gemspec +1 -1
- data/lib/aegis.rb +1 -19
- data/lib/aegis/loader.rb +29 -20
- data/spec/loader_spec.rb +11 -4
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.2
|
data/aegis.gemspec
CHANGED
data/lib/aegis.rb
CHANGED
@@ -1,20 +1,2 @@
|
|
1
|
-
require 'ostruct'
|
2
|
-
|
3
|
-
#for file in Dir["#{File.dirname(__FILE__)}/*/*.rb"]
|
4
|
-
# p file
|
5
|
-
#end
|
6
|
-
|
7
|
-
# Dir["#{File.dirname(__FILE__)}/**/*.rb"].each {|f| require f}
|
8
|
-
|
9
1
|
require 'aegis/loader'
|
10
|
-
|
11
|
-
require 'aegis/action'
|
12
|
-
require 'aegis/compiler'
|
13
|
-
require 'aegis/has_role'
|
14
|
-
require 'aegis/parser'
|
15
|
-
require 'aegis/permissions'
|
16
|
-
require 'aegis/role'
|
17
|
-
require 'aegis/sieve'
|
18
|
-
|
19
|
-
require 'rails/action_controller'
|
20
|
-
require 'rails/active_record'
|
2
|
+
Aegis::Loader.load_paths
|
data/lib/aegis/loader.rb
CHANGED
@@ -1,26 +1,35 @@
|
|
1
|
-
|
2
|
-
class
|
1
|
+
module Aegis
|
2
|
+
class Loader
|
3
|
+
class << self
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
'aegis/action',
|
7
|
-
'aegis/compiler',
|
8
|
-
'aegis/has_role',
|
9
|
-
'aegis/parser',
|
10
|
-
'aegis/permissions',
|
11
|
-
'aegis/resource',
|
12
|
-
'aegis/role',
|
13
|
-
'aegis/sieve',
|
5
|
+
def paths
|
6
|
+
[ 'ostruct',
|
14
7
|
|
15
|
-
|
16
|
-
|
17
|
-
|
8
|
+
'aegis/access_denied',
|
9
|
+
'aegis/action',
|
10
|
+
'aegis/compiler',
|
11
|
+
'aegis/has_role',
|
12
|
+
'aegis/parser',
|
13
|
+
'aegis/permissions',
|
14
|
+
'aegis/resource',
|
15
|
+
'aegis/role',
|
16
|
+
'aegis/sieve',
|
17
|
+
|
18
|
+
'rails/action_controller',
|
19
|
+
'rails/active_record' ]
|
20
|
+
end
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
+
def load_paths
|
23
|
+
for path in paths
|
24
|
+
require path
|
25
|
+
end
|
26
|
+
@loaded = true
|
22
27
|
end
|
28
|
+
|
29
|
+
def loaded?
|
30
|
+
@loaded
|
31
|
+
end
|
32
|
+
|
23
33
|
end
|
24
|
-
|
25
34
|
end
|
26
|
-
end
|
35
|
+
end
|
data/spec/loader_spec.rb
CHANGED
@@ -7,12 +7,19 @@ describe Aegis::Loader do
|
|
7
7
|
it "should return all paths in the lib folder" do
|
8
8
|
|
9
9
|
root = "#{File.dirname(__FILE__)}/../lib/"
|
10
|
-
|
11
|
-
file.sub(root, "").sub(/\.rb$/, "")
|
12
|
-
|
10
|
+
Dir["#{root}*/*.rb"].collect do |file|
|
11
|
+
path = file.sub(root, "").sub(/\.rb$/, "")
|
12
|
+
Aegis::Loader.paths.should include(path) unless path == 'aegis/loader'
|
13
|
+
end
|
13
14
|
|
14
|
-
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
describe 'loaded?' do
|
15
20
|
|
21
|
+
it "should be loaded" do
|
22
|
+
Aegis::Loader.should be_loaded
|
16
23
|
end
|
17
24
|
|
18
25
|
end
|