class Cookbooks::BatchValidateTheCookbookRecipes

Public Class Methods

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

[]

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

initialize

#
# File lib/cookbooks/validation/batch_validate_the_cookbook_recipes.rb, line 25
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(i)
  run if run_already
end

Public Instance Methods

determine_which_files_to_run() click to toggle source
#

#determine_which_files_to_run

#
# File lib/cookbooks/validation/batch_validate_the_cookbook_recipes.rb, line 93
def determine_which_files_to_run
  @array_run_these_files << Dir["#{Cookbooks::DIRECTORY_VALIDATION}*.rb"]
  @array_run_these_files.flatten!
end
input?() click to toggle source
#

input?

#
# File lib/cookbooks/validation/batch_validate_the_cookbook_recipes.rb, line 54
def input?
  @input
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method Cookbooks::Base#reset
# File lib/cookbooks/validation/batch_validate_the_cookbook_recipes.rb, line 37
def reset
  super()
  @array_run_these_files = []
end
run() click to toggle source
#

run (run tag)

#
# File lib/cookbooks/validation/batch_validate_the_cookbook_recipes.rb, line 83
def run
  determine_which_files_to_run
  @array_run_these_files.each {|this_file|
    run_this_file(this_file)
  }
end
run_this_file(i) click to toggle source
#

#run_this_file

#
# File lib/cookbooks/validation/batch_validate_the_cookbook_recipes.rb, line 61
def run_this_file(i)
  if i.is_a? Array
    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).sub(/\.rb$/,'').dup
    _ = to_camelcase(_)
    namespace = 'Cookbooks::'+_
    opnn; e "Now invoking #{slateblue('class '+namespace)}"
    constant = Cookbooks.const_get(_)
    constant.send(:new)
  end
end
set_input(i = '') click to toggle source
#

#set_input

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