Class: RBT::Base

Inherits:
LeanPrototype show all
Defined in:
lib/rbt/base/base.rb

Overview

RBT::Base

Direct Known Subclasses

Action::FindAlternativeArchive, Action::Prefix, ApplySedOperations, Autosymlink, AutoupdateThisProgram, BackupProgram, BeautifyConfigureHelpOutput, BeautifySystem, BinaryNameBelongsToWhichProgram, BuildDetector, ChainCompile, Chainer, ChangePrefix, CheckForDuplicateBinaries, CheckForInvalidCurrentSymlinks, ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib, CleanupSystemTags, Cmake, ColourMakeInstall, ColourizeParser, Commandline, CompileBase, CompileBaseSystem, CompileInTraditionalManner, CompileIntoHomeDir, CompileIntoHomeDirWithoutSymlinking, CompileVersionedProgram, CompileViaEnvironmentVariableAsPrefix, CompileViaSQL, ConfigLogParser, ConfigureString, Controller, ConvertToNonTraditional, ConvertToTraditional, Cookbooks::AllUrls, Cookbooks::AllowedCookbookEntries, Cookbooks::BatchValidateTheCookbookRecipes, Cookbooks::CheckForAvailableVersions, Cookbooks::CheckForCorrectDependencies, Cookbooks::CheckForInclusion, Cookbooks::CheckForRemoteWebpages, Cookbooks::CheckIfSourceDirectoriesExist, Cookbooks::CheckValidityOfCookbooks, Cookbooks::ConvertDateFormat, Cookbooks::Convert_PKGBUILD, Cookbooks::CopyTheIdealCookbook, Cookbooks::CreateBigYamlCookbook, Cookbooks::CreateCookbookYamlFile, Cookbooks::CreateDatabase, Cookbooks::CreateEbuild, Cookbooks::CreateGlobalYamlDatabase, Cookbooks::CreateSqlFromThisCookbook, Cookbooks::DisplayCookbookDataset, Cookbooks::DownloadAllSourceArchives, Cookbooks::FeedbackLicenses, Cookbooks::FindAllArchiveTypes, Cookbooks::FindDirectoryEntriesWithoutCorrespondingYamlFile, Cookbooks::FindDuplicateBinaries, Cookbooks::FindHeaders, Cookbooks::FindMultipleVersions, Cookbooks::GenerateHomepage, Cookbooks::GobolinuxRecipesComparer, Cookbooks::Homepage, Cookbooks::IncrementProgramVersion, Cookbooks::LocalCheckForLatest, Cookbooks::MergeCookbooks, Cookbooks::MissingUseThisBuildSystemEntry, Cookbooks::Registered, Cookbooks::ReportMissingHomepageEntries, Cookbooks::ReportMissingLicenceEntries, Cookbooks::ReportTheRegisteredPrograms, Cookbooks::ReportUselessDescriptions, Cookbooks::ScanForMissingLastUpdateEntries, Cookbooks::ScanSourceArchive, Cookbooks::SearchForTags, Cookbooks::ShowDependenciesOf, Cookbooks::ShowDependenciesOn, Cookbooks::ShowLastUpdated, Cookbooks::ToggleKeepExtractedValue, Cookbooks::Url, Cookbooks::ValidateAllCookbookEntries, Cookbooks::ValidateArchiveSize, Cookbooks::ValidateBlfsEntries, Cookbooks::ValidateCookbookAliases, CopyTheseArchives, CreateAndPopulatePkgconfigDirectory, CreateBashScripts, CreateLogFile, CreatePackage, CreatePkgconfigFile, CreatePkgconfigFileForLua, CreateRpmSpecFile, CreateShellScriptContainingTheseProgramsVersions, CreateSnapcraftFile, DatabaseAdapters::Sequel::Adapter, ExclusiveLogic, ExtraInformation, FeedbackBinariesOf, FeedbackInformation, FetchAllM4Macros, FixPkgconfigFile, FlatpakUrlScanner, GUI::UniversalWidgets::CompileProgram, GUI::UniversalWidgets::InstalledPrograms, GUI::UniversalWidgets::Notebook, GUI::UniversalWidgets::RecipeMaker, GUI::UniversalWidgets::Statistics, GUI::UniversalWidgets::UrlAction, GenerateFlatpakManifestFile, GenerateMachomebrewFormula, GenerateMakefile, GeneratePdfTutorial, GenerateRbtConfiguration, GenerateShellCompletion, GenerateShellscript, GenerateSqlTable, Gitty, Gobolinux::NamingConvention, ImproveTheCookbookRecipes, InstallGlibSchema, InstallGraalvm, InstalledPrograms, Installer::Shell, KernelConfigSanitizer, Libtool, Libtool::RemoveLibtoolFiles, Linux::Debian::CreateControlFile, Linux::Debian::CreateDebianPackage, Linux::Fedora, Linux::Gobolinux::CreateDependenciesFile, Linux::Gobolinux::CreateRecipe, Linux::LFS, Linux::ParseBlfsWebpage, Linux::RenameSystemMap, Linux::Slackware::CreateSlackwarePackage, Linux::Slackware::FilelistParser, Linux::Slackware::GenerateSlackDescFile, Linux::Slackware::InstallThisSlackwarePackage, Make, MissingHomepages, NotFoundLibraries, PackageRbtScripts, ParseConfigureHelp, ProblemsAndErrors, ProfileInstall, PurgeBinariesOfThisProgram, PurgeHeadersOfThisProgram, PurgeIncorrectYamlDirectoriesInTheProgramsHierarchy, PurgeLibrariesOfThisProgram, QueryBinaryToPackage, QueryFileAssociation, QueryHeaderToPackage, ReconstituteGlibc, RegisterProgramFilesIntoGlobalDatabase, RegisterProgramFilesIntoYamlDatabase, RegisteredTags, RemoveAllSymlinks, RemoveEmptyDirectories, RemoveProgram, RemovePrograms, RemoveSymlinks, ReplaceSymlinks, RequiredDependenciesOn, ReverseDependencies, SaveTheAvailableProgramsVersions, Scons, ShowDependenciesOfThisLibrary, ShowDescriptionAndExtraInformation, SimpleVersionComparer, SimplifiedLddOutput, SimplifyRootEntries, StaticOverviewOfTheAvailableBinariesOnThisComputerSystem, SymlinkAllUpcasedProgramsToDowncasedVariants, SymlinkGlibSchema, SymlinkHeaders, SymlinkIntoTheUsrBinHierarchy, SymlinkIntoUsrLibDirectory, SymlinkPkgconfigFiles, SystemCompilePossibilities, Toolchain, Uninstall, UpdateEntry, UpdateSlackpkg, UrlAction, UseFlags, Users, VersionSwitcher, WhatCouldBecomeAnAppDir

