Skip to content
Browse files

Restructured directories to better serve as gem plugin

  • Loading branch information...
1 parent 2a1ebde commit fd1276c0408fc44818ada0c45529bad313845470 @stffn committed Mar 4, 2009
View
4 declarative_authorization.gemspec
@@ -2,13 +2,13 @@
Gem::Specification.new do |s|
s.name = "declarative_authorization"
- s.version = "0.2.3"
+ s.version = "0.2.4"
s.required_ruby_version = ">= 1.8.6"
s.authors = ["Steffen Bartsch"]
s.summary = "declarative_authorization is a Rails plugin for authorization based on readable authorization rules."
s.email = "sbartsch@tzi.org"
- s.files = ["CHANGELOG", "MIT-LICENSE", "README.rdoc", "Rakefile", "authorization_rules.dist.rb", "garlic_example.rb", "init.rb", "app/controllers/authorization_rules_controller.rb", "app/controllers/authorization_usages_controller.rb", "app/helpers/authorization_rules_helper.rb", "app/views/authorization_usages/index.html.erb", "app/views/authorization_rules/index.html.erb", "app/views/authorization_rules/graph.dot.erb", "app/views/authorization_rules/graph.html.erb", "config/routes.rb", "lib/in_controller.rb", "lib/reader.rb", "lib/rails_legacy.rb", "lib/obligation_scope.rb", "lib/in_model.rb", "lib/helper.rb", "lib/authorization.rb", "lib/maintenance.rb", "test/authorization_test.rb", "test/schema.sql", "test/maintenance_test.rb", "test/model_test.rb", "test/controller_test.rb", "test/helper_test.rb", "test/dsl_reader_test.rb", "test/test_helper.rb"]
+ s.files = ["CHANGELOG", "MIT-LICENSE", "README.rdoc", "Rakefile", "authorization_rules.dist.rb", "garlic_example.rb", "init.rb", "app/controllers/authorization_rules_controller.rb", "app/controllers/authorization_usages_controller.rb", "app/helpers/authorization_rules_helper.rb", "app/views/authorization_usages/index.html.erb", "app/views/authorization_rules/index.html.erb", "app/views/authorization_rules/graph.dot.erb", "app/views/authorization_rules/graph.html.erb", "config/routes.rb", "lib/declarative_authorization.rb", "lib/declarative_authorization/in_controller.rb", "lib/declarative_authorization/reader.rb", "lib/declarative_authorization/rails_legacy.rb", "lib/declarative_authorization/obligation_scope.rb", "lib/declarative_authorization/in_model.rb", "lib/declarative_authorization/helper.rb", "lib/declarative_authorization/authorization.rb", "lib/declarative_authorization/maintenance.rb", "lib/declarative_authorization.rb", "test/authorization_test.rb", "test/schema.sql", "test/maintenance_test.rb", "test/model_test.rb", "test/controller_test.rb", "test/helper_test.rb", "test/dsl_reader_test.rb", "test/test_helper.rb"]
s.has_rdoc = true
s.homepage = %q{http://github.com/stffn/declarative_authorization}
View
4 declarative_authorization.gemspec.src
@@ -2,13 +2,13 @@
Gem::Specification.new do |s|
s.name = "declarative_authorization"
- s.version = "0.2.3"
+ s.version = "0.2.4"
s.required_ruby_version = ">= 1.8.6"
s.authors = ["Steffen Bartsch"]
s.summary = "declarative_authorization is a Rails plugin for authorization based on readable authorization rules."
s.email = "sbartsch@tzi.org"
- s.files = %w{CHANGELOG MIT-LICENSE README.rdoc Rakefile authorization_rules.dist.rb garlic_example.rb init.rb} + Dir["app/**/*.rb"] + Dir["app/**/*.erb"] + Dir["config/*"] + Dir["lib/*"] + Dir["test/*"]
+ s.files = %w{CHANGELOG MIT-LICENSE README.rdoc Rakefile authorization_rules.dist.rb garlic_example.rb init.rb} + Dir["app/**/*.rb"] + Dir["app/**/*.erb"] + Dir["config/*"] + Dir["lib/*.rb"] + Dir["lib/**/*.rb"] + Dir["test/*"]
s.has_rdoc = true
s.homepage = %q{http://github.com/stffn/declarative_authorization}
View
18 init.rb
@@ -1,15 +1,5 @@
-require File.dirname(__FILE__) + "/lib/rails_legacy.rb"
-require File.dirname(__FILE__) + "/lib/helper.rb"
-require File.dirname(__FILE__) + "/lib/in_controller.rb"
-require File.dirname(__FILE__) + "/lib/in_model.rb"
-require File.dirname(__FILE__) + "/lib/obligation_scope.rb"
-
-min_rails_version = "2.1.0"
-if Rails::VERSION::STRING < min_rails_version
- raise "declarative_authorization requires Rails #{min_rails_version}. You are using #{Rails::VERSION::STRING}."
+begin
+ require File.join(File.dirname(__FILE__), 'lib', 'declarative_authorization') # From here
+rescue LoadError
+ require 'declarative_authorization' # From gem
end
-
-ActionController::Base.send :include, Authorization::AuthorizationInController
-ActionController::Base.helper Authorization::AuthorizationHelper
-
-ActiveRecord::Base.send :include, Authorization::AuthorizationInModel
View
15 lib/declarative_authorization.rb
@@ -0,0 +1,15 @@
+require File.join(%w{declarative_authorization rails_legacy})
+require File.join(%w{declarative_authorization helper})
+require File.join(%w{declarative_authorization in_controller})
+require File.join(%w{declarative_authorization in_model})
+require File.join(%w{declarative_authorization obligation_scope})
+
+min_rails_version = "2.1.0"
+if Rails::VERSION::STRING < min_rails_version
+ raise "declarative_authorization requires Rails #{min_rails_version}. You are using #{Rails::VERSION::STRING}."
+end
+
+ActionController::Base.send :include, Authorization::AuthorizationInController
+ActionController::Base.helper Authorization::AuthorizationHelper
+
+ActiveRecord::Base.send :include, Authorization::AuthorizationInModel
View
0 lib/authorization.rb → ...eclarative_authorization/authorization.rb
File renamed without changes.
View
0 lib/helper.rb → lib/declarative_authorization/helper.rb
File renamed without changes.
View
0 lib/in_controller.rb → ...eclarative_authorization/in_controller.rb
File renamed without changes.
View
0 lib/in_model.rb → lib/declarative_authorization/in_model.rb
File renamed without changes.
View
0 lib/maintenance.rb → lib/declarative_authorization/maintenance.rb
File renamed without changes.
View
0 lib/obligation_scope.rb → ...arative_authorization/obligation_scope.rb
File renamed without changes.
View
0 lib/rails_legacy.rb → ...declarative_authorization/rails_legacy.rb
File renamed without changes.
View
0 lib/reader.rb → lib/declarative_authorization/reader.rb
File renamed without changes.
View
3 test/helper_test.rb
@@ -1,6 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper.rb')
-require File.dirname(__FILE__) + '/../lib/in_controller.rb'
-require File.dirname(__FILE__) + '/../lib/helper.rb'
+require File.join(File.dirname(__FILE__), %w{.. lib declarative_authorization helper})
class HelperMocksController < MocksController
View
2 test/maintenance_test.rb
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper.rb')
-require File.join(File.dirname(__FILE__), %w{.. lib maintenance})
+require File.join(File.dirname(__FILE__), %w{.. lib declarative_authorization maintenance})
class MaintenanceTest < Test::Unit::TestCase
View
2 test/model_test.rb
@@ -1,5 +1,5 @@
require File.join(File.dirname(__FILE__), 'test_helper.rb')
-require File.join(File.dirname(__FILE__), '..', 'lib', 'in_model.rb')
+require File.join(File.dirname(__FILE__), %w{.. lib declarative_authorization in_model})
ActiveRecord::Base.send :include, Authorization::AuthorizationInModel
#ActiveRecord::Base.logger = Logger.new(STDOUT)
View
8 test/test_helper.rb
@@ -1,8 +1,8 @@
require 'test/unit'
-RAILS_ROOT = File.dirname(__FILE__) + '/../../../../'
-require File.dirname(__FILE__) + '/../lib/rails_legacy.rb'
-require File.dirname(__FILE__) + '/../lib/authorization.rb'
-require File.dirname(__FILE__) + '/../lib/in_controller.rb'
+RAILS_ROOT = File.join(File.dirname(__FILE__), %w{.. .. .. ..})
+require File.join(File.dirname(__FILE__), %w{.. lib declarative_authorization rails_legacy})
+require File.join(File.dirname(__FILE__), %w{.. lib declarative_authorization authorization})
+require File.join(File.dirname(__FILE__), %w{.. lib declarative_authorization in_controller})
unless defined?(ActiveRecord)
if File.directory? RAILS_ROOT + 'config'

0 comments on commit fd1276c

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