aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails
diff options
context:
space:
mode:
authorPratik Naik <pratiknaik@gmail.com>2009-07-03 12:23:57 +0100
committerPratik Naik <pratiknaik@gmail.com>2009-07-03 12:23:57 +0100
commit3c1dab72259d01c6335bf359d7f9b3af69d45bb4 (patch)
treed90d345dd1654c9a74a09ec766ee6af58361cae5 /railties/lib/rails
parent378a65a909439ebca909125fdfada23ed89cec63 (diff)
downloadrails-3c1dab72259d01c6335bf359d7f9b3af69d45bb4.tar.gz
rails-3c1dab72259d01c6335bf359d7f9b3af69d45bb4.tar.bz2
rails-3c1dab72259d01c6335bf359d7f9b3af69d45bb4.zip
Revert "Modify the Rails::Application::Path object to allow for more concise path definition."
This reverts commit 913bb2f4c2feb79dcbc9ed2c0fb1ef6d436f7d02. Reason : The server does not start
Diffstat (limited to 'railties/lib/rails')
-rw-r--r--railties/lib/rails/paths.rb40
1 files changed, 15 insertions, 25 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index ca56199cbc..d2f6d83659 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -6,8 +6,8 @@ module Rails
def method_missing(id, *args)
name = id.to_s
- if name =~ /^(.*)=$/ || args.any?
- @children[$1 || name] = Path.new(@root, *args)
+ if name =~ /^(.*)=$/
+ @children[$1] = Path.new(args.first, @root)
elsif path = @children[name]
path
else
@@ -28,15 +28,17 @@ module Rails
# TODO: Move logic from set_root_path initializer
@path = File.expand_path(path)
@root = self
- @all_paths = []
+ @load_once, @eager_load, @all_paths = [], [], []
end
def load_once
- all_paths.map { |path| path.paths if path.load_once? }.compact.flatten.uniq
+ @load_once.uniq!
+ @load_once
end
def eager_load
- all_paths.map { |path| path.paths if path.eager_load? }.compact.flatten.uniq
+ @eager_load.uniq!
+ @eager_load
end
def all_paths
@@ -45,7 +47,7 @@ module Rails
end
def load_paths
- all_paths.map { |path| path.paths if path.load_path? }.compact.flatten.uniq
+ all_paths.map { |path| path.paths }.flatten
end
def add_to_load_path
@@ -53,14 +55,6 @@ module Rails
$LOAD_PATH.unshift(path) if File.directory?(path)
end
end
-
- def push(*)
- raise "Application root can only have one physical path"
- end
-
- alias unshift push
- alias << push
- alias concat push
end
class Path
@@ -69,18 +63,11 @@ module Rails
attr_reader :path
attr_accessor :glob
- def initialize(root, *paths)
- @options = paths.extract_options!
+ def initialize(path, root)
@children = {}
@root = root
- @paths = paths.flatten
- @glob = @options[:glob] || "**/*.rb"
-
- @load_once = @options[:load_once]
- @eager_load = @options[:eager_load]
- @load_path = @options[:load_path] || @eager_load
-
- @root.all_paths << self
+ @paths = [path].flatten
+ @glob = "**/*.rb"
end
def push(path)
@@ -99,6 +86,7 @@ module Rails
def load_once!
@load_once = true
+ @root.load_once.push *self.paths
end
def load_once?
@@ -107,7 +95,8 @@ module Rails
def eager_load!
@eager_load = true
- @load_path = true
+ @root.all_paths << self
+ @root.eager_load.push *self.paths
end
def eager_load?
@@ -116,6 +105,7 @@ module Rails
def load_path!
@load_path = true
+ @root.all_paths << self
end
def load_path?