Constant Summary

Constants inherited from LeanPrototype

LeanPrototype::ALL_COLOUR_METHODS, LeanPrototype::ARRAY_KDE_KONSOLE_COLOURS_IN_USE, LeanPrototype::DAY_NAMES, LeanPrototype::NAMESPACE, LeanPrototype::SILENT_REDIRECTION

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from LeanPrototype

#a_or_an?, #abbreviations?, #absolute_path, #action, #add_to_the_commandline_arguments, #all_binaries?, #all_files_from, #all_libraries?, #allowed_cookbook_entries?, #appdir_location_of?, #append_onto_the_internal_hash, #append_what_into, #archive_type_of?, #available_programs?, #be_quiet?, #be_verbose?, #begins_with_a_comment?, #capitalize_first_alphabetical_character, #cd_to_the_log_directory, #cd_to_the_temp_directory, #change_directory, #change_permission, #cheering_person?, #chmod, #chop_off_archive, #clear_commandline_arguments, #cliner, #coloured_and_padded_e, #coloured_and_padded_esystem, #coloured_esystem, #colourize_directory_for_system_results, #colourize_this_error, #colourize_this_file_path, #colourize_this_warning, #commandline_arguments?, #commandline_arguments_without_hyphens?, #comment, #convert_dd_mm_yyyy_to_its_long_variant, #convert_env_variable, #copy_directory, #copy_files, #cpr, #create_directory, #current_hour?, #dd_mmm_yyy, #debug, #debug?, #directory_expanded_cookbooks?, #disable_colours, #display_md5sum?, #do_not_debug, #does_the_cookbook_include_this_program?, #does_this_expanded_cookbook_file_exist_for_this_program?, #does_this_file_exist?, #does_this_file_exist_and_is_it_a_file?, #e, #eblue, #ecomment, #ecrimson, #edir, #editor?, #efancy, #eimp, #enable_colours, #enable_debug, #ensure_main_encoding_for, #eparse, #esystem, #esystem_gold, #etomato, #ewarn, #exit_program, #expanded_cookbooks_directory_exists?, #extract_this_archive, #extract_to?, #file_compiled_programs?, #file_dirname_retaining_trailing_slash, #file_predefined_installation_instructions?, #file_specification_of_registered_cookbook_entries, #find_cookbook_alias_for, #find_this_yaml_file, #first_argument?, #first_non_hyphen_argument?, #get_all_directories_from, #get_all_files_from, #get_all_programs, #get_date, #get_extended_date, #get_files_and_directories_from, #go_to_base_dir, #home_dir?, #host_system?, #infer_the_namespace, #initialize, #internal_hash?, #internal_hash_set_commandline_arguments, #is_an_archive?, #is_directory?, #is_file?, #is_github_url?, #is_make_available?, #is_meson_installed?, #is_on_gobolinux?, #is_on_windows?, #is_roebe?, #is_superuser?, #is_symlink?, #is_this_a_header?, #is_this_a_library?, #iso_encoding?, #load_dataset_from_this_expanded_cookbook, #load_yaml, #load_yaml_file_from_the_cookbook_directory_for_this_program, #log_directory?, #main_encoding?, #meson_build_file_exists?, #months?, #move_file, #n_programs_are_available?, #n_programs_available?, #namespace?, #no_directory_exists_at, #no_directory_was_found_at, #no_opn, #no_such_file_exists, #open_in_browser, #open_in_editor, #opncomment, #opne, #opnef, #opnerev, #opnerror, #opnesystem, #opnewarn, #opnfancy, #opnn, #otomato, #packages_directory?, #path_to_this_expanded_cookbooks_dataset, #pkgconfig_directory?, #populate_the_internal_hash_with_default_values, #predefined_installation_instructions?, #prepend_this_commandline_argument, #program_version_of?, #project_base_directory?, #project_yaml_directory?, #query_path?, #rarrow?, #read_file, #read_file_in_default_encoding, #read_file_with_default_encoding, #readlines, #readlines_with_proper_encoding, #register_sigint, #registered_cookbook_entries?, #remove, #remove_archive_from_the_end, #remove_comments_from_each_line, #remove_directory, #remove_double_slashes, #remove_file, #remove_newlines, #remove_parens, #remove_the_first_commandline_argument, #remove_this_commandline_argument, #remove_this_entry_from_the_commandline_arguments, #remove_trailing_ANSII_escape_code, #remove_unnecessary_data_from_url, #rename, #report_pwd, #require_the_rbt_aliases, #reset, #reset_the_internal_hash, #return_all_archives_from_this_directory, #return_appdir_prefix, #return_commandline_arguments_with_leading_hyphens, #return_current_hour_minutes_second, #return_date, #return_day_of_the_month_based_on_utc, #return_full_time, #return_hours_minutes_seconds_based_on_utc, #return_location_to_this_programs_yaml_file, #return_month_based_on_this_number, #return_month_based_on_utc, #return_opnn, #return_program_name, #return_program_name_for_gobolinux_systems, #return_program_name_via_program_information, #return_pwd, #return_unicode_warning_symbol_or_empty_string, #return_utc, #return_utc_time_in_a_format_similar_to_slackware, #return_weekday_based_on_utc, #return_year_based_on_utc, #rev, #rpn, #run, #run_simulation=, #run_simulation?, #sdir, #sdir_return_pwd, #set_be_silent, #set_be_verbose, #set_first_commandline_argument, #set_namespace, #set_use_colours, #set_use_opn, #set_xorg_buffer, #sfancy, #sfile, #silent_redirection?, #silently_create_this_directory_if_it_does_not_yet_exist, #simp, #source_base_directory?, #ssym, #stderr, #store_into_this_directory?, #string_right_arrow?, #swarn, #symlink, #sysbin_directory?, #sysetc_directory?, #sysinclude_directory?, #syslib_directory?, #sysshare_directory?, #system_directory?, #temp_directory?, #to_bool, #to_camelcase, #to_iso_encoding, #to_unicode, #today?, #touch, #try_to_require_beautiful_url, #try_to_require_the_environment_information_gem, #try_to_require_the_extracter_gem, #try_to_require_the_open_gem, #try_to_require_the_xorg_buffer, #try_to_require_wget, #try_to_return_a_special_compile_component, #unicode_cliner, #unicode_middle_cliner, #use_colours=, #use_colours?, #use_opn=, #use_opn?, #utf_encoding?, #verbose_truth, #word_wrap, #write_what_into, #write_what_into_via_unicode, #yes_or_no

