class RBT::SymlinkAllUpcasedProgramsToDowncasedVariants
Constants
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
Public Class Methods
[](i = '')
click to toggle source
Public Instance Methods
check_these_entries_for_upcased_program_names(i)
click to toggle source
#¶ ↑
check_these_entries_for_upcased_program_names
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/symlink_all_upcased_programs_to_downcased_variants.rb, line 77 def check_these_entries_for_upcased_program_names(i) if i.empty? do_notify_the_user_that_no_program_was_symlinked else i.each {|entry| dirname = File.basename(entry) dirname[0,1] = dirname[0,1].upcase downcased_variant = dirname.downcase downcased_variant[0,1] = downcased_variant[0,1].upcase if dirname == downcased_variant # Then all is fine. else @n_programs_were_modified += 1 opnn; e 'Found an upcased program name: '+sfancy(entry) properly_downcase_this_program(entry) end } end if @n_programs_were_modified and !i.empty? do_notify_the_user_that_no_program_was_symlinked end end
do_notify_the_user_that_no_program_was_symlinked()
click to toggle source
#¶ ↑
do_notify_the_user_that_no_program_was_symlinked
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/symlink_all_upcased_programs_to_downcased_variants.rb, line 118 def do_notify_the_user_that_no_program_was_symlinked opnn; e 'No program was symlinked. This either means that you have had' opnn; e "no entry under #{sfancy(programs_dir?)}, that you have "\ "had no program that could" opnn; e 'be symlinked to its non-upcased variant, or that all programs '\ 'that' opnn; e 'had an upcased variant were already symlinked.' end
input?()
click to toggle source
properly_downcase_this_program(real_existing_name)
click to toggle source
#¶ ↑
properly_downcase_this_program
¶ ↑
This is the action that will do the correct symlink-operation.
#¶ ↑
# File lib/rbt/utility_scripts/symlink_all_upcased_programs_to_downcased_variants.rb, line 104 def properly_downcase_this_program(real_existing_name) dirname = File.dirname(real_existing_name) basename = File.basename(real_existing_name).downcase basename[0,1] = basename[0,1].upcase new_name = File.join(dirname, basename) new_name.delete!('-') if new_name.include? '-' opnn; e "Symlinking `#{sfancy(real_existing_name)}"\ "` towards `#{sfancy(new_name)}`." symlink(real_existing_name, new_name) { :be_quiet } end
reset()
click to toggle source
run()
click to toggle source