class RBT::AutoupdateThisProgram

Public Class Methods

new( update_these_programs = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 27
def initialize(
    update_these_programs = ARGV,
    run_already           = true
  )
  reset
  update_these_programs = consider_setting_commandline_arguments(update_these_programs)
  # ======================================================================= #
  # Designate which programs are to be auto-updated next.
  # ======================================================================= #
  set_update_these_programs(
    update_these_programs
  )
  run if run_already
end

Public Instance Methods

consider_setting_commandline_arguments(i) click to toggle source
#

consider_setting_commandline_arguments

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 63
def consider_setting_commandline_arguments(i)
  if i.any? {|line| line.start_with?('--') }
    commandline_arguments? << i.select {|line| line.start_with?('--') }
    commandline_arguments?.flatten!
    i.reject! {|line| line.start_with?('--') }
  end
  i
end
do_update_only_the_binaries_of_the_program() click to toggle source
#

do_update_only_the_binaries_of_the_program

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 113
def do_update_only_the_binaries_of_the_program
  @update_the_libraries_of_the_program = false
  @update_the_binaries_of_the_program = true
end
do_update_only_the_libraries_of_the_program() click to toggle source
#

do_update_only_the_libraries_of_the_program

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 121
def do_update_only_the_libraries_of_the_program
  @update_the_libraries_of_the_program = true
  @update_the_binaries_of_the_program = false
end
menu( i = commandline_arguments? ) click to toggle source
#

menu (menu tag)

#
reset() click to toggle source
#

reset

#
Calls superclass method RBT::LeanPrototype#reset
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 45
def reset
  super()
  infer_the_namespace
  # ======================================================================= #
  # === @update_the_libraries_of_the_program
  #
  # Whether to update the libraries/binaries of the given program at hand.
  # ======================================================================= #
  @update_the_libraries_of_the_program = true
  # ======================================================================= #
  # === @update_the_binaries_of_the_program
  # ======================================================================= #
  @update_the_binaries_of_the_program  = true
end
run() click to toggle source
#

run

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 129
def run
  menu
  @update_these_programs.each {|this_program|
    cd_to_the_log_directory
    _ = action(:Installer, this_program) { :do_not_run }
    opne "#{rev}Now updating the libraries of the "\
         "program called `#{orange(this_program)}#{rev}`:"
    if @update_the_libraries_of_the_program
      _.update_libraries_of_this_program(this_program)
    end
    if @update_the_binaries_of_the_program
      _.update_binaries_of_this_program(this_program)
    end
  }
end
set_update_these_programs(i) click to toggle source
#

set_update_these_programs

This will set which programs ought to be automatically updated.

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 77
def set_update_these_programs(i)
  @update_these_programs = [i].flatten.compact.map(&:downcase)
end