class RBT::Chainer

Public Class Methods

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

RBT::Chainer[]

#
# File lib/rbt/utility_scripts/chainer.rb, line 105
def self.[](i = ARGV)
  new(i)
end
new( i = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/chainer.rb, line 36
def initialize(
    i           = ARGV,
    run_already = true
  )
  reset
  set_commandline_arguments(i)
  run if run_already
end

Public Instance Methods

dataset?() click to toggle source
#

@dataset

#
# File lib/rbt/utility_scripts/chainer.rb, line 68
def dataset?
  @dataset
end
is_this_program_included?(i = first_argument?) click to toggle source
#

is_this_program_included?

#
# File lib/rbt/utility_scripts/chainer.rb, line 60
def is_this_program_included?(i = first_argument?)
  i = i.flatten if i.is_a? Array
  @dataset.values.flatten.include? i
end
notify_the_user_that_the_program_is_not_included(i) click to toggle source
#

notify_the_user_that_the_program_is_not_included

#
# File lib/rbt/utility_scripts/chainer.rb, line 97
def notify_the_user_that_the_program_is_not_included(i)
  opne "The program #{steelblue(i)} is "\
       "#{crimson('NOT')} included."
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/chainer.rb, line 48
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @dataset
  # ======================================================================= #
  @dataset = YAML.load_file(RBT.file_cookbook_chained_programs)
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/chainer.rb, line 75
def run 
  _ = first_argument?.to_s.downcase.delete('-')
  if is_this_program_included? _ 
    require 'rbt/requires/require_the_installer_class.rb'
    # ===================================================================== #
    # In this case we must select the proper key.
    # ===================================================================== #
    proper_hash = dataset?.select {|key, inner_array|
      key if inner_array.include? _
    }
    selected_programs = proper_hash.values.flatten
    selected_programs.each {|this_program|
      RBT::Installer.new(this_program)
    }
  else
    notify_the_user_that_the_program_is_not_included(_)
  end
end