class RBT::FetchAllM4Macros
Constants
- DEFAULT_LOCATION
#¶ ↑
DEFAULT_LOCATION
¶ ↑#¶ ↑
- DEFAULT_USR_SHARE_ACLOCAL_DIRECTORY
#¶ ↑
DEFAULT_USR_SHARE_ACLOCAL_DIRECTORY
¶ ↑#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑#¶ ↑
Public Class Methods
new( i = DEFAULT_LOCATION, run_already = true ) { || ... }
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/fetch_all_m4_macros.rb, line 48 def initialize( i = DEFAULT_LOCATION, run_already = true ) reset set_target(i) if block_given? yielded = yield case yielded when :do_not_report_anything_if_there_were_no_matches @report_no_matches = false end end case run_already when :dont_run_yet run_already = false end run if run_already end
Public Instance Methods
all_macros()
click to toggle source
#¶ ↑
all_macros
¶ ↑
This will return a list of all .m4 macros found.
#¶ ↑
# File lib/rbt/utility_scripts/fetch_all_m4_macros.rb, line 137 def all_macros @all_m4_files end
Also aliased as: m4_files?
reset()
click to toggle source
run()
click to toggle source
run_everything()
click to toggle source
#¶ ↑
run_everything
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/fetch_all_m4_macros.rb, line 171 def run_everything _ = rds("#{@aclocal_target}*") matches = Dir[_] if matches.empty? and @report_no_matches opnn; e 'We found no matches from '+sfancy(_) else # Only if we found a match, will we continue here. # ===================================================================== # # longest_match = matches.max # Assume the longest match is good. # But why did we want to symlink only the longest match? I have # no idea. # ===================================================================== # set_all_m4_files(matches) symlink_all_m4_files_into_usr_share_aclocal end end
set_aclocal_target(i = '')
click to toggle source
#¶ ↑
set_aclocal_target
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/fetch_all_m4_macros.rb, line 102 def set_aclocal_target(i = '') if i.is_a? String i = i.to_s.dup # Work on a copy. end # ======================================================================= # # We must ensure that we end with 'share/aclocal'. This is, however # had, not always wanted. Sometimes the user has given a real # directory that has .m4 files. So we must do a check prior to # that. # ======================================================================= # unless i.end_with? 'share/aclocal/' if Dir[rds("#{i}/*.m4")].empty? i << 'share/aclocal/' end end i << '/' unless i.end_with? '/' # ======================================================================= # # Next, delete all '-' that are part of the input, but only in some # cases, not all of them. # # For example, input such as # "/Programs/Xfce/4.12/share/xfce4/dev-tools/m4macros/" # must remain valid input. # ======================================================================= # if i.include?('-') and i.include?(programs_directory?) i.delete!('-') unless i.count('/') > 3 end @aclocal_target = i end
set_all_m4_files(i)
click to toggle source
set_target( i = DEFAULT_LOCATION )
click to toggle source
#¶ ↑
set_target
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/fetch_all_m4_macros.rb, line 81 def set_target( i = DEFAULT_LOCATION ) # as @target must be a directory, append a '/' i = i.first if i.is_a? Array i = Dir.pwd if i.nil? i = i.dup if i.frozen? i << '/' unless i.end_with? '/' @target = i # Will always have a trailing /. set_aclocal_target(@target) end