class RBT::Cookbooks::ValidateBlfsEntries

Public Class Methods

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

RBT::Cookbooks::ValidateBlfsEntries[]

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

initialize

#
# File lib/rbt/checks_and_validations/validate_blfs_entries.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

do_notify_the_user_that_no_problems_were_encountered() click to toggle source
#

do_notify_the_user_that_no_problems_were_encountered

#
# File lib/rbt/checks_and_validations/validate_blfs_entries.rb, line 141
def do_notify_the_user_that_no_problems_were_encountered
  opne "#{rev}No problems were encountered, thus indicating that all"
  opne "BLFS entries registered in the RBT project are correct. "+
       gold(cheerful_person)
end
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
report_all_programs_that_do_not_have_a_proper_BLFS_entry() click to toggle source
#

report_all_programs_that_do_not_have_a_proper_BLFS_entry (report tag)

#
# File lib/rbt/checks_and_validations/validate_blfs_entries.rb, line 93
def report_all_programs_that_do_not_have_a_proper_BLFS_entry
  all_programs = all_programs?
  opne "#{rev}Going over all "\
       "#{steelblue(all_programs.size.to_s)} "\
       "#{rev}registered programs next, looking"
  opne "#{rev}for incorrect BLFS entries - this may take a while."
  all_programs.each {|this_program|
    @raw_cookbook.find(this_program) 
    dataset = @raw_cookbook.dataset
    if dataset.has_key? 'blfs'
      blfs_entry = dataset['blfs']
      if blfs_entry.is_a? Array
        blfs_entry = blfs_entry.first
      end
      if blfs_entry.nil?
        target = '/home/x/programming/ruby/src/rbt/lib/rbt/yaml/cookbooks/'+this_program+'.yml'
        e "#{rev}Odd BLFS entry (nil) for "+
          sfile(target)+rev
        e 'Proceeding nonetheless now.'
        # exit
      end
      if blfs_entry and blfs_entry.start_with?('https') # Then all is fine.
      else
        @encountered_n_problems += 1
        e tomato(
            'The BLFS entry for '\
            '/home/x/programming/ruby/src/rbt/lib/rbt/yaml/cookbooks/'+this_program+'.yml '\
            'does not start with https.'
          )
        if is_on_roebe?
          Open.in_editor(
            '/home/x/programming/ruby/src/rbt/lib/rbt/yaml/cookbooks/'+this_program+'.yml'
          )
          sleep 1
        end
      end
    else # The next clause may be too verbose.
      # e 'No BLFS entry for `'+steelblue(this_program)+'`.'
    end
  }
  if @encountered_n_problems == 0
    do_notify_the_user_that_no_problems_were_encountered
  end
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/checks_and_validations/validate_blfs_entries.rb, line 43
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @raw_cookbook
  # ======================================================================= #
  @raw_cookbook = action(:raw_cookbook)
  # ======================================================================= #
  # === @encountered_n_problems
  #
  # Keep track how many problems we encountered.
  # ======================================================================= #
  @encountered_n_problems = 0
  try_to_require_the_open_gem
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/checks_and_validations/validate_blfs_entries.rb, line 83
def run
  unless commandline_arguments?.empty?
    menu
  end
  report_all_programs_that_do_not_have_a_proper_BLFS_entry
end