Constructor Details

This class inherits a constructor from RBT::LeanPrototype

Class Method Details

.registered_binaries?Boolean

#

RBT::Base.registered_binaries?

Tell us where our binaries are registered.

#

Returns:

  • (Boolean)


501
502
503
# File 'lib/rbt/base/base.rb', line 501

def self.registered_binaries?
  RBT.all_binaries?
end

Instance Method Details

#cat(i) ⇒ Object

#

cat (cat tag)

#


519
520
521
522
523
# File 'lib/rbt/base/base.rb', line 519

def cat(i)
  if File.exist? i
    return readlines_with_proper_encoding(i).join
  end
end

#cd_back_to_the_current_working_directoryObject

#

cd_back_to_the_current_working_directory

This method can be used to ensure that we are back in the old “current working directory”, after invoking the given block.

#


448
449
450
451
452
453
454
# File 'lib/rbt/base/base.rb', line 448

def cd_back_to_the_current_working_directory
  working_directory = return_pwd
  if block_given?
    yield
  end
  cd(working_directory)
end

#consider_reporting_how_many_programs_are_registered(shall_we_report = false) ⇒ Object

#

consider_reporting_how_many_programs_are_registered

#


302
303
304
305
306
307
308
# File 'lib/rbt/base/base.rb', line 302

