class RBT::AutoupdateThisProgram

Constants

NAMESPACE
#

NAMESPACE

#

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 29
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 61
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
menu( i = @commandline_arguments ) click to toggle source
#

menu (menu tag)

#
reset() click to toggle source
#

reset

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 47
def reset
  super()
  @namespace = NAMESPACE
  @commandline_arguments = []
  # ======================================================================= #
  # 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  = true
end
run() click to toggle source
#

run

#
# File lib/rbt/utility_scripts/autoupdate_this_program.rb, line 111
def run
  menu
  @update_these_programs.each {|this_program|
    cd_to_the_log_directory
    _ = RBT::Compile.new(this_program) { :do_not_run }
    opnn; e "Now updating the libraries of the "\
            "program called `#{orange(this_program)}`:"
    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 75
def set_update_these_programs(i)
  @update_these_programs = [i].flatten.compact.map(&:downcase)
end