class RBT::Libtool::RemoveLibtoolFiles

Public Class Methods

from(this_directory) click to toggle source
#

RBT::RemoveLibtoolFiles.from

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 168
def self.from(this_directory)
  RBT::Libtool::RemoveLibtoolFiles.new(this_directory)
end
new( from_this_directory = return_pwd, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 29
def initialize(
    from_this_directory = return_pwd,
    run_already         = true
  )
  reset
  set_commandline_arguments(
    from_this_directory
  )
  run if run_already
end

Public Instance Methods

determine_the_main_directory_automatically() click to toggle source
#

determine_the_main_directory_automatically

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 97
def determine_the_main_directory_automatically
  set_use_this_directory(
    first_commandline_argument?
  )
end
determine_which_libtool_files_are_to_be_purged() click to toggle source
#

determine_which_libtool_files_are_to_be_purged

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 126
def determine_which_libtool_files_are_to_be_purged
  @all_libtool_files = Dir["#{use_this_directory?}*.la"]
end
handle_commandline_arguments_with_hyphens() click to toggle source
#

handle_commandline_arguments_with_hyphens

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 55
def handle_commandline_arguments_with_hyphens
  _ = commandline_arguments?
  if _.any? {|entry| entry.start_with? '--' }
    selection = _.select {|entry| entry.start_with? '--' }
    menu(selection)
  end
end
menu(i) click to toggle source
#

menu

#
prefix_to_the_libtool_files?()
Alias for: use_this_directory?
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 43
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @all_libtool_files
  # ======================================================================= #
  @all_libtool_files = [] # ← Initialize them to an empty Array.
end
run() click to toggle source
#

run

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 158
def run
  handle_commandline_arguments_with_hyphens
  determine_the_main_directory_automatically
  determine_which_libtool_files_are_to_be_purged
  try_to_purge_the_libtool_files
end
set_use_this_directory(i) click to toggle source
#

set_use_this_directory

This setter defines which directory we will be using.

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 108
def set_use_this_directory(i)
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  i = return_pwd if i.empty? # <- Use a sane default here.
  i << '/' unless i.end_with? '/'
  @internal_hash[:use_this_directory] = i
end
show_help() click to toggle source
#

show_help (help tag)

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 84
def show_help
  e
  e 'Currently this class has no special option.'
  e
  e 'The first argument to it should be the target directory. All'
  e '.la files residing in that directory will be removed then, so'
  e 'make sure to invoke this class ONLY if you really wish to get'
  e 'rid of all libtool .la files there.'
end
try_to_purge_the_libtool_files() click to toggle source
#

try_to_purge_the_libtool_files

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 133
def try_to_purge_the_libtool_files
  # ======================================================================= #
  # If we have found at the least one .la file, delete it/them.
  # ======================================================================= #
  all_libtool_files = @all_libtool_files
  unless all_libtool_files.empty?
    result = powderblue(all_libtool_files.size.to_s)+' .la file'
    result << 's' if all_libtool_files.size > 1
    if all_libtool_files.size > 1
      result << ' were'
    else
      result << ' was'
    end
    result << " found at `#{sdir(prefix_to_the_libtool_files?)}`."
    opne result
    opne "The configure flag #{royalblue('delete_libtool_files')}"\
         " has been set to true, so"
    opne 'these '+slateblue('.la files')+' will be removed next.'
    remove_these_files(all_libtool_files)
  end
end
use_this_directory?() click to toggle source
#

use_this_directory?

#
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 119
def use_this_directory?
  @internal_hash[:use_this_directory]
end
Also aliased as: prefix_to_the_libtool_files?