class RBT::Cookbooks::CheckForMateDesktopUpdates

Constants

REMOTE_DOWNLOAD_URL
#

REMOTE_DOWNLOAD_URL

#
REMOTE_URL
#

RBT::Cookbooks::CheckForMateDesktopUpdates::REMOTE_URL

#

Public Class Methods

[](i = ARGV) click to toggle source
#

RBT::Cookbooks::CheckForMateDesktopUpdates[]

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 157
def self.[](i = ARGV)
  new(i)
end
new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 39
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_commandline(i)
  run if run_already
end

Public Instance Methods

decide_what_to_do_next() click to toggle source
#

decide_what_to_do_next

The first variant can be invoked via:

update_mate_components --size
#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 135
def decide_what_to_do_next
  if commandline_size_query_was_issued?
    opne "There are #{sfancy(@scanned_results.size)} remote "\
         "mate-desktop related 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/check_for_mate_desktop_updates.rb, line 75
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
  n_programs_to_show = 12
  opne 'We will show at maximum '+sfancy(n_programs_to_show.to_s)+
       ' programs related to mate-desktop.'
  _ = _[0, n_programs_to_show]
  _.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 < 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 Cookbooks::UpdateEntry.new(#{full_remote_url})"
      )
      opne "Now delegating towards #{colourized_result}."
      update_entry(full_remote_url)
    end
  }
  if @downloaded_n_programs == 0
    notify_the_user_that_no_downloads_have_occurred
  end
end
main_url?() click to toggle source
#

main_url?

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 59
def main_url?
  REMOTE_URL
end
remote_download_url?() click to toggle source
#

remote_download_url?

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 68
def remote_download_url?
  REMOTE_DOWNLOAD_URL
end
remote_url?()
Alias for: main_url?
remote_webpage?()
Alias for: main_url?
remote_website?()
Alias for: main_url?
reset() click to toggle source
#

reset (reset tag)

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 51
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 147
def run
  report_the_remote_webpage
  obtain_remote_dataset
  scan_for_all_results
  decide_what_to_do_next
end
scan_for_all_results() click to toggle source
#

scan_for_all_results

#
# File lib/rbt/check_for_updates/check_for_mate_desktop_updates.rb, line 117
def scan_for_all_results
  # ======================================================================= #
  # See this entry for the following regex:
  #   http://rubular.com/r/bkXyapmXZb
  # ======================================================================= #
  use_this_regex =
    /<a href="(.+.tar.xz)">/
  @scanned_results = @dataset.scan(use_this_regex).flatten.map {|entry|
    entry.sub(/\.tar\.xz$/,'')
  }
end