class Cookbooks::CheckForCorrectDependencies

Constants

NAMESPACE
#

NAMESPACE

#

Public Class Methods

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

Cookbooks::CheckForCorrectDependencies[]

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

initialize

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

Public Instance Methods

check_for_every_entry() click to toggle source
#

#check_for_every_entry

#
# File lib/cookbooks/validation/check_for_correct_dependencies.rb, line 98
def check_for_every_entry
  opnn; e 'Now checking every program. This may take a while.'
  Cookbooks.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.'
    dataset = ::Cookbooks::Cookbook.new(program) { :bypass_menu }
    deps    = dataset.deps?
    result  = deps.all? {|entry| Cookbooks.really_does_include?(entry) }
    if result # Ok, in this case all entries were found.
    else
      deps.each {|entry|
        if entry.include? ' '
          entry = entry.split(' ').first.strip
        end
        unless Cookbooks.really_does_include? entry
          opnn; e "#{format_program(program)}No "\
                  "entry for `#{simp(entry)}` was found."
        end
      }
    end
  }
end
format_program(i) click to toggle source
#

#format_program

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

input?

#
# File lib/cookbooks/validation/check_for_correct_dependencies.rb, line 62
def input?
  @input
end
opnn() click to toggle source
#

opnn

#
Calls superclass method Cookbooks::Base#opnn
# File lib/cookbooks/validation/check_for_correct_dependencies.rb, line 81
def opnn
  super(NAMESPACE)
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method Cookbooks::Base#reset
# File lib/cookbooks/validation/check_for_correct_dependencies.rb, line 46
def reset
  super()
end
run() click to toggle source
#

run (run tag)

#
# File lib/cookbooks/validation/check_for_correct_dependencies.rb, line 88
def run
  if input?
  else # else check for every entry
    check_for_every_entry
  end
end
set_input(i = nil) click to toggle source
#

#set_input

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