class RBT::RemoveAllSymlinks

Constants

NAMESPACE
#

NAMESPACE

#

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 35
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 66
def check_commandline
  case @input
  when 'PWD','Dir.pwd' # This means to work on the current directory.
    @from_here = (Dir.pwd+'/').squeeze '/'
  end
end
from_here?() click to toggle source
#

from_here?

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 116
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 76
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 109
def notify_the_user_what_we_will_do_next
  opnn; e "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 49
def reset
  super()
  @from_here = programs_directory? # We default to /Programs, or whatever other value is stored there.
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/remove_all_symlinks.rb, line 123
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 58
def set_input(i = nil)
  i = i.first if i.is_a? Array
  @input = i
end