class RBT::PackageRbtScripts

Constants

ARCHIVES_BASE_DIRECTORY
#

ARCHIVES_BASE_DIRECTORY

#
NAME_OF_THE_PROJECT
#

NAME_OF_THE_PROJECT

#

Public Class Methods

new( run_already = true ) click to toggle source
#

initialize

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 39
def initialize(
    run_already = true
  )
  reset
  run if run_already
end

Public Instance Methods

archive_dir?() click to toggle source
#

archive_dir?

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 86
def archive_dir?
  @archive_dir
end
ensure_that_the_archive_directory_exists() click to toggle source
#

ensure_that_the_archive_directory_exists

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 77
def ensure_that_the_archive_directory_exists
  unless Dir.exist? ARCHIVES_BASE_DIRECTORY
    mkdir(ARCHIVES_BASE_DIRECTORY)
  end
end
report_where_the_archive_dir_will_be() click to toggle source
#

report_where_the_archive_dir_will_be

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 67
def report_where_the_archive_dir_will_be
  archive_dir = ARCHIVES_BASE_DIRECTORY+'rbt-'+return_date
  set_archive_dir(archive_dir)
  opne 'The archive directory will be stored '\
       'at `'+sdir(@archive_dir)+'`.'
end
reset() click to toggle source
#

reset

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

run

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 152
def run
  run_everything
end
run_everything() click to toggle source
#

run_everything

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 93
def run_everything
  require 'roebe/toplevel_methods/copy_setup_rb_file.rb'
  ensure_that_the_archive_directory_exists # The archive dir must exist.
  report_where_the_archive_dir_will_be
  _ = RUBY_SRC_DIR
  rbt_base_dir = _+'rbt/' # Keep a trailing / here.
  # ======================================================================= #
  # Now it is time to (1) delete an old archive directory, and then to
  # (2) create the archive directory.
  # ======================================================================= #
  remove_directory(archive_dir?) if Dir.exist? archive_dir?
  opnn; create_directory(archive_dir?, :be_verbose)
  # ======================================================================= #
  # The next step is to enter the RBT base directory.
  # ======================================================================= #
  change_directory(rbt_base_dir, :be_verbose)
  opne "We are now in the directory `#{sdir(return_pwd)}`."
  opne 'Will copy '+sdir(rbt_base_dir)+' into the directory '
  opne sdir('  '+archive_dir?)
  # ======================================================================= #
  # Copy recursively next.
  # ======================================================================= #
  copy_recursively(rbt_base_dir, archive_dir?)
  # ======================================================================= #
  # Ok, we have created the target directory, and a pointer to the
  # old directory. Next, we copy setup.rb but only into the newly
  # created file.
  # ======================================================================= #
  Roebe.copy_setup_rb_file
  # ======================================================================= #
  # Next, change to the dir below archive_dir?.
  # ======================================================================= #
  cd File.dirname(archive_dir?)
  # ======================================================================= #
  # Remove setup.rb first. No longer necessary I think.
  # ======================================================================= #
  # remove(archive_dir?+'setup.rb')
  # ======================================================================= #
  # === Package it up via ToTarXt
  #
  # We will delegate towards class ToTarXz for the packaging.
  # ======================================================================= #
  # new_dir_name is now the new name of the directory.
  _ = File.basename(archive_dir?)
  result = ToTarXz.new(_){ :be_verbose }.location?.dup
  set_archive_dir log_dir?.dup # Reassign here.
  opne 'Now moving '+sfancy(result)+' to '+sdir(archive_dir?)
  move_file(result, archive_dir?)
  opne 'Finished packaging up the '+orange('RBT Scripts')+
       ' from '
  e sdir("   #{rbt_base_dir}")+' into '
  target = archive_dir?+File.basename(result).dup
  target << '.tar.xz' unless target.end_with?('.tar.xz')
  edir "   #{target}"
end
set_archive_dir( i = ARCHIVES_BASE_DIRECTORY ) click to toggle source
#

set_archive_dir

#
# File lib/rbt/utility_scripts/package_rbt_scripts.rb, line 57
def set_archive_dir(
    i = ARCHIVES_BASE_DIRECTORY
  )
  i = ARCHIVES_BASE_DIRECTORY if i.nil?
  @archive_dir = i
end