class RBT::Cookbooks::UpdateKdeApplications
Constants
- REMOTE_DOWNLOAD_URL
#¶ ↑
REMOTE_DOWNLOAD_URL
¶ ↑#¶ ↑
Public Class Methods
[](i = ARGV)
click to toggle source
Public Instance Methods
decide_what_to_do_next()
click to toggle source
#¶ ↑
decide_what_to_do_next
¶ ↑
The first variant can be invoked via:
KDE_Applications --size
#¶ ↑
# File lib/rbt/check_for_updates/update_kde_applications.rb, line 130 def decide_what_to_do_next if commandline_size_query_was_issued? opne "There are #{sfancy(@scanned_results.size)} remote "\ "KDE Applications programs." else # else, enter the default "modus operandi". iterate_through_the_results_and_update_old_cookbooks_entries end end
iterate_through_the_results_and_update_old_cookbooks_entries()
click to toggle source
#¶ ↑
iterate_through_the_results_and_update_old_cookbooks_entries
¶ ↑
#¶ ↑
# File lib/rbt/check_for_updates/update_kde_applications.rb, line 71 def iterate_through_the_results_and_update_old_cookbooks_entries unless RBT::Cookbooks.const_defined? :SanitizeCookbook require 'rbt/requires/require_the_cookbook_class.rb' end @scanned_results.each {|this_program| # ← That variable is e. g. 'plasma-vault-5.11.0' name_of_the_program, program_version = ::ProgramInformation.return_array_program_name_and_program_version(this_program) # ===================================================================== # # Next, we must compare it to the local dataset. # ===================================================================== # local_dataset = new_cookbook_instance_for(name_of_the_program) local_program_version = local_dataset.program_version? if local_program_version.nil? e tomato('Warning: no local program version was found for ')+ steelblue(this_program) e 'Is this program registered?' end if local_program_version < program_version # =================================================================== # # In this case, we have to updated. # =================================================================== # @downloaded_n_programs += 1 opne "There is a more recent program version "\ "available for `#{sfancy(name_of_the_program)}`." full_remote_url = "#{remote_download_url?}#{this_program}.tar.xz" opne 'That remote URL should be at: '+ sfancy(full_remote_url) colourized_result = slateblue( "class RBT::UpdateEntry.new(#{full_remote_url})" ) opne "Now delegating towards #{colourized_result}." update_entry(full_remote_url) # =================================================================== # # Keep track of which programs were updated: # =================================================================== # add_these_programs_were_updated( remove_archive_from_the_end( File.basename(full_remote_url) ) ) end } if @downloaded_n_programs == 0 notify_the_user_that_no_downloads_have_occurred else report_that_these_programs_were_updated( array_these_programs_were_updated? ) end end
main_url?()
click to toggle source
remote_download_url?()
click to toggle source
reset()
click to toggle source
run()
click to toggle source
scan_for_all_results()
click to toggle source
#¶ ↑
scan_for_all_results
¶ ↑
Note that for this method to work, the regex must be correct.
In November 2020, the old regex suddenly no longer worked, so a link was put up towards rubular.com, in order to determine how a regex has to be tweaked. We could also use the constant called KDE_REGEX_FOR_REMOTE_ARCHIVES, though - but for the time being we’ll use the one hardcoded here.
#¶ ↑
# File lib/rbt/check_for_updates/update_kde_applications.rb, line 150 def scan_for_all_results use_this_regex = # /<tr><td valign="top"> <\/td><td><a href=".+.tar.xz">(.+).tar.xz<\/a>/ # <- This one until November 2020. /<tr><td valign="top"><a href="([0-9a-zA-Z\-.]+).tar.xz"><img src=/ # See: https://rubular.com/r/aE07UuDWTTPUNv @scanned_results = @dataset.scan(use_this_regex).flatten end