def consider_reporting_how_many_programs_are_registered(
    shall_we_report = false
  )
  if shall_we_report
    action(:report_the_registered_programs)
  end
end

#cookbook_files?(show_how = :show_only_name) ⇒ Boolean Also known as: available_cookbook_files?

#

cookbook_files?

This method will return all available cookbook files in an Array.

Usage example:

cookbook_files?(:show_full_path)
#

Returns:

  • (Boolean)


466
467
468
469
470
471
472
473
474
475
476
477
478
# File 'lib/rbt/base/base.rb', line 466

def cookbook_files?(
    show_how = :show_only_name
  )
  result = Dir["#{individual_cookbooks_directory?}*yml"].sort
  case show_how
  when :show_only_name # In this case, show only the name.
    result.map! {|entry|
      File.basename(entry).gsub( File.extname(entry), '' )
    }
  when :show_full_path # In this case make no modifications.
  end
  return result
end

#copy_recursively(what, where_to = '/usr/', be_verbose = false) ⇒ Object

#

copy_recursively (cpr tag)

#


368
369
370
371
372
373
374
# File 'lib/rbt/base/base.rb', line 368

def copy_recursively(
    what,
    where_to   = '/usr/',
    be_verbose = false
  )
  ::RBT.copy_recursively(what, where_to, be_verbose)
end

#delete_code_of_conduct?Boolean

#

delete_code_of_conduct?

Query method over as to whether we will try to remove code-of-conduct files. This is usually only valid for my home system, or when a config-option has been set to true. Note that the default value is false, so that other users can decide on their own whether they want to retain code of conducts or not.

