Skip to content
This repository
Browse code

fix for the new loader

  • Loading branch information...
commit c70069d964bbf13c00c8fd3a0228e35c7d35f977 1 parent 4dd8aae
Henning Koch authored May 09, 2010
19  aegis.gemspec
@@ -5,11 +5,11 @@
5 5
 
6 6
 Gem::Specification.new do |s|
7 7
   s.name = %q{aegis}
8  
-  s.version = "2.0.0"
  8
+  s.version = "2.0.1"
9 9
 
10 10
   s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11 11
   s.authors = ["Henning Koch", "Tobias Kraze"]
12  
-  s.date = %q{2010-05-02}
  12
+  s.date = %q{2010-05-09}
13 13
   s.description = %q{Aegis is an authorization solution for Ruby on Rails that supports roles and a RESTish, resource-style declaration of permission rules.}
14 14
   s.email = %q{henning.koch@makandra.de}
15 15
   s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
27 27
      "lib/aegis/action.rb",
28 28
      "lib/aegis/compiler.rb",
29 29
      "lib/aegis/has_role.rb",
  30
+     "lib/aegis/loader.rb",
30 31
      "lib/aegis/parser.rb",
31 32
      "lib/aegis/permissions.rb",
32 33
      "lib/aegis/resource.rb",
@@ -58,6 +59,7 @@ Gem::Specification.new do |s|
58 59
      "spec/app_root/script/console",
59 60
      "spec/controllers/reviews_controller_spec.rb",
60 61
      "spec/has_role_spec.rb",
  62
+     "spec/loader_spec.rb",
61 63
      "spec/permissions_spec.rb",
62 64
      "spec/rcov.opts",
63 65
      "spec/spec.opts",
@@ -66,15 +68,15 @@ Gem::Specification.new do |s|
66 68
   s.homepage = %q{http://github.com/makandra/aegis}
67 69
   s.rdoc_options = ["--charset=UTF-8"]
68 70
   s.require_paths = ["lib"]
69  
-  s.rubygems_version = %q{1.3.5}
  71
+  s.rubygems_version = %q{1.3.6}
70 72
   s.summary = %q{Complete authorization solution for Rails}
71 73
   s.test_files = [
72  
-    "spec/app_root/app/models/user.rb",
  74
+    "spec/app_root/app/controllers/application_controller.rb",
  75
+     "spec/app_root/app/controllers/reviews_controller.rb",
  76
+     "spec/app_root/app/models/permissions.rb",
73 77
      "spec/app_root/app/models/property.rb",
74 78
      "spec/app_root/app/models/review.rb",
75  
-     "spec/app_root/app/models/permissions.rb",
76  
-     "spec/app_root/app/controllers/application_controller.rb",
77  
-     "spec/app_root/app/controllers/reviews_controller.rb",
  79
+     "spec/app_root/app/models/user.rb",
78 80
      "spec/app_root/config/boot.rb",
79 81
      "spec/app_root/config/environment.rb",
80 82
      "spec/app_root/config/environments/in_memory.rb",
@@ -88,10 +90,11 @@ Gem::Specification.new do |s|
88 90
      "spec/app_root/db/migrate/003_create_reviews.rb",
89 91
      "spec/app_root/lib/console_with_fixtures.rb",
90 92
      "spec/action_controller_spec.rb",
  93
+     "spec/controllers/reviews_controller_spec.rb",
91 94
      "spec/has_role_spec.rb",
92 95
      "spec/permissions_spec.rb",
93 96
      "spec/spec_helper.rb",
94  
-     "spec/controllers/reviews_controller_spec.rb"
  97
+     "spec/loader_spec.rb"
95 98
   ]
96 99
 
97 100
   if s.respond_to? :specification_version then
20  lib/aegis.rb
... ...
@@ -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  
-require 'aegis/access_denied'
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
49  lib/aegis/loader.rb
... ...
@@ -1,26 +1,35 @@
1  
-class Aegis::Loader
2  
-  class << self
  1
+module Aegis
  2
+  class Loader
  3
+    class << self
3 4
 
4  
-    def paths
5  
-      [ 'aegis/access_denied',
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  
-        'rails/action_controller',
16  
-        'rails/active_record' ]
17  
-    end
  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  
-    def load
20  
-      for path in paths
21  
-        require path
  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
15  spec/loader_spec.rb
@@ -7,12 +7,19 @@
7 7
     it "should return all paths in the lib folder" do
8 8
 
9 9
       root = "#{File.dirname(__FILE__)}/../lib/"
10  
-      expected_paths = Dir["#{root}*/*.rb"].collect do |file|
11  
-        file.sub(root, "").sub(/\.rb$/, "")
12  
-      end - ['aegis/loader']
  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  
-      Aegis::Loader.paths.should =~ expected_paths
  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

0 notes on commit c70069d

Please sign in to comment.
Something went wrong with that request. Please try again.