class RBT::Cookbooks::ValidateArchiveSize

Public Class Methods

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

RBT::Cookbooks::ValidateArchiveSize[]

#
# File lib/rbt/checks_and_validations/validate_archive_size.rb, line 116
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/checks_and_validations/validate_archive_size.rb, line 29
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
notify_the_user_if_any_problematic_archive_was_discovered() click to toggle source
#

notify_the_user_if_any_problematic_archive_was_discovered

#
# File lib/rbt/checks_and_validations/validate_archive_size.rb, line 83
def notify_the_user_if_any_problematic_archive_was_discovered
  if @n_problematic_archives_were_found > 0
    e
    e 'A total of '+steelblue(@n_problematic_archives_were_found.to_s)+
      ' programs was found.'
    e
  end
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/checks_and_validations/validate_archive_size.rb, line 43
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @n_problematic_archives_were_found
  # ======================================================================= #
  @n_problematic_archives_were_found = 0
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/checks_and_validations/validate_archive_size.rb, line 95
def run
  menu(commandline_arguments?)
  target = "#{directory_expanded_cookbooks?}*.yml"
  opnn { :no_colon }; e; e
  Dir[target].each {|this_yaml_file|
    dataset = File.read(this_yaml_file)
    archive_size_is = dataset.scan(
      /archive_size: (\d{1,15})/
    ).flatten.first.to_i
    if archive_size_is == 0
      @n_problematic_archives_were_found += 1
      e 'The archive at '+sfile(this_yaml_file)+
        ' is problematic: size of 0.'
    end
  }
  notify_the_user_if_any_problematic_archive_was_discovered
end
show_help() click to toggle source
#

show_help

#
# File lib/rbt/checks_and_validations/validate_archive_size.rb, line 76
def show_help
  e 'Currently no help options are documented.'
end