class RBT::InstallGraalvm

Public Class Methods

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

initialize

#
# File lib/rbt/utility_scripts/install_graalvm.rb, line 23
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/install_graalvm.rb, line 37
def reset
  super()
  infer_the_namespace
end
run() click to toggle source
#

run (run tag)

#
# File lib/rbt/utility_scripts/install_graalvm.rb, line 45
def run
  # ======================================================================= #
  # (1) First obtain the latest graalvm version "dynamically", from the
  # main source-directory in use.
  # ======================================================================= #
  src_dir = src_dir?
  target_directory = src_dir+'graalvm'
  cd(target_directory)
  files = Dir['*.tar*']
  if files.empty?
    opne "No files were found in #{sdir(target_directory)}."
  else
    # ===================================================================== #
    # (2) Now we can create a new directory:
    # ===================================================================== #
    this_archive = files.first
    # ===================================================================== #
    # this_archive is now something like: "graalvm-22.2.0-64bit.tar.xz"
    # ===================================================================== #
    raw_name = remove_archive_at_the_end(this_archive.dup).sub(/-64bit/,'')
    action(:create_appdir_skeleton, raw_name)
    _version = ProgramInformation.return_version(raw_name) # Not needed right now.
    # ===================================================================== #
    # (3) Now we can copy the .tar.xz file:
    # ===================================================================== #
    new_target_directory = program_dir?+'Graalvm/Current/'
    copy_file(this_archive, new_target_directory)
    cd(new_target_directory)
    # ===================================================================== #
    # (4) Extract it next:
    # ===================================================================== #
    extract_this_archive(this_archive) { :be_verbose }
    cd(remove_archive_at_the_end(this_archive))
    cd 'bin'
    target_dir = return_pwd
    cd '/usr/bin/'
    # ===================================================================== #
    # (5) Finally run the proper symlink from the roebe project
    # ===================================================================== #
    require 'roebe/classes/symlink_files_from_that_directory_to_the_current_directory/symlink_files_from_that_directory_to_the_current_directory.rb'
    Roebe::SymlinkFilesFromThatDirectoryToTheCurrentDirectory.new(target_dir)
  end
end