class RBT::Cookbooks::CheckForCorrectDependencies

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

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

RBT::Cookbooks::CheckForCorrectDependencies[]

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

initialize

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 34
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

check_for_every_entry() click to toggle source
#

check_for_every_entry

This method will check for every available (registered) program.

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 85
def check_for_every_entry
  opnn; e 'Now checking every program. This may take a while.'
  available_programs?.each {|program|
    # ===================================================================== #
    # The next line is very verbose, so it may be best to enable it only
    # for debugging purposes really.
    # ===================================================================== #
    # opnn; e '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['required_deps_on']
    else
      dataset = RBT::Cookbooks::Cookbook.new(program) { :bypass_menu }
      deps    = dataset.deps?
    end
    result  = deps.all? {|entry| RBT.really_does_include?(entry) }
    if result # Ok, in this case all entries were found.
    else # else it was not found, so work on that.
      deps.each {|entry|
        if entry.include? ' '
          entry = entry.split(' ').first.strip
        end
        unless RBT.really_does_include? entry
          opnn; e "#{format_program(program)}No "\
                  "entry for `#{simp(entry)}` was found."
        end
      }
    end
  }
end
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 64
def commandline_arguments?
  @commandline_arguments
end
Also aliased as: input?
format_program(i) click to toggle source
#

format_program

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 71
def format_program(i)
  _ = "#{i}:"
  _ = _.ljust(22)
  splitted = _.split(':')
  splitted[0] = sfancy(splitted.first)
  _ = splitted.join(':')
  _
end
input?()
menu( i = @commandline_arguments ) click to toggle source
#

menu (menu tag)

#
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 48
def reset
  super()
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 157
def run
  unless commandline_arguments?.empty?
    menu
  else # else check for every entry
    check_for_every_entry
  end
end
set_commandline_arguments(i = nil) click to toggle source
#

set_commandline_arguments

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 56
def set_commandline_arguments(i = nil)
  i = [i].flatten.compact
  @commandline_arguments = i
end
show_help() click to toggle source
#

show_help

#
# File lib/rbt/validation/check_for_correct_dependencies.rb, line 129
def show_help
  e 'Currently this class has no special commandline flags.'
end