class RBT::PurgeIncorrectYamlDirectoriesInTheProgramsHierarchy
Public Class Methods
[](i = ARGV)
click to toggle source
new( commandline_arguments = nil, run_already = true )
click to toggle source
Public Instance Methods
purge_these_directories( i = @array_purge_these_directories )
click to toggle source
#¶ ↑
purge_these_directories
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/purge_incorrect_yaml_directories_in_the_programs_hierarchy.rb, line 93 def purge_these_directories( i = @array_purge_these_directories ) if i.empty? opne 'Everything is fine - no faulty yaml/ '\ 'directory could be found.' else opne "Found #{steelblue(i.size.to_s)} faulty directories." opne 'These will be removed next.' # ===================================================================== # # Iterate over the target directories next. # ===================================================================== # i.each {|this_directory_has_to_go| if File.directory?(this_directory_has_to_go) and this_directory_has_to_go.delete('/').end_with?('yaml') opne steelblue('Next removing the directory `')+ sdir(this_directory_has_to_go)+ steelblue('`.') remove_directory(this_directory_has_to_go) end } end end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/purge_incorrect_yaml_directories_in_the_programs_hierarchy.rb, line 45 def reset super() infer_the_namespace # ======================================================================= # # === @array_purge_these_directories # ======================================================================= # @array_purge_these_directories = [] # ======================================================================= # # === @use_this_as_the_prefix # # The following variable can be used to refer to the main # programs-directory which is used to denote where this class # will operate. By default it will be the programs-directory # at /home/Programs/, or wherever else the user keeps his/her # programs directory at. The variable can be overruled # if need be. # ======================================================================= # @use_this_as_the_prefix = programs_dir? end
run()
click to toggle source
#¶ ↑
run (run tag)¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/purge_incorrect_yaml_directories_in_the_programs_hierarchy.rb, line 120 def run menu # ======================================================================= # # Grab all relevant entries first. An incorrect entry may look like # this: # # "/home/Programs/Gegl/yaml/" # # ======================================================================= # programs_dir = @use_this_as_the_prefix @array_purge_these_directories = Dir["#{programs_dir}**/yaml/"].select {|entry| entry.sub(/^#{programs_dir}/, '').count('/') == 2 } if @array_purge_these_directories.empty? opne 'No incorrect yaml-directory was found. '+ steelblue('\\o/') else purge_these_directories end end
set_use_this_as_the_prefix(i)
click to toggle source
#¶ ↑
set_use_this_as_the_prefix
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/purge_incorrect_yaml_directories_in_the_programs_hierarchy.rb, line 68 def set_use_this_as_the_prefix(i) i = i.first if i.is_a? Array i = i.dup if i.frozen? i << '/' unless i.end_with? '/' @use_this_as_the_prefix = i end
Also aliased as: set_use_this_as_main_directory