aboutsummaryrefslogtreecommitdiffstats
path: root/railties/lib/rails/paths.rb
diff options
context:
space:
mode:
authorJosé Valim <jose.valim@gmail.com>2010-01-22 16:24:44 +0100
committerJosé Valim <jose.valim@gmail.com>2010-01-22 16:24:44 +0100
commit4ae79367277954bf6616151b03cbe0660808f9bd (patch)
treed34be77dce755b395e22a87df1b42861a0120344 /railties/lib/rails/paths.rb
parent02c5137eadbb3530033d919b7aebeb6f4f389b83 (diff)
downloadrails-4ae79367277954bf6616151b03cbe0660808f9bd.tar.gz
rails-4ae79367277954bf6616151b03cbe0660808f9bd.tar.bz2
rails-4ae79367277954bf6616151b03cbe0660808f9bd.zip
Got tests working once again.
Diffstat (limited to 'railties/lib/rails/paths.rb')
-rw-r--r--railties/lib/rails/paths.rb18
1 files changed, 8 insertions, 10 deletions
diff --git a/railties/lib/rails/paths.rb b/railties/lib/rails/paths.rb
index b3d105d8c7..d81af3c709 100644
--- a/railties/lib/rails/paths.rb
+++ b/railties/lib/rails/paths.rb
@@ -39,6 +39,7 @@ module Rails
all_paths.map { |path| path.paths if path.eager_load? }.compact.flatten.uniq
end
+ # TODO Discover why do we need to call uniq! here
def all_paths
@all_paths.uniq!
@all_paths
@@ -48,12 +49,6 @@ module Rails
all_paths.map { |path| path.paths if path.load_path? }.compact.flatten.uniq
end
- def add_to_load_path
- load_paths.reverse_each do |path|
- $LOAD_PATH.unshift(path) if File.directory?(path)
- end
- end
-
def push(*)
raise "Application root can only have one physical path"
end
@@ -74,7 +69,7 @@ module Rails
@children = {}
@root = root
@paths = paths.flatten
- @glob = @options[:glob] || "**/*.rb"
+ @glob = @options.delete(:glob)
@load_once = @options[:load_once]
@eager_load = @options[:eager_load]
@@ -128,10 +123,13 @@ module Rails
def paths
raise "You need to set a path root" unless @root.path
-
- @paths.map do |path|
- path.index('/') == 0 ? path : File.expand_path(File.join(@root.path, path))
+ result = @paths.map do |p|
+ path = File.expand_path(p, @root.path)
+ @glob ? Dir[File.join(path, @glob)] : path
end
+ result.flatten!
+ result.uniq!
+ result
end
alias to_a paths