Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Library/Homebrew/diagnostic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1075,6 +1075,29 @@ def check_for_external_cmd_name_conflict
message
end

def check_for_tap_ruby_files_locations
bad_tap_files = {}
Tap.each do |tap|
unused_formula_dirs = tap.potential_formula_dirs - [tap.formula_dir]
unused_formula_dirs.each do |dir|
next unless dir.exist?
dir.children.each do |path|
next unless path.extname == ".rb"
bad_tap_files[tap] ||= []
bad_tap_files[tap] << path
end
end
end
return if bad_tap_files.empty?
bad_tap_files.keys.map do |tap|
<<-EOS.undent
Found Ruby file outside #{tap} tap formula directory
(#{tap.formula_dir}):
#{bad_tap_files[tap].join("\n ")}
EOS
end.join("\n")
end

def all
methods.map(&:to_s).grep(/^check_/)
end
Expand Down
6 changes: 5 additions & 1 deletion Library/Homebrew/tap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,11 @@ def custom_remote?

# path to the directory of all {Formula} files for this {Tap}.
def formula_dir
@formula_dir ||= [path/"Formula", path/"HomebrewFormula", path].detect(&:directory?)
@formula_dir ||= potential_formula_dirs.detect(&:directory?)
end

def potential_formula_dirs
@potential_formula_dirs ||= [path/"Formula", path/"HomebrewFormula", path].freeze
end

# path to the directory of all {Cask} files for this {Tap}.
Expand Down