#

Returns:

  • (Boolean)


138
139
140
141
142
143
144
145
146
147
148
# File 'lib/rbt/base/base.rb', line 138

def delete_code_of_conduct?
  if is_on_roebe?
    true
  else # else try to check for the config file.
    if config?
      config?.automatically_delete_code_of_conduct_files_when_repackaging
    else
      false
    end
  end
end

#determine_appdir_prefix_from_this_input(i = nil, program_version = nil) ⇒ Object Also known as: static_appdir_prefix_of?

#

determine_appdir_prefix_from_this_input

This method has to return a String, which constitutes the AppDir prefix of the target program at hand.

#


254
255
256
257
258
259
260
261
# File 'lib/rbt/base/base.rb', line 254

def determine_appdir_prefix_from_this_input(
    i               = nil,
    program_version = nil
  )
  return RBT.determine_appdir_prefix_from_this_input(
    i, program_version
  )
end

#directory_validation?Boolean

#

directory_validation?

#

Returns:

  • (Boolean)


219
220
221
# File 'lib/rbt/base/base.rb', line 219

def directory_validation?
  RBT.directory_validation?
end

#do_not_show_namesObject

#

do_not_show_names

#


105
106
107
# File 'lib/rbt/base/base.rb', line 105

def do_not_show_names
  RBT.do_not_show_names
end

#fast_return_file_size_of_this_program(i) ⇒ Object

#

fast_return_file_size_of_this_program

#


98
99
100
# File 'lib/rbt/base/base.rb', line 98

def fast_return_file_size_of_this_program(i)
  RBT.fast_return_file_size_of_this_program(i)
end

#file_last_symlinked_program?Boolean

#

file_last_symlinked_program?

#

Returns:

  • (Boolean)


313
314
315
# File 'lib/rbt/base/base.rb', line 313

def file_last_symlinked_program?
  RBT.file_last_symlinked_program?
end

#file_programs_version_urlObject

#

file_programs_version_url

#


379
380
381
# File 'lib/rbt/base/base.rb', line 379

def file_programs_version_url
  RBT.send(__method__)
end

#gem_version(i) ⇒ Object

#

gem_version

This method is a wrapper over Gem::Version.new()

The reason as to why this resides in a method is so that we can do some input-sanitizing, and easier rescue, if this is necessary one day.

#


325
326
327
328
329
330
331
332
333
334
335
336
# File 'lib/rbt/base/base.rb', line 325

def gem_version(i)
  i = i.to_s.delete('vr')
  begin
    if i =~ /\d+/ # Must have at the least one number.
      return Gem::Version.new(i)
    end
  rescue ArgumentError => error
    opne 'An error occurred in gem_version()'
    pp error
  end
  nil # Indicate "failure" aka unable to parse this version.
end

#is_a_64bit_system?Boolean Also known as: is_on_64_bit?

#

is_a_64bit_system?

This method will return true if the underlying system is a 64-bit system.

#

Returns:

  • (Boolean)


115
116
117
# File 'lib/rbt/base/base.rb', line 115

def is_a_64bit_system?
  RUBY_PLATFORM.include? '_64' # Due to → "x86_64-linux".
end

#is_ccache_available?Boolean Also known as: ccache_is_available?

#

is_ccache_available?

This method queries as to whether ccache is available or whether it is not.

#

Returns:

  • (Boolean)


269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
# File 'lib/rbt/base/base.rb', line 269

def is_ccache_available?
  result = true
  begin
    check_for_ccache = `ccache 2>&1`
    if check_for_ccache.include? 'command not found'
      result = false
    end
  rescue Errno::ENOENT
    # ====================================================================== #
    # This clause can happen when there is no
    # /bin/sh symlink.
    # ====================================================================== #
    check_for_ccache = false
  end
  result
end

#is_porg_available?Boolean Also known as: porg_is_available?

#

is_porg_available?

This method is required to determine whether porg is available or not.

#

Returns:

  • (Boolean)


