Permalink
Browse files

removed unused files now that rails handles app path loading in plugi…

…n directories
  • Loading branch information...
1 parent 2521b19 commit a1139ef76375e963038fa3d668b3cb743d77ac76 @craigambrose committed Mar 24, 2009
View
@@ -4,4 +4,3 @@
require File.expand_path(dir + '/rails_extensions/rails_extensions')
require File.expand_path(dir + '/ruby_extensions/ruby_extensions')
-
@@ -1,116 +0,0 @@
-module PluginInstances
- class Manager
- class << self
- def instance
- @instance ||= new
- end
- attr_writer :instance
-
- protected
- def method_missing(method_name, *args, &block)
- instance.__send__(method_name, *args, &block)
- end
- end
-
- attr_reader :loading_plugin, :plugins_in_registration
-
- def initialize
- @plugins = []
- @plugins_in_registration = []
- end
-
- def plugins
- @plugins.dup
- end
-
- def load_paths
- paths = []
- plugin_paths.each do |component_root|
- paths << File.join(component_root, 'app')
- paths << File.join(component_root, 'app','models')
- paths << File.join(component_root, 'app','controllers')
- paths << File.join(component_root, 'app','helpers')
- paths << File.join(component_root, 'lib')
- end
- dependencies.load_paths.reverse.each do |path|
- paths << File.expand_path(path) unless paths.include?(File.expand_path(path))
- end
- paths
- end
-
- def register_plugin(plugin_path)
- plugin = Plugin.new(plugin_path)
- @plugins_in_registration << plugin
-
- yield if block_given?
-
- dependencies.load_paths << plugin.models_path
- dependencies.load_paths << plugin.controllers_path
- dependencies.load_paths << plugin.helpers_path
-
- @plugins_in_registration.pop
-
- if existing_plugin = find_plugin(plugin.name)
- return existing_plugin
- end
-
- @plugins << plugin
- plugin
- end
-
- def find_plugin(name_or_directory)
- name = File.basename(File.expand_path(name_or_directory))
- plugins.find do |plugin|
- plugin.name == name
- end
- end
-
- def plugin_exists?(name_or_directory)
- !find_plugin(name_or_directory).nil?
- end
-
- def plugin_path(name)
- plugin = find_plugin(name)
- return nil unless plugin
- plugin.path
- end
-
- def files_on_load_path(file)
- plugin_instances_file_exists = false
- files = []
- load_paths.each do |path|
- full_path = File.join(path, file)
- full_path << '.rb' unless File.extname(full_path) == '.rb'
- files << full_path if File.exists?(full_path)
- end
- files
- end
-
- def directory_on_load_path?(dir_suffix)
- PluginInstances::Manager.load_paths.each do |path|
- return true if File.directory?(File.join(path, dir_suffix))
- end
- return false
- end
-
- def layout_paths
- layout_paths = plugins.reverse.collect do |plugin|
- plugin.layouts_path
- end
- layout_paths
- end
-
- protected
- def dependencies
- @dependencies ||= ActiveSupport.const_defined?(:Dependencies) ? ActiveSupport::Dependencies : Dependencies
- end
-
- def plugin_paths
- plugins_and_app.collect { |plugin| plugin.path }
- end
-
- def plugins_and_app
- plugins + @plugins_in_registration + [Plugin.new(RAILS_ROOT)]
- end
- end
-end
@@ -1,10 +0,0 @@
-ActionView::Base.class_eval do
- def initialize_with_plugin_instances(*args)
- initialize_without_plugin_instances *args
-
- PluginInstances::Manager.plugins.reverse.each do |plugin|
- view_paths << plugin.templates_path
- end
- end
- alias_method_chain :initialize, :plugin_instances
-end
@@ -1,12 +0,0 @@
-module ActionController #:nodoc:
- module Layout #:nodoc:
- module ClassMethods #:nodoc:
- private
- def layout_list_with_plugin_routing
- plugin_layouts = PluginInstances::Manager.layout_paths.join(",")
- layout_list_without_plugin_routing + Dir["{#{plugin_layouts}}/**/*"]
- end
- alias_method_chain :layout_list, :plugin_routing
- end
- end
-end
@@ -1,23 +0,0 @@
-
-class Rails::Plugin
- attr_accessor :initializer
- def require_plugin(plugin_name)
- initializer.configuration.plugin_locators.each do |locator|
- locator.new(initializer).each do |plugin_loader|
- return plugin_loader.load(initializer) if plugin_loader.name.to_s == plugin_name.to_s
- end
- end
- raise "Plugin '#{plugin_name}' does not exist"
- end
-
- def load_with_plugin_instances(initializer)
- @initializer = initializer
- return if PluginInstances::Manager.plugin_exists?(directory)
- plugin = PluginInstances::Manager.register_plugin(directory) do
- load_without_plugin_instances(initializer)
- end
- # TODO: Can we use Initializer::Configuration#default_load_paths to do this?
- initializer.configuration.controller_paths << plugin.controllers_path
- end
- alias_method_chain :load, :plugin_instances
-end
@@ -1,8 +1,5 @@
dir = File.expand_path(File.dirname(__FILE__))
-require File.expand_path(dir + '/plugin')
require File.expand_path(dir + '/route_set')
require File.expand_path(dir + '/route_set_mapper')
require File.expand_path(dir + '/url_rewriter')
-require File.expand_path(dir + '/layout')
-require File.expand_path(dir + '/action_view')
@@ -1,34 +0,0 @@
-class Object
- def require_with_pliki(path)
- relative_include_path = (path =~ /\.rb$/) ? path : "#{path}.rb"
- if $".include?(relative_include_path)
- return false
- else
- __each_matching_file(path) do |expanded_path|
- require_without_pliki expanded_path
- end
- $" << relative_include_path
- return true
- end
- end
- alias_method_chain :require, :pliki
-
- def load_with_pliki(file)
- __each_matching_file(file) do |file|
- load_without_pliki file
- end
- end
- alias_method_chain :load, :pliki
-
- private
- def __each_matching_file(file)
- files = PluginInstances::Manager.instance.files_on_load_path(file)
- pliki_file_exists = files.empty? ? false : true
- files.each do |component_file|
- yield(component_file)
- end
-
- return true if pliki_file_exists
- yield(file)
- end
-end

0 comments on commit a1139ef

Please sign in to comment.