class Cookbooks::UpdateKdeApplications

Constants

NAMESPACE
#

NAMESPACE

#
REMOTE_DOWNLOAD_URL
#

REMOTE_DOWNLOAD_URL

#

Public Class Methods

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

[]

#
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 121
def self.[](i = '')
  self.new(i)
end
new( i = nil, run_already = true ) click to toggle source
#

initialize

#
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 32
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:

KDE_Applications --size
#
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 131
def decide_what_to_do_next
  if commandline_size_query_was_issued?
    opnn; e "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/cookbooks/check_for_updates/update_kde_applications.rb, line 67
def iterate_through_the_results_and_update_old_cookbooks_entries
  unless Cookbooks.const_defined? :Cookbook
    require 'cookbooks/class/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 = ::Cookbooks::Cookbook.new(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
      opnn; e "There is a more recent program version "\
              "available for `#{sfancy(name_of_the_program)}`."
      full_remote_url = "#{remote_download_url?}#{this_program}.tar.xz"
      opnn; e 'That remote URL should be at: '+
               sfancy(full_remote_url)
      colourized_result = slateblue(
        "class Cookbooks::UpdateEntry.new(#{full_remote_url})"
      )
      opnn; e "Now delegating towards #{colourized_result}."
      Cookbooks::UpdateEntry.new(full_remote_url) { :do_not_ftp_upload }
    end
  }
  if @downloaded_n_programs == 0
    opnn; e 'No downloads occurred. This usually means that all '\
            'local programs are up to date!'
  end
end
main_url?() click to toggle source
#

main_url?

#
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 51
def main_url?
  REMOTE_URL_FOR_KDE_APPLICATIONS
end
opnn() click to toggle source
#

opnn

#
Calls superclass method Cookbooks::Base#opnn
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 105
def opnn
  super(NAMESPACE)
end
remote_download_url?() click to toggle source
#

remote_download_url?

#
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 60
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)

#
Calls superclass method Cookbooks::CheckForRemoteWebpages#reset
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 44
def reset
  super()
end
run() click to toggle source
#

run (run tag)

#
# File lib/cookbooks/check_for_updates/update_kde_applications.rb, line 143
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/cookbooks/check_for_updates/update_kde_applications.rb, line 112
def scan_for_all_results
  use_this_regex =
    /<tr><td valign="top">&nbsp;<\/td><td><a href=".+.tar.xz">(.+).tar.xz<\/a>/
  @scanned_results = @dataset.scan(use_this_regex).flatten
end