class RBT::SymlinkAllUpcasedProgramsToDowncasedVariants
Public Class Methods
[](i = ARGV)
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 68 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 opne "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 109 def do_notify_the_user_that_no_program_was_symlinked opne 'No program was symlinked. This either means that you have had' opne "no entry under #{sfancy(programs_dir?)}, that you have "\ "had no program that could" opne 'be symlinked to its non-upcased variant, or that all '\ 'programs that' opne '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 95 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? '-' opne "Symlinking `#{sfancy(real_existing_name)}"\ "` towards `#{sfancy(new_name)}`." symlink(real_existing_name, new_name) { :be_quiet } end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/symlink_all_upcased_programs_to_downcased_variants.rb, line 40 def reset super() infer_the_namespace # ======================================================================= # # === @n_programs_were_modified # ======================================================================= # @n_programs_were_modified = 0 end
run()
click to toggle source