mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
eliminating a branch we do not need. thanks @jeremy
This commit is contained in:
parent
47db156d42
commit
33da24a8db
1 changed files with 3 additions and 30 deletions
|
@ -156,25 +156,9 @@ module Rails
|
||||||
path = File.expand_path(p, @root.path)
|
path = File.expand_path(p, @root.path)
|
||||||
|
|
||||||
if @glob
|
if @glob
|
||||||
if File.directory? path
|
result.concat Dir.chdir(path) {
|
||||||
result.concat expand_dir(path, @glob)
|
Dir.glob(@glob).map { |file| File.join path, file }.sort
|
||||||
else
|
}
|
||||||
# FIXME: I think we can remove this branch, but I'm not sure.
|
|
||||||
# Say the filesystem has this file:
|
|
||||||
#
|
|
||||||
# /tmp/foobar
|
|
||||||
#
|
|
||||||
# and someone adds this path:
|
|
||||||
#
|
|
||||||
# /tmp/foo
|
|
||||||
#
|
|
||||||
# with a glob of "*", then this function will return
|
|
||||||
#
|
|
||||||
# /tmp/foobar
|
|
||||||
#
|
|
||||||
# We need to figure out if that is desired behavior.
|
|
||||||
result.concat expand_file(path, @glob)
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
result << path
|
result << path
|
||||||
end
|
end
|
||||||
|
@ -194,17 +178,6 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
alias to_a expanded
|
alias to_a expanded
|
||||||
|
|
||||||
private
|
|
||||||
def expand_file(path, glob)
|
|
||||||
Dir[File.join(path, glob)].sort
|
|
||||||
end
|
|
||||||
|
|
||||||
def expand_dir(path, glob)
|
|
||||||
Dir.chdir(path) do
|
|
||||||
Dir.glob(glob).map { |file| File.join path, file }.sort
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue