class RBT::Uninstall

Public Class Methods

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

RBT::Uninstall[]

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

initialize

#
# File lib/rbt/utility_scripts/uninstall.rb, line 28
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  reset
  set_commandline_arguments(commandline_arguments)
  run if run_already
end

Public Instance Methods

reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/uninstall.rb, line 40
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run

#
# File lib/rbt/utility_scripts/uninstall.rb, line 59
  def run
    _ = first_argument?
    if _
      # ===================================================================== #
      # Handle directories here, if we are in the programs_dir? hierarchy.
      # ===================================================================== #
      if File.directory?(_) and
         File.absolute_path(_).include?(programs_dir?) and
         !(return_pwd == '/')
        e "#{rev}Uninstalling the program stored at #{sdir(_)} #{rev}next."
        uninstall_this_directory(_)
      elsif File.file?(_)
        # So it is a file. Let's see whether it is registered.
        dataset_from_libraries = YAML.load_file(yaml_dir?+'registered/libraries.yml')
        if dataset_from_libraries.has_key? _
          points_towards = dataset_from_libraries[_]
          e "#{rev}This is a registered library. It points towards "+
            steelblue(points_towards)+'.'
          e 'It will be uninstalled next.'
          e rev+'All libraries that belong to '+steelblue(points_towards)+
            rev+' will be collected next.'
          selection = dataset_from_libraries.select {|key, value|
            value == points_towards
          }
          pp selection
e 'TODO: CONTINUE HERE'
        end
      end
    else
      e "#{rev}Please supply the program that you wish to uninstall."
    end
  end
uninstall_this_directory(i) click to toggle source
#

uninstall_this_directory

#
# File lib/rbt/utility_scripts/uninstall.rb, line 48
def uninstall_this_directory(i)
  i = rds(i).dup
  unless i == '/'
    e "#{rev}Removing the directory #{sdir(i)} #{rev}next."
    remove_directory(i)
  end
end