Module: Readall
- Defined in:
- Library/Homebrew/readall.rb,
Library/Homebrew/extend/os/linux/readall.rb
Overview
typed: strict frozen_string_literal: true
Class Method Summary collapse
- .valid_aliases?(alias_dir, formula_dir) ⇒ Boolean private
- .valid_casks? ⇒ Boolean private
- .valid_formulae?(formulae) ⇒ Boolean private
- .valid_ruby_syntax?(ruby_files) ⇒ Boolean private
- .valid_tap?(tap, options = {}) ⇒ Boolean private
Class Method Details
.valid_aliases?(alias_dir, formula_dir) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'Library/Homebrew/readall.rb', line 21 def valid_aliases?(alias_dir, formula_dir) return true unless alias_dir.directory? failed = false alias_dir.each_child do |f| if !f.symlink? onoe "Non-symlink alias: #{f}" failed = true elsif !f.file? onoe "Non-file alias: #{f}" failed = true end if (formula_dir/"#{f.basename}.rb").exist? onoe "Formula duplicating alias: #{f}" failed = true end end !failed end |
.valid_casks? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'Library/Homebrew/readall.rb', line 56 def valid_casks?(casks) success = true casks.each do |file| Cask::CaskLoader.load(file) rescue Interrupt raise rescue Exception => e # rubocop:disable Lint/RescueException onoe "Invalid cask: #{file}" $stderr.puts e success = false end success end |
.valid_formulae?(formulae) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'Library/Homebrew/readall.rb', line 42 def valid_formulae?(formulae) success = true formulae.each do |file| Formulary.factory(file) rescue Interrupt raise rescue Exception => e # rubocop:disable Lint/RescueException onoe "Invalid formula: #{file}" $stderr.puts e success = false end success end |
.valid_ruby_syntax?(ruby_files) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 15 16 17 18 19 |
# File 'Library/Homebrew/readall.rb', line 12 def valid_ruby_syntax?(ruby_files) failed = false ruby_files.each do |ruby_file| # As a side effect, print syntax errors/warnings to `$stderr`. failed = true if syntax_errors_or_warnings?(ruby_file) end !failed end |
.valid_tap?(tap, options = {}) ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
70 71 72 73 74 75 76 77 78 79 80 |
# File 'Library/Homebrew/readall.rb', line 70 def valid_tap?(tap, = {}) success = true if [:aliases] valid_aliases = valid_aliases?(tap.alias_dir, tap.formula_dir) success = false unless valid_aliases end valid_formulae = valid_formulae?(tap.formula_files) valid_casks = valid_casks?(tap.cask_files) success = false if !valid_formulae || !valid_casks success end |