class RBT::SymlinkIntoUsrLibDirectory
Public Class Methods
[](i = ARGV)
click to toggle source
new( symlink_these_files = nil, run_already = true )
click to toggle source
Public Instance Methods
do_symlink_the_following_files(i = @symlink_these_files)
click to toggle source
#¶ ↑
do_symlink_the_following_files
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/symlink_into_usr_lib_directory.rb, line 77 def do_symlink_the_following_files(i = @symlink_these_files) i.each {|this_file| # ===================================================================== # # The variable this_file may contain a file such as # /Programs/Ruby/Current/lib/libruby.so.2.5.3. # ===================================================================== # target = "/usr/lib/#{File.basename(this_file)}" opne 'Next symlinking the file `'+sfile(this_file)+ '` into `'+sfile(target)+'`.' if File.directory? this_file if File.directory? target # ================================================================= # # In this case the target directory already exists. # ================================================================= # Dir["#{this_file}/*"].each {|target_in_that_directory| inner_target = target+'/'+File.basename(target_in_that_directory) opne 'Symlinking '+sfile(target_in_that_directory)+ ' into `'+sfancy(inner_target)+'` next.' symlink( target_in_that_directory, inner_target ) } return end target = this_file end symlink(this_file, target) } end
reset()
click to toggle source
run()
click to toggle source
set_symlink_these_files(i = '')
click to toggle source
#¶ ↑
set_symlink_these_files
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/symlink_into_usr_lib_directory.rb, line 53 def set_symlink_these_files(i = '') if i i = [i].flatten.compact.map {|entry| if File.directory? entry target = ("#{entry}/*").squeeze '/' entry = Dir[target] # ← Obtain the files from that directory. end entry } i.flatten! end @symlink_these_files = i end