class RBT::Cookbooks::CheckForCorrectDependencies
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = ARGV, run_already = true )
click to toggle source
Public Instance Methods
check_for_every_entry( use_this_as_the_key_for_required_deps_on = 'required_deps_on'.to_sym )
click to toggle source
#¶ ↑
check_for_every_entry
¶ ↑
This method will check for every available (registered) program.
#¶ ↑
# File lib/rbt/checks_and_validations/check_for_correct_dependencies.rb, line 106 def check_for_every_entry( use_this_as_the_key_for_required_deps_on = 'required_deps_on'.to_sym ) opne 'Now checking every program. This may take a while.' available_programs?.each {|program| program = File.basename(program).sub(/\.yml$/,'') # ===================================================================== # # The next line is very verbose, so it may be best to enable it only # for debugging purposes really. # ===================================================================== # # opne 'Working on the program `'+sfancy(program)+'` next.' # ===================================================================== # # We have two ways for the next line - we will either instantiate a # new Cookbooks object - or we will make use of an already existing, # expanded .yml file that holds the dataset for the program at hand. # ===================================================================== # if expanded_directory_exists? and File.exist?( path_to_this_expanded_cookbooks_dataset(program) ) dataset = YAML.load_file( path_to_this_expanded_cookbooks_dataset(program) ) deps = dataset[use_this_as_the_key_for_required_deps_on] else @raw_cookbook.reset_the_main_hash dataset = @raw_cookbook.find(program) deps = @raw_cookbook.deps? end result = nil if deps result = deps.all? {|entry| RBT.really_does_include?(entry) } end if result # Ok, in this case all entries were found. else # else it was not found, so work on that. if deps @n_erroneous_entries_were_found += 1 deps.each {|entry| if entry.nil? opne 'Nil value found for `'+steelblue(program)+'`. '\ 'This is probably an empty entry.' end if entry if entry.include?(' ') entry = entry.split(' ').first.strip end unless RBT.really_does_include? entry e "#{format_program(program)} No "\ "entry for `#{simp(entry)}` was found." end end } end end } end
format_program(i)
click to toggle source
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Base#reset
# File lib/rbt/checks_and_validations/check_for_correct_dependencies.rb, line 46 def reset super() infer_the_namespace # ======================================================================= # # === @raw_cookbook # ======================================================================= # @raw_cookbook = RBT.raw_cookbook # ======================================================================= # # === @n_erroneous_entries_were_found # ======================================================================= # @n_erroneous_entries_were_found = 0 end
run()
click to toggle source