class RBT::RemoveAllSymlinks

Public Class Methods

new( optional_commandline_arguments = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 33
def initialize(
    optional_commandline_arguments = nil,
    run_already                    = true
  )
  reset
  set_input(
    optional_commandline_arguments
  )
  run if run_already
end

Public Instance Methods

check_commandline() click to toggle source
#

check_commandline

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 70
def check_commandline
  case @input
  when 'PWD','Dir.pwd' # This means to work on the current directory.
    @from_here = return_pwd
  end
end
from_here?() click to toggle source
#

from_here?

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 122
def from_here?
  @from_here
end
Also aliased as: from_where?
from_where?()
Alias for: from_here?
get_all_entries( from_where = from_here? ) click to toggle source
#

get_all_entries

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 80
def get_all_entries(
    from_where = from_here?
  )
  _ = from_where
  @entries = Dir["#{_}*"].reject {|entry|
    ! File.directory?(entry)
  }.map {|entry| entry << '/Current' }
end
notify_the_user_what_we_will_do_next() click to toggle source
#

notify_the_user_what_we_will_do_next

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 115
def notify_the_user_what_we_will_do_next
  opne "Now removing all Symlinks from #{sdir(from_where?)}."
end
reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 47
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @from_here
  #
  # We default to /Programs, or whatever other value is stored there.
  # This variable keeps track of that.
  # ======================================================================= #
  @from_here = programs_directory?
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 129
def run
  check_commandline
  notify_the_user_what_we_will_do_next
  get_all_entries
  remove_current_symlinks
  remove_symlinks_in_main_paths
end
set_input(i = nil) click to toggle source
#

set_input

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 62
def set_input(i = nil)
  i = i.first if i.is_a? Array
  @input = i
end