Permalink
Browse files

fix for the new loader

  • Loading branch information...
triskweline committed May 9, 2010
1 parent 4dd8aae commit c70069d964bbf13c00c8fd3a0228e35c7d35f977
Showing with 52 additions and 51 deletions.
  1. +11 −8 aegis.gemspec
  2. +1 −19 lib/aegis.rb
  3. +29 −20 lib/aegis/loader.rb
  4. +11 −4 spec/loader_spec.rb
View
@@ -5,11 +5,11 @@
Gem::Specification.new do |s|
s.name = %q{aegis}
- s.version = "2.0.0"
+ s.version = "2.0.1"
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
s.authors = ["Henning Koch", "Tobias Kraze"]
- s.date = %q{2010-05-02}
+ s.date = %q{2010-05-09}
s.description = %q{Aegis is an authorization solution for Ruby on Rails that supports roles and a RESTish, resource-style declaration of permission rules.}
s.email = %q{henning.koch@makandra.de}
s.extra_rdoc_files = [
@@ -27,6 +27,7 @@ Gem::Specification.new do |s|
"lib/aegis/action.rb",
"lib/aegis/compiler.rb",
"lib/aegis/has_role.rb",
+ "lib/aegis/loader.rb",
"lib/aegis/parser.rb",
"lib/aegis/permissions.rb",
"lib/aegis/resource.rb",
@@ -58,6 +59,7 @@ Gem::Specification.new do |s|
"spec/app_root/script/console",
"spec/controllers/reviews_controller_spec.rb",
"spec/has_role_spec.rb",
+ "spec/loader_spec.rb",
"spec/permissions_spec.rb",
"spec/rcov.opts",
"spec/spec.opts",
@@ -66,15 +68,15 @@ Gem::Specification.new do |s|
s.homepage = %q{http://github.com/makandra/aegis}
s.rdoc_options = ["--charset=UTF-8"]
s.require_paths = ["lib"]
- s.rubygems_version = %q{1.3.5}
+ s.rubygems_version = %q{1.3.6}
s.summary = %q{Complete authorization solution for Rails}
s.test_files = [
- "spec/app_root/app/models/user.rb",
+ "spec/app_root/app/controllers/application_controller.rb",
+ "spec/app_root/app/controllers/reviews_controller.rb",
+ "spec/app_root/app/models/permissions.rb",
"spec/app_root/app/models/property.rb",
"spec/app_root/app/models/review.rb",
- "spec/app_root/app/models/permissions.rb",
- "spec/app_root/app/controllers/application_controller.rb",
- "spec/app_root/app/controllers/reviews_controller.rb",
+ "spec/app_root/app/models/user.rb",
"spec/app_root/config/boot.rb",
"spec/app_root/config/environment.rb",
"spec/app_root/config/environments/in_memory.rb",
@@ -88,10 +90,11 @@ Gem::Specification.new do |s|
"spec/app_root/db/migrate/003_create_reviews.rb",
"spec/app_root/lib/console_with_fixtures.rb",
"spec/action_controller_spec.rb",
+ "spec/controllers/reviews_controller_spec.rb",
"spec/has_role_spec.rb",
"spec/permissions_spec.rb",
"spec/spec_helper.rb",
- "spec/controllers/reviews_controller_spec.rb"
+ "spec/loader_spec.rb"
]
if s.respond_to? :specification_version then
View
@@ -1,20 +1,2 @@
-require 'ostruct'
-
-#for file in Dir["#{File.dirname(__FILE__)}/*/*.rb"]
-# p file
-#end
-
-# Dir["#{File.dirname(__FILE__)}/**/*.rb"].each {|f| require f}
-
require 'aegis/loader'
-require 'aegis/access_denied'
-require 'aegis/action'
-require 'aegis/compiler'
-require 'aegis/has_role'
-require 'aegis/parser'
-require 'aegis/permissions'
-require 'aegis/role'
-require 'aegis/sieve'
-
-require 'rails/action_controller'
-require 'rails/active_record'
+Aegis::Loader.load_paths
View
@@ -1,26 +1,35 @@
-class Aegis::Loader
- class << self
+module Aegis
+ class Loader
+ class << self
- def paths
- [ 'aegis/access_denied',
- 'aegis/action',
- 'aegis/compiler',
- 'aegis/has_role',
- 'aegis/parser',
- 'aegis/permissions',
- 'aegis/resource',
- 'aegis/role',
- 'aegis/sieve',
+ def paths
+ [ 'ostruct',
- 'rails/action_controller',
- 'rails/active_record' ]
- end
+ 'aegis/access_denied',
+ 'aegis/action',
+ 'aegis/compiler',
+ 'aegis/has_role',
+ 'aegis/parser',
+ 'aegis/permissions',
+ 'aegis/resource',
+ 'aegis/role',
+ 'aegis/sieve',
+
+ 'rails/action_controller',
+ 'rails/active_record' ]
+ end
- def load
- for path in paths
- require path
+ def load_paths
+ for path in paths
+ require path
+ end
+ @loaded = true
end
+
+ def loaded?
+ @loaded
+ end
+
end
-
end
-end
+end
View
@@ -7,12 +7,19 @@
it "should return all paths in the lib folder" do
root = "#{File.dirname(__FILE__)}/../lib/"
- expected_paths = Dir["#{root}*/*.rb"].collect do |file|
- file.sub(root, "").sub(/\.rb$/, "")
- end - ['aegis/loader']
+ Dir["#{root}*/*.rb"].collect do |file|
+ path = file.sub(root, "").sub(/\.rb$/, "")
+ Aegis::Loader.paths.should include(path) unless path == 'aegis/loader'
+ end
- Aegis::Loader.paths.should =~ expected_paths
+ end
+
+ end
+
+ describe 'loaded?' do
+ it "should be loaded" do
+ Aegis::Loader.should be_loaded
end
end

0 comments on commit c70069d

Please sign in to comment.