388
389
390
391
# File 'lib/rbt/base/base.rb', line 388

def is_porg_available?
  result = `porg 2>&1`.include? 'porg: command not found'
  return !result
end

#is_this_binary_registered?(i) ⇒ Boolean

#

is_this_binary_registered?

#

Returns:

  • (Boolean)


508
509
510
511
512
513
514
# File 'lib/rbt/base/base.rb', line 508

def is_this_binary_registered?(i)
  unless RBT.respond_to?(:registered_binaries?)
    require 'rbt/registered/registered_binaries.rb'
  end
  array = RBT.registered_binaries?
  array.include?(i.to_s)
end

#is_this_program_included?(i, optional_arguments = nil) ⇒ Boolean Also known as: cookbooks_include_this_program?

#

is_this_program_included?

Use this method to query whether a program is included or whether it is not.

The second argument is, by default, nil. It can be a symbol such as :include_abbreviations, in which case we will include abbreviations.

Usage example:

is_this_program_included?(:htop, :include_abbreviations)
#

Returns:

  • (Boolean)


359
360
361
362
363
# File 'lib/rbt/base/base.rb', line 359

def is_this_program_included?(
    i, optional_arguments = nil
  )
  RBT.is_this_program_included?(i, optional_arguments) # bl $RBT/toplevel_methods/available_programs.rb
end

#make_command?Boolean

#

make_command?

#

Returns:

  • (Boolean)


417
418
419
# File 'lib/rbt/base/base.rb', line 417

def make_command?
  RBT::Base.make_command?
end

#make_install_command?Boolean

#

make_install_command?

This is the default “make install” command for now.

#

Returns:

  • (Boolean)


426
427
428
# File 'lib/rbt/base/base.rb', line 426

def make_install_command?
  'make install'
end

#new_cookbook_instance_for(name_of_the_program) ⇒ Object

#

new_cookbook_instance_for

Use a slightly shorter wrapper to access class Cookbook.

Note that you still have to require class Cookbook on your own, prior to calling this method.

The argument to this method should be the name of the program whose cookbook-dataset you wish to access/manipulate.

#


572
573
574
# File 'lib/rbt/base/base.rb', line 572

def new_cookbook_instance_for(name_of_the_program)
  action(:sanitize_cookbook, name_of_the_program)
end

#program_exists?(this_program) ⇒ Boolean

#

program_exists?

Use this method to find out whether the given program, as input to this method, exists.

Usage example:

if program_exists? :htop
#

Returns:

  • (Boolean)


170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/rbt/base/base.rb', line 170

def program_exists?(
    this_program
  )
  does_program_exist = false # Defaults to false - the program is not installed.
  this_program = this_program.to_s.dup #. downcase # sanitize. downcase is BAD, it breaks stuff like "Esetroot"
  if this_program.include? ' ' # split it, and take the first word in this case.
    this_program = this_program.split(' ').first 
  end
  path_variable_file = "#{RUBY_SRC_DIR}rcfiles/lib/rcfiles/yaml/path_variable.yml"
  if File.exist? path_variable_filelib
    array_available_paths = load_yaml(path_variable_file)['path'].strip.split(' ')
    array_available_paths.each {|path|
      _ = "#{path}/#{this_program}"
      does_program_exist = true if File.exist?(_)
    }
  end
  # Hack - an exception for configure:
  does_program_exist = true if this_program.include? '/configure'
  return does_program_exist
end

#publish_list_of_all_programs_versionObject

#

publish_list_of_all_programs_version

#


580
581
582
# File 'lib/rbt/base/base.rb', line 580

def publish_list_of_all_programs_version
  ::RBT.publish_list_of_all_programs_version
end

#rcp(i, &block) ⇒ Object

#

rcp

This method performs a recursive copy action, through RBT.action().

#


155
156
157
# File 'lib/rbt/base/base.rb', line 155

def rcp(i, &block)
  action(:rcp, i, &block)
end
#

Simply remove a symlink. Use this method consistently when you wish to remove any symlink.

#


531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
# File 'lib/rbt/base/base.rb', line 531

