class RBT::CompileInTraditionalManner

Public Class Methods

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

RBT::CompileInTraditionalManner.new[]

#
# File lib/rbt/utility_scripts/compile_in_traditional_manner.rb, line 111
def self.[](i = ARGV)
  new(i)
end
new( commandline_arguments = ARGV, run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/compile_in_traditional_manner.rb, line 30
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  reset
  set_commandline_arguments(
    commandline_arguments
  )
  run if run_already
end

Public Instance Methods

reset() click to toggle source
#

reset (reset tag)

#
Calls superclass method RBT::Base#reset
# File lib/rbt/utility_scripts/compile_in_traditional_manner.rb, line 44
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/compile_in_traditional_manner.rb, line 52
def run
  commandline_arguments?.each {|this_program|
    this_program = this_program.dup if this_program.frozen?
    this_program.delete!('-') if this_program.include?('-')
    # ===================================================================== #
    # First remove entries such as "/download" from URLs given like:
    #
    #   https://sourceforge.net/projects/fetchmail/files/branch_6.4/fetchmail-6.4.33.tar.xz/download
    #
    # ===================================================================== #
    if this_program.end_with?('/download')
      this_program.delete_suffix!('/download')
    end
    if this_program.start_with?('http') or
       this_program.start_with?('https') or
       this_program.start_with?('ftp')
      # =================================================================== #
      # Assume in this case that an URL was provided, such as in:
      #
      #   trad https://ftp.gnome.org/pub/gnome/sources/gedit-plugins/3.37/gedit-plugins-3.37.92.tar.xz
      #
      # We will, in this event, first run update_entry on this, before
      # shortening the variable called i.
      # =================================================================== #
      RBT.update_entry(this_program) # ← Delegate to that method.
      require 'program_information'
      # =================================================================== #
      # Now simplify i:
      # =================================================================== #
      this_program = ProgramInformation.return_name(this_program)
    end
    compile_object = RBT::Installer.new(this_program, :do_not_run_yet) {{
      shall_we_check_whether_the_program_exists: :nope,
      prefix: '/usr/' # trad means --prefix=/usr/, after all.
    }}
    # ===================================================================== #
    # Check whether the input is an existing file - in this case we will
    # use it.
    # ===================================================================== #
    if this_program and File.exist?(this_program)
      program_name    = ::ProgramInformation[this_program].program_name?
      program_version = ::ProgramInformation[this_program].program_version?
      compile_object.set_program_name(program_name)
      compile_object.initialize_dataset
      compile_object.set_program_version(program_version)
      compile_object.set_program_name_and_program_version(:default)
      compile_object.set_archive_type(this_program)
      compile_object.set_base_dir return_pwd
      compile_object.set_program_full_name
      compile_object.rebuild_path
    end
    compile_object.determine_which_programs_to_compile
    compile_object.run
  }
end