aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/paths.rb
diff options
context:
space:
mode:
authorYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-10-13 17:47:18 -0700
committerYehuda Katz + Carl Lerche <ykatz+clerche@engineyard.com>2009-10-14 11:18:45 -0700
commitd56984c01696348913b298bb65483534035304f0 (patch)
tree7a547ba570d7522c505f552552154f25d7b0cf8d /railties/lib/rails/paths.rb
parent7ec947d59c1bc3e9772788b757fe70f51b0ffd9b (diff)
downloadrails-d56984c01696348913b298bb65483534035304f0.tar.gz
rails-d56984c01696348913b298bb65483534035304f0.tar.bz2
rails-d56984c01696348913b298bb65483534035304f0.zip
Make rails configuration's path object's root lazy
Diffstat (limited to 'railties/lib/rails/paths.rb')
-rw-r--r--railties/lib/rails/paths.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index 3899b744b0..308d067701 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -19,14 +19,15 @@ module Rails
class Root
include PathParent
- attr_reader :path
+ attr_accessor :path
+
def initialize(path)
- raise unless path.is_a?(String)
+ raise if path.is_a?(Array)
@children = {}
# TODO: Move logic from set_root_path initializer
- @path = File.expand_path(path)
+ @path = path
@root = self
@all_paths = []
end
@@ -123,8 +124,10 @@ module Rails
end
def paths
+ raise "You need to set a path root" unless @root.path
+
@paths.map do |path|
- path.index('/') == 0 ? path : File.join(@root.path, path)
+ path.index('/') == 0 ? path : File.expand_path(File.join(@root.path, path))
end
end