def remove_symlink(
    i,
    be_verbose = false
  )
  case be_verbose
  # ======================================================================== #
  # === :be_quiet
  # ======================================================================== #
  when :be_quiet
    be_verbose = false
  # ======================================================================== #
  # === :be_verbose
  # ======================================================================== #
  when :be_verbose
    be_verbose = true
  end
  if i.is_a? Array
    i.each {|entry| remove_symlink(entry, be_verbose) }
  else
    if File.symlink?(i)
      if be_verbose
        e "#{rev}Now deleting the symlink `#{sfancy(i)}#{rev}`."
      end
      File.delete(i)
    end
  end
end

#rename_kde_konsole_tab(use_this_as_the_new_title = '') ⇒ Object

#

rename_kde_konsole_tab

#


55
56
57
58
59
60
61
62
# File 'lib/rbt/base/base.rb', line 55

def rename_kde_konsole_tab(
    use_this_as_the_new_title = ''
  )
  if Object.const_defined?(:Roebe) and
     Roebe.respond_to?(:rename_tab)
    Roebe.rename_tab(use_this_as_the_new_title)
  end
end

#repackage(i, use_this_for_the_opnn_namespace = 'RBT::Repackage') ⇒ Object Also known as: repackage_this

#

repackage (repackage tag)

This method will repackage an archive format such as .tar.gz into .tar.xz.

#


70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/rbt/base/base.rb', line 70

def repackage(
    i,
    use_this_for_the_opnn_namespace = 'RBT::Repackage'
  )
  begin
    require 'repackage'
    if File.exist? i
      opnn(
        namespace_to_use: use_this_for_the_opnn_namespace
      )
      e "#{rev}Trying to repackage `#{sfile(i)}#{rev}` next:"
      Repackage.new(i) {{
        run:                    :run_already,
        delete_code_of_conduct: delete_code_of_conduct?
      }}
    else
      # Not sure whether we should report to the user or not.
    end
  rescue LoadError
    e "#{rev}The gem called \"repackage\" is not available - please install it"
    e "in order to repackage the archive at hand here (`#{sfile(i)}`)."
  end
end

#report_n_programsObject

#

report_n_programs

Usage example for the report functionality of this method:

report_n_programs
#


438
439
440
# File 'lib/rbt/base/base.rb', line 438

def report_n_programs
  consider_reporting_how_many_programs_are_registered
end

#report_working_directoryObject

#

report_working_directory

This method will simply report the current working directory (pwd), without making use of opnn().

#


212
213
214
# File 'lib/rbt/base/base.rb', line 212

def report_working_directory
  e "#{rev}The current working directory is #{sdir(return_pwd)}#{rev}."
end

#return_compile_time_statisticsObject

#

return_compile_time_statistics

#


122
123
124
125
126
127
# File 'lib/rbt/base/base.rb', line 122

def return_compile_time_statistics
  _ = RBT.file_storing_the_time_it_took_to_compile_programs
  if File.exist? _
    return YAML.load_file(_)
  end
end

#return_n_random_characters(i = 10) ⇒ Object

#

return_n_random_characters

This method will return n random characters, as Strings. It is used specifically to “create” a random temporary directory, into which archives can be extracted into.

#


487
488
489
490
491
492
493
494
# File 'lib/rbt/base/base.rb', line 487

def return_n_random_characters(
    i = 10
  )
  array = ('a'..'z').to_a
  _ = ''.dup
  i.times { _ << array.sample }
  _
end

#return_version_of_this_program(i) ⇒ Object

#

return_version_of_this_program

#


599
600
601
# File 'lib/rbt/base/base.rb', line 599

def return_version_of_this_program(i)
  RBT.swift_return_version_of_this_program(i)
end

#run_make_then_make_installObject

#

run_make_then_make_install

#


195
196
197
# File 'lib/rbt/base/base.rb', line 195

def run_make_then_make_install
  RBT.run_make_then_make_install
end

#sanitize_url1_entry(i, optional_hash = {}) ⇒ Object

#

sanitize_url1_entry

#


