class RBT::Action::Cookbooks::ScanForBlfsPrograms
Constants
- ALSO_GIVE_HELP_FOR_MODIFYING_THESE_ENTRIES
#¶ ↑
ALSO_GIVE_HELP_FOR_MODIFYING_THESE_ENTRIES
¶ ↑#¶ ↑
- ALSO_REMOVE_NUMBERS_FROM_REMOTE_PROGRAM_NAMES
#¶ ↑
ALSO_REMOVE_NUMBERS_FROM_REMOTE_PROGRAM_NAMES
¶ ↑If the following constant is set, then we will remove all numbers from the given input.
#¶ ↑
- OPEN_IN_EDITOR
#¶ ↑
OPEN_IN_EDITOR
¶ ↑#¶ ↑
- REGEX_FOR_PROGRAMS_REGISTERED_AT_THE_REMOTE_BLFS_WEBPAGE
#¶ ↑
REGEX_FOR_PROGRAMS_REGISTERED_AT_THE_REMOTE_BLFS_WEBPAGE
¶ ↑#¶ ↑
- REMOTE_BASE_URL
#¶ ↑
REMOTE_BASE_URL
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
new( i = ARGV, run_already = true, &block )
click to toggle source
#¶ ↑
initialize¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb, line 64 def initialize( i = ARGV, run_already = true, &block ) reset set_commandline_arguments(i) case run_already # ======================================================================= # # === :do_not_run_yet # ======================================================================= # when :do_not_run_yet run_already = false end run if run_already end
Public Instance Methods
iterate_over_all_programs_missing_a_blfs_entry()
click to toggle source
#¶ ↑
iterate_over_all_programs_missing_a_blfs_entry
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb, line 147 def iterate_over_all_programs_missing_a_blfs_entry # ======================================================================= # # First, build up our Array that has the programs registered which # also have a remote BLFS page. # ======================================================================= # array_these_local_programs_do_not_have_a_blfs_entry = [] @programs_missing_a_blfs_entry.each {|this_program| if ALSO_REMOVE_NUMBERS_FROM_REMOTE_PROGRAM_NAMES if this_program =~ /\d+/ this_program = remove_all_numbers_from(this_program) end end if @remotely_available_programs.include? this_program array_these_local_programs_do_not_have_a_blfs_entry << this_program end } if array_these_local_programs_do_not_have_a_blfs_entry.empty? opne 'All remote programs have already been registered '\ 'locally. This is '+gold('good')+"#{rev}! \\o/" else array_these_local_programs_do_not_have_a_blfs_entry.each {|this_program| remote_blfs_page = remote_blfs_page? opne 'The program `'+sfancy(this_program)+rev+ '` is missing a blfs: entry.' remote_html_page = remote_blfs_page+'general/'+this_program+'.html' opne "#{rev}The remote BLFS page is: #{simp(remote_html_page)}" # =================================================================== # # Next, also report where it is available locally. # =================================================================== # if on_roebe? local_path = "#{RUBY_SRC_RBT_COOKBOOKS}#{this_program}.yml" else local_path = return_location_to_this_programs_yaml_file(this_program) end if ALSO_GIVE_HELP_FOR_MODIFYING_THESE_ENTRIES e e "#{rev} bl #{sfile(local_path)}" e " #{simp(remote_html_page)}" if OPEN_IN_EDITOR and is_on_roebe? e e "#{rev}Opening in the editor as well, after a "\ "delay of 0.8 seconds." sleep 0.8 open_in_editor(local_path) end e end } end end
obtain_all_programs_that_miss_a_blfs_entry()
click to toggle source
#¶ ↑
obtain_all_programs_that_miss_a_blfs_entry
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb, line 133 def obtain_all_programs_that_miss_a_blfs_entry @programs_missing_a_blfs_entry = RBT.return_array_of_programs_without_a_blfs_entry end
obtain_dataset_from_the_remote_webpage()
click to toggle source
#¶ ↑
obtain_dataset_from_the_remote_webpage
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb, line 113 def obtain_dataset_from_the_remote_webpage opne "#{rev}Obtaining data from #{steelblue(REMOTE_BASE_URL)}#{rev}." @dataset_from_the_remote_webpage = URI.open(REMOTE_BASE_URL).read # ======================================================================= # # The remote homepage is actually in ISO format. # ======================================================================= # @dataset_from_the_remote_webpage.force_encoding('iso-8859-1') # ======================================================================= # # The next variable will contain all programs that are available # at the BLFS webpage. # ======================================================================= # @remotely_available_programs = @dataset_from_the_remote_webpage.scan( remote_regex? ).flatten end
remote_blfs_page?()
click to toggle source
remote_regex?()
click to toggle source
remove_all_numbers_from(i)
click to toggle source
report_how_many_remote_entries_exist()
click to toggle source
#¶ ↑
report_how_many_remote_entries_exist
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb, line 201 def report_how_many_remote_entries_exist opne "#{rev}The remote BLFS webpage has at the least "+ simp(@remotely_available_programs.size.to_s)+ " #{rev}programs registered." end
reset()
click to toggle source
#¶ ↑
reset (reset tag)¶ ↑
#¶ ↑
Calls superclass method
RBT::Action#reset
# File lib/rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb, line 84 def reset super() infer_the_namespace # ======================================================================= # # === @dataset_from_the_remote_webpage # ======================================================================= # @dataset_from_the_remote_webpage = nil obtain_all_programs_that_miss_a_blfs_entry obtain_dataset_from_the_remote_webpage end