aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/commands.rb
diff options
context:
space:
mode:
authorXu Cheng2015-10-26 13:34:04 +0800
committerXu Cheng2015-10-26 16:11:18 +0800
commit1248294c8cbdf2503eed3622d9e088ac75dec38e (patch)
tree71314baf8c1c151d4ce0c72e35694ccb957ce952 /Library/Homebrew/cmd/commands.rb
parentf6cf1a4025b80a01427570d9b451b9f3fd684a7e (diff)
downloadbrew-1248294c8cbdf2503eed3622d9e088ac75dec38e.tar.bz2
commands: ensure internal commands are files
`Pathname#children(with_directory = false)` doesn't filter directories, instead it returns path with basename. Closes Homebrew/homebrew#45325. Signed-off-by: Xu Cheng <xucheng@me.com>
Diffstat (limited to 'Library/Homebrew/cmd/commands.rb')
-rw-r--r--Library/Homebrew/cmd/commands.rb6
1 files changed, 2 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/commands.rb b/Library/Homebrew/cmd/commands.rb
index d7734e132..6630e7134 100644
--- a/Library/Homebrew/cmd/commands.rb
+++ b/Library/Homebrew/cmd/commands.rb
@@ -27,13 +27,11 @@ module Homebrew
end
def internal_commands
- with_directory = false
- (HOMEBREW_LIBRARY_PATH/"cmd").children(with_directory).map { |f| File.basename(f, ".rb") }
+ (HOMEBREW_LIBRARY_PATH/"cmd").children.select(&:file?).map { |f| f.basename(".rb").to_s }
end
def internal_development_commands
- with_directory = false
- (HOMEBREW_LIBRARY_PATH/"dev-cmd").children(with_directory).map { |f| File.basename(f, ".rb") }
+ (HOMEBREW_LIBRARY_PATH/"dev-cmd").children.select(&:file?).map { |f| f.basename(".rb").to_s }
end
def external_commands