233
234
235
236
237
# File 'lib/rbt/base/base.rb', line 233

def sanitize_url1_entry(
    i, optional_hash = {}
  )
  RBT.sanitize_url1_entry(i, optional_hash)
end

#set_source_directory(i = return_pwd, be_verbose = false) ⇒ Object Also known as: set_source_dir

#

set_source_directory

Set the source dir to ANY new location. Defaults to Dir.pwd.

Example to test this method:

ry mantis --source_dir=/Depot/j
#


403
404
405
406
407
408
409
410
411
412
# File 'lib/rbt/base/base.rb', line 403

def set_source_directory(
    i          = return_pwd,
    be_verbose = false
  )
  i << '/' unless i.end_with? '/'
  RBT.set_source_directory(i)
  if be_verbose?
    e "#{rev}Setting source directory to `#{sdir(i)}#{rev}` next." 
  end
end

#show_overview_over_available_utility_scriptsObject

#

show_overview_over_available_utility_scripts

#


243
244
245
# File 'lib/rbt/base/base.rb', line 243

def show_overview_over_available_utility_scripts
  RBT.show_overview_over_available_utility_scripts
end
#

This method can be used to symlink two directories to one another, e. g. from directory A onto directory B.

#


609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
# File 'lib/rbt/base/base.rb', line 609

def symlink_all_files_from_this_directory_to_that_directory(
    this_dir,
    that_dir,
    delete_target_file = false
  )
  # ======================================================================== #
  # Select only files next:
  # ======================================================================== #
  _ = Dir[("#{this_dir}/*").squeeze('/')].select {|entry| is_file?(entry) }
  # ======================================================================== #
  # === Handle blocks next
  #
  # The block-variant can remove target-files. This is not the default,
  # so you have to specifically enable this if you want that
  # functionality.
  # ======================================================================== #
  if block_given?
    yielded = yield
    case yielded
    # ====================================================================== #
    # === :also_include_directories
    # ====================================================================== #
    when :also_include_directories,
         :include_directories
      _ = Dir[("#{this_dir}/*").squeeze('/')].select {|entry|
        is_file?(entry) or is_directory?(entry)
      }
    when :delete_target_file_if_it_exists
      delete_target_file = true
    end
  end
  # ======================================================================== #
  # Work through the files next, stored in the variable called _
  # ======================================================================== #
  _.each {|entry|
    # ====================================================================== #
    # Note that the following clause is NOT the default.
    # ====================================================================== #
    if delete_target_file
      _ = that_dir+File.basename(entry)
      if File.exist?(_) and File.file?(_)
        remove_file(_)
      end
    end
    real_target = that_dir+File.basename(entry)
    symlink(entry, real_target)
  }
end

#system_tags?Boolean

#

system_tags?

#

Returns:

  • (Boolean)


226
227
228
# File 'lib/rbt/base/base.rb', line 226

def system_tags?
  RBT.system_tags?
end

#upload_list_of_all_programs_versionObject

#

upload_list_of_all_programs_version

#


587
588
589
# File 'lib/rbt/base/base.rb', line 587

def upload_list_of_all_programs_version
  ::RBT.upload_list_of_all_programs_version
end

#use_yaml_database_for_tags?Boolean

#

use_yaml_database_for_tags?

#

Returns:

  • (Boolean)


202
203
204
# File 'lib/rbt/base/base.rb', line 202

def use_yaml_database_for_tags?
  RBT.use_yaml_database_for_tags?
end

#warn_and_exit(input, exit_mode = true) ⇒ Object Also known as: warn_then_exit

#

warn_and_exit

This method will exit from the scripts.

You should be careful when using this, because in some situations we do not actually want to exit completely - for example when we chain-compile something.

#


295
296
297
# File 'lib/rbt/base/base.rb', line 295

def warn_and_exit(input, exit_mode = true)
  warn(input, exit_mode)
end

#wget(i) ⇒ Object

#

wget

#


341
342
343
# File 'lib/rbt/base/base.rb', line 341

def wget(i)
  esystem "wget #{i}"
end