class RBT::CleanupSystemTags
Constants
- BASE_DIR
#¶ ↑
BASE_DIR
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/cleanup_system_tags.rb, line 31 def initialize( commandline_arguments = nil, run_already = true ) reset set_commandline_arguments( commandline_arguments ) if block_given? yielded = yield case yielded # ===================================================================== # # === :be_silent # ===================================================================== # when :be_silent, :be_quiet set_be_quiet end end run if run_already end
Public Instance Methods
consider_puring_and_reporting_non_existing_symlinks_from_the_system( be_verbose = be_verbose? )
click to toggle source
#¶ ↑
consider_puring_and_reporting_non_existing_symlinks_from_the_system
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/cleanup_system_tags.rb, line 95 def consider_puring_and_reporting_non_existing_symlinks_from_the_system( be_verbose = be_verbose? ) if @all_entries.empty? if be_verbose opne "#{rev}No #{royalblue('stray symlinks')} could be found. "\ "This is good! #{gold('\\o/')}" end else if be_verbose opne "#{rev}The following #{steelblue('stray')}"\ "#{rev} (non-existing) symlinks will "\ "be removed next:" end @all_entries.each {|this_non_existing_symlink| # =================================================================== # # The next line of code has to be explained. We will here # ALWAYS report when a stray symlink has been found. This # allows us to embed this class into RBT::Compile, and # notify the user when a stray symlink file is deleted. # =================================================================== # if File.symlink?(this_non_existing_symlink) # ← This check is not necessary but I like it. opne "#{rev}Now removing the symlink "\ "`#{sfancy(this_non_existing_symlink)}#{rev}`." remove_this_symlink(this_non_existing_symlink) end } end end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/cleanup_system_tags.rb, line 56 def reset super() infer_the_namespace # ======================================================================= # # === @all_entries # ======================================================================= # @all_entries = [] # ← Must be empty on startup. end
run()
click to toggle source
select_non_existing_symlinks_from_the_entries()
click to toggle source
#¶ ↑
select_non_existing_symlinks_from_the_entries
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/cleanup_system_tags.rb, line 68 def select_non_existing_symlinks_from_the_entries # ======================================================================= # # We must check for symlinks that exist, which we will do in the # following code: # ======================================================================= # @all_entries.select! {|entry| File.symlink?(entry) and !File.exist?(entry) } end