class RBT::Cookbooks::CheckForSlackwareUpdates

Constants

NAMESPACE
#

NAMESPACE

#
USE_THIS_REGEX_FOR_SLACKWARE
#

USE_THIS_REGEX_FOR_SLACKWARE

See this link: rubular.com/r/XejliI9eeg

#
USE_THIS_SLACKWARE_SEPARATOR
#

USE_THIS_SLACKWARE_SEPARATOR

#

Public Class Methods

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

RBT::Cookbooks::CheckForSlackwareUpdates[]

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

initialize

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 43
def initialize(
    i           = nil,
    run_already = true
  )
  reset
  set_input(
    i
  )
  run if run_already
end

Public Instance Methods

input?() click to toggle source
#

input?

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 81
def input?
  @input
end
iterate_over_the_results() click to toggle source
#

iterate_over_the_results

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 122
def iterate_over_the_results
  n_ljust = 45
  # ======================================================================= #
  # Make use of ProgramInformation next.
  # ======================================================================= #
  @scanned_results.each {|this_result|
    _ = ProgramInformation.new(this_result)
    real_short_name = _.real_short_name?
    short_name      = _.short_name?
    remote_version  = _.program_version?
    if does_the_cookbook_include_this_program? real_short_name
      string = 'The local version of '.dup
      string << short_name.dup
      string << ' is: '
      string = string.ljust(n_ljust)
      string.sub!(/(#{short_name.dup})/, sfancy('\\1'))
      opnn; e string+
              simp(return_local_version_of_this_program(short_name))
      opnn; e 'The remote version is: '.ljust(n_ljust)+
              orange(remote_version)
    else
      opnn; e 'Not found a local program called `'+sfancy(this_result)+'`.'
    end
  }
end
limit_dataset_to_last_separator() click to toggle source
#

limit_dataset_to_last_separator

This will limit the dataset to the last separator.

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 115
def limit_dataset_to_last_separator
  @dataset = @dataset[0..(@dataset.index(USE_THIS_SLACKWARE_SEPARATOR)-1)]
end
main_regex?() click to toggle source
#

main_regex?

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 88
def main_regex?
  USE_THIS_REGEX_FOR_SLACKWARE
end
remote_webpage?() click to toggle source
#

remote_webpage?

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 65
def remote_webpage?
  REMOTE_SLACKWARE_HOMEPAGE
end
Also aliased as: remote_website?
remote_website?()
Alias for: remote_webpage?
reset() click to toggle source
#

reset (reset tag)

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 57
def reset
  super()
  @namespace = NAMESPACE
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 151
def run
  report_the_remote_webpage
  obtain_dataset_from_the_remote_webpage
  limit_dataset_to_last_separator
  scan_dataset_for_matches_against_the_regex
  iterate_over_the_results
end
scan_dataset_for_matches_against_the_regex() click to toggle source
#

scan_dataset_for_matches_against_the_regex

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 95
def scan_dataset_for_matches_against_the_regex
  @scanned_results = @dataset.scan(main_regex?).flatten
  # ======================================================================= #
  # Next, sanitize these results. We will chop off trailing
  # '-x86_64-1' tokens. 'Keep in mind that we may also have entries
  # such as 'kernel-headers-4.9.49-x86-1'.
  # ======================================================================= #
  @scanned_results.map! {|entry|
    entry.sub!(/-x86_64-1$/,'')
    entry.sub!(/-x86-1$/,'')
    entry.sub!(/-noarch-1$/,'')
    entry
  }
end
set_input(i = '') click to toggle source
#

set_input

#
# File lib/rbt/check_for_updates/check_for_slackware_updates.rb, line 72
def set_input(i = '')
  i = i.first if i.is_a? Array
  i = i.to_s.dup
  @input = i
end