class RBT::Cookbooks::CheckForRemoteWebpages

Public Instance Methods

commandline?()
commandline_arguments?() click to toggle source
#

commandline_arguments?

#
# File lib/rbt/check_for_updates/base.rb, line 65
def commandline_arguments?
  @commandline_arguments
end
Also aliased as: input?, commandline?
commandline_size_query_was_issued?() click to toggle source
#

commandline_size_query_was_issued?

#
# File lib/rbt/check_for_updates/base.rb, line 73
def commandline_size_query_was_issued?
  @commandline_arguments.any? {|entry|
    entry.include? 'size'
  }
end
correct_for_common_mistakes_in_program_names(i) click to toggle source
#

correct_for_common_mistakes_in_program_names

The BLFS folks, but also the slackware folks, use some wrong names.

The following ad-hoc case/when menu will correct some of these wrong names.

The correct name is the one that comes from the official tarball release. So for example, for “gtk+-3.93.0.tar.xz”, the official name is exactly “gtk+” and NOT “gtk+3”, despite the BLFS team thinking otherwise.

#
# File lib/rbt/check_for_updates/base.rb, line 108
def correct_for_common_mistakes_in_program_names(i)
  case i # case tag, sanitize tag
  when 'node.js'
    i = 'node'
  when 'openjpeg2'
    i = 'openjpeg'
  when 'gtk+3'
    i = 'gtk+'
  end
  return i
end
dataset?() click to toggle source
#

dataset?

#
# File lib/rbt/check_for_updates/base.rb, line 147
def dataset?
  @dataset
end
input?()
menu(i) click to toggle source
#

menu (menu tag)

#
notify_the_user_that_no_downloads_have_occurred() click to toggle source
#

notify_the_user_that_no_downloads_have_occurred

#
# File lib/rbt/check_for_updates/base.rb, line 154
def notify_the_user_that_no_downloads_have_occurred
  opnn; e 'No downloads occurred. This usually means that all '\
          'local programs are up to date! '+yellow('\\o/')
end
obtain_dataset_from_the_remote_webpage( url_to_the_remote_webpage = remote_webpage? ) click to toggle source
#

obtain_dataset_from_the_remote_webpage

#
# File lib/rbt/check_for_updates/base.rb, line 162
def obtain_dataset_from_the_remote_webpage(
    url_to_the_remote_webpage = remote_webpage?
  )
  begin
    @dataset = open(url_to_the_remote_webpage).read
  rescue OpenURI::HTTPError => error
    opnn; e 'OpenURI::HTTPError was encountered. This usually'
    opnn; e "happens when the URL is invalid (#{sfancy(url_to_the_remote_webpage)}"
    opnn; e 'Consider fixing the URL and trying again.'
    pp error
    exit
  end
end
Also aliased as: obtain_remote_dataset
obtain_remote_dataset( url_to_the_remote_webpage = remote_webpage? )
report_that_these_programs_were_updated(array) click to toggle source
#

report_that_these_programs_were_updated

#
# File lib/rbt/check_for_updates/base.rb, line 135
def report_that_these_programs_were_updated(array)
  unless array.empty?
    opnn; e "The following #{simp(array.size.to_s)} programs were updated:"
    array.each {|this_program|
      e "  #{sfancy(this_program)}"
    }
  end
end
report_the_remote_webpage( i = remote_webpage? ) click to toggle source
#

report_the_remote_webpage

Standard method to report the remote webpage in use.

#
# File lib/rbt/check_for_updates/base.rb, line 125
def report_the_remote_webpage(
    i = remote_webpage?
  )
  opnn; e 'Attempting to obtain data from the remote URL'
  opnn; e "  `#{sfancy(i)}`."
end
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/check_for_updates/base.rb, line 33
def reset
  super()
  @dataset = nil # <- Will store the downloaded-dataset (from open-uri).
  @downloaded_n_programs = 0 # <- Keeps track of how many programs were batch-downloaded.
  # ======================================================================= #
  # The next Array can keep track of which programs were updated.
  # ======================================================================= #
  @array_these_programs_were_updated = []
  @commandline_arguments = []
end
return_local_version_of_this_program(i) click to toggle source
#

return_local_version_of_this_program

#
# File lib/rbt/check_for_updates/base.rb, line 91
def return_local_version_of_this_program(i)
  RBT::Cookbooks::Cookbook.new(i) { :bypass_menu }.program_version?
end
set_commandline(i = ARGV)
set_commandline_arguments(i = ARGV) click to toggle source
#

set_commandline_arguments

#
# File lib/rbt/check_for_updates/base.rb, line 82
def set_commandline_arguments(i = ARGV)
  i = [i].flatten.compact
  @commandline_arguments = i
end
Also aliased as: set_commandline, set_input
set_input(i = ARGV)