class RBT::Cookbooks::BatchValidateTheCookbookRecipes

Public Class Methods

[](i = '') click to toggle source
#

RBT::Cookbooks::BatchValidateTheCookbookRecipes[]

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 132
def self.[](i = '')
  new(i)
end
new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 31
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(
    i
  )
  run if run_already
end

Public Instance Methods

consider_clearing_ARGV() click to toggle source
#

consider_clearing_ARGV

This method is necessary because the other validation-files tap into ARGV.

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 112
def consider_clearing_ARGV
  unless ARGV.empty?
    ARGV.clear
  end
end
determine_which_files_to_run() click to toggle source
#

determine_which_files_to_run

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 101
def determine_which_files_to_run
  @array_run_these_files << Dir["#{directory_validation?}*.rb"]
  @array_run_these_files.flatten!
end
input?() click to toggle source
#

input?

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 66
def input?
  @input
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 45
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @array_run_these_files
  # ======================================================================= #
  @array_run_these_files = []
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 121
def run
  determine_which_files_to_run
  consider_clearing_ARGV
  run_these_files(
    @array_run_these_files
  )
end
run_these_files(i)
Alias for: run_this_file
run_this_file(i) click to toggle source
#

run_this_file

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 73
def run_this_file(i)
  if i.is_a? Array
    # ===================================================================== #
    # First, prevent self-validation .rb file.
    # ===================================================================== #
    i.reject! {|entry| entry.include? 'batch_validate_the_cookbook_recipes.rb' }
    i.each {|entry| run_this_file(entry) }
  else
    # ===================================================================== #
    # We must determine the name of the class. The usual input is
    # something like:
    #
    #   /Programs/Ruby/2.4.2/lib/ruby/site_ruby/2.4.0/cookbooks/validation/scan_for_missing_last_update_entries.rb
    #
    # ===================================================================== #
    load(i)
    _ = File.basename(i).delete_suffix('.rb').dup
    _ = to_camelcase(_)
    namespace = "RBT::Cookbooks::#{_}"
    opne "Now invoking #{slateblue('class '+namespace)}"
    constant = RBT::Cookbooks.const_get(_)
    constant.send(:new) # Instantiate it here.
  end
end
Also aliased as: run_these_files
set_input(i = '') click to toggle source
#

set_input

#
# File lib/rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb, line 57
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  @input = i
end