module RBT
#¶ ↑
All actions for the RBT
project should be registered via the toplevel method called RBT.action()
.
#¶ ↑
require ‘rbt/actions/actions.rb’ RBT.action
(:map_this_input_to_that_registered_program, _)
#¶ ↑
#¶ ↑
require ‘rbt/actions/individual_actions/software_manager/extract_related_code.rb’
#¶ ↑
#¶ ↑
RBT::Actions::MetaActions
¶ ↑
This file allows the user to batch-compile software, that is, compile all entries (in the primary Array) 1:1.
Note that this file will pull in the file rbt/actions/actions.rb.
#¶ ↑
require ‘rbt/actions/meta_actions/batch_compile.rb’ RBT::Actions::MetaActions.batch_compile(ARGV)
#¶ ↑
#¶ ↑
RBT::Actions::MetaActions
¶ ↑
#¶ ↑
See also:
https://www.linuxfromscratch.org/blfs/view/svn/
#¶ ↑
#¶ ↑
RBT::Actions::MetaActions
¶ ↑
MetaActions combine different activities into one “larger” activity, such as “the user wants to install a linux-from-scratch system”.
Note that this file will pull in the file rbt/actions/actions.rb.
#¶ ↑
#¶ ↑
RBT::Cookbooks::Aliases
¶ ↑
The purpose of this class is fairly simple:
- Give it a string such as "qt4r" and it will point to "qt4ruby".
Presently, this class only uses the Aliases defined by the file “cookbook_aliases.yml”.
You can also query and obtain this information.
It may be better to require other files than this class directly, such as ‘cookbooks/module_methods/is_included.rb’, since that file offers additional functionality, as well as make available class Cookbooks:Aliases anyway.
#¶ ↑
require ‘rbt/aliases/aliases.rb’ RBT.cookbook_aliases
#¶ ↑
#¶ ↑
#¶ ↑
This file will check for faulty current symlinks in the app-dir hierarchy.
#¶ ↑
require ‘rbt/toplevel_methods/check_for_faulty_current_symlinks.rb’
#¶ ↑
#¶ ↑
require ‘rbt/colours/colours.rb’
#¶ ↑
#¶ ↑
require ‘rbt/colours/determine_the_toplevel_use_colours_variable.rb’
#¶ ↑
#¶ ↑
require ‘rbt/colours/html_colours.rb’
#¶ ↑
#¶ ↑
require ‘rbt/colours/permanently_disable_colours.rb’
#¶ ↑
#¶ ↑
require ‘rbt/colours/rev_simp_sdir_sfancy_sfile_and_swarn.rb’
#¶ ↑
#¶ ↑
require ‘rbt/colours/use_colours.rb’
#¶ ↑
#¶ ↑
require ‘rbt/compile/constants.rb’ include RBT::Compile::Constants
#¶ ↑
#¶ ↑
require ‘rbt/compile_base/compile_base_module.rb’ include RBT::CompileBaseModule
#¶ ↑
#¶ ↑
require ‘rbt/configuration/configuration.rb’
#¶ ↑
#¶ ↑
require ‘rbt/configuration/configuration_instance_variable.rb’
#¶ ↑
#¶ ↑
require ‘rbt/configuration/initialize_configuration.rb’
#¶ ↑
#¶ ↑
RBT::SimpleConfigurationLoader¶ ↑
This class will load the various .yml files from the configuration/ subdirectory of the RBT
project.
This is to be done when a user does not have the configuration gem available.
Usage example:
RBT::Configuration::SimpleConfigurationLoader.new(ARGV)
#¶ ↑
require ‘rbt/configuration/simple_configuration_loader.rb’ RBT::SimpleConfigurationLoader.return_value_of_this_configuration_value
#¶ ↑
#¶ ↑
require ‘rbt/constants/configuration_directory.rb’
#¶ ↑
#¶ ↑
require ‘rbt/constants/constants.rb’ RBT::FILE_SETUP_PY
#¶ ↑
#¶ ↑
require ‘rbt/constants/namespace.rb’ RBT::NAMESPACE
#¶ ↑
#¶ ↑
require ‘rbt/constants/predefined_installation_instructions.rb’ RBT::FILE_SETUP_PY
#¶ ↑
#¶ ↑
This file will hold the relevant remote URL entries for the classes found in this directory.
#¶ ↑
require ‘rbt/constants/remote_URLs.rb’
#¶ ↑
#¶ ↑
require ‘rbt/cookbooks/display_cookbook_dataset/feedback/feedback_url.rb’
#¶ ↑
#¶ ↑
All constants related to different encodings will be stored here.
#¶ ↑
require ‘rbt/encoding/encoding.rb’
#¶ ↑
#¶ ↑
require ‘rbt/errors/exceptions.rb’
#¶ ↑
#¶ ↑
RBT::FileDoesNotExist
¶ ↑
When a file does not exist, this error can be raised.
#¶ ↑
#¶ ↑
RBT::Errors::MapLineToASpecificError
¶ ↑
The purpose of the code in this file here is to map a particular line to a particular error. This error will be registered and is then made available to other classes.
The reason why this file has been created was so that we can re-use the code that checks for such errors.
#¶ ↑
require ‘rbt/errors/map_line_to_a_specific_error.rb’
#¶ ↑
#¶ ↑
The job of this file is to return all programs that are available in the homebrew project.
#¶ ↑
require ‘rbt/homebrew/registered_programs_of_homebrew.rb’
#¶ ↑
#¶ ↑
RBT::LeanPrototype
¶ ↑
This file contains code for a “prototype” RBT::Base
class.
The distinction towards file rbt/base/base.rb is somewhat arbitrary, but the core idea is to keep the file lean_prototype.rb semi-minimal and only put in code that is really important for ALL the classes that subclass from it; whereas for larger classes, they are encouraged to require base.rb instead.
If you need to subclass, you should first try to require rbt/base/base.rb instead, because this one also pulls in the file here as well. But if you need only less code in your subclass, and even more importantly so, you need to avoid “circular dependency” warnings, then you can (safely) require and subclass from the file here instead.
In fact, this is why the file here was actually created:
I needed a file with some functionality but I could not use base.rb.
#¶ ↑
require ‘rbt/lean_prototype/lean_prototype.rb’ Foobar < RBT::LeanPrototype
#¶ ↑
#¶ ↑
require ‘rbt/libtool/class_methods/return_all_la_files_from_this_directory.rb’
#¶ ↑
#¶ ↑
require ‘rbt/libtool/help.rb’
#¶ ↑
#¶ ↑
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/lfs/lfs/constants.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/lfs/reset.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/lfs/run.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/make_conditional_symlink_for_lfs_binutils.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/lfs/lfs/constants.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/lfs/reset.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/lfs/run.rb’
#¶ ↑
#¶ ↑
require ‘rbt/linux/linux_from_scratch/make_conditional_symlink_for_lfs_binutils.rb’
#¶ ↑
#¶ ↑
It is recommended to use the method calls rather than the constants, as the method-call may be a bit more dynamic, and thus flexible.
#¶ ↑
require ‘rbt/project/project.rb’
#¶ ↑
#¶ ↑
RBT::Cookbooks::RegisteredGirFiles
¶ ↑
The task of this class is simple:
Iterate over all .gir files and collect them, and then store them into a yaml file.
#¶ ↑
require ‘rbt/registered/registered_gir_files.rb’ RBT::Cookbooks::RegisteredGirFiles.new
#¶ ↑
#¶ ↑
RBT::Cookbooks::RegisteredHeaders
¶ ↑
The task of this class is simple:
Iterate over all headers and collect them, storing them into a yaml file. If however had an argument is passed, then we will try to find out to which program this header file belongs to. (This is already done by FindHeaders, so we delegate to it.)
#¶ ↑
require ‘rbt/registered/registered_headers.rb’ RBT::Cookbooks::RegisteredHeaders.new
RBT.all_headers?
#¶ ↑
#¶ ↑
This will require all of the rbt/base *rb scripts.
#¶ ↑
require ‘rbt/requires/require_base_scripts.rb’
#¶ ↑
#¶ ↑
require ‘rbt/requires/require_colours.rb’
#¶ ↑
#¶ ↑
require ‘rbt/requires/require_colours_and_opn.rb’
#¶ ↑
#¶ ↑
require ‘rbt/requires/require_the_classes_for_individual_programs.rb’
#¶ ↑
#¶ ↑
require ‘rbt/requires/require_the_cookbook_utility_scripts.rb’
#¶ ↑
#¶ ↑
require ‘rbt/requires/require_the_generate_files_classes.rb’
#¶ ↑
#¶ ↑
require ‘rbt/requires/require_the_registered_components.rb’
#¶ ↑
#¶ ↑
This file will pull in all utility scripts.
#¶ ↑
require ‘rbt/requires/require_the_toplevel_methods.rb’
#¶ ↑
#¶ ↑
This file will pull in all validation scripts.
#¶ ↑
require ‘rbt/requires/require_the_validation_scripts.rb’
#¶ ↑
#¶ ↑
This file will pull in all utility scripts.
#¶ ↑
require ‘rbt/requires/require_utility_scripts.rb’
#¶ ↑
#¶ ↑
We will also enable a custom variant to load yaml files.
#¶ ↑
#¶ ↑
require ‘rbt/shell/constants.rb’
#¶ ↑
#¶ ↑
require ‘rbt/shell/help.rb’
#¶ ↑
#¶ ↑
This file holds the menu-interface of class RBT::Installer::Shell
.
#¶ ↑
require ‘rbt/shell/menu.rb’
#¶ ↑
#¶ ↑
require ‘rbt/sinatra/action_available_programs.rb’
#¶ ↑
#¶ ↑
require ‘rbt/sinatra/action_create.rb’
#¶ ↑
#¶ ↑
require ‘rbt/sinatra/action_view.rb’
#¶ ↑
#¶ ↑
require ‘rbt/sinatra/toplevel_methods.rb’
#¶ ↑
#¶ ↑
require ‘rbt/time/time.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/all_binaries.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/all_libraries.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/report_total_size_of_all_archives.rb’ RBT.report_total_size_of_all_archives
RBT.return_archive_type
RBT.remove_file_extension
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/available_programs.rb’ RBT.store_available_programs_into_a_yaml_file
RBT.store_abbreviations
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/batch_compile.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/check_for_binary_duplicates.rb’ RBT.check_for_binary_duplicates
#¶ ↑
#¶ ↑
The code in this file can be used to check a cookbook .yml file for any errors.
#¶ ↑
require ‘rbt/toplevel_methods/check_this_cookbook_file_for_errors.rb’ RBT.check_this_cookbook_file_for_errors
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/chroot_and_chown_related_code.rb’ RBT.chroot_compile(ARGV)
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/cliner.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/compile_these_programs.rb’ RBT.set_compile_these_programs
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/compile_via_appdir_prefix_without_symlinking.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/configure_appdir_prefix.rb’ RBT.return_appdir_prefix
(‘htop-2.3’) # => “/home/Programs/Htop/2.3/”
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/configure_has_a_higher_priority_than_meson.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/convert_global_env.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/debug.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/determine_appdir_prefix_from_this_input.rb’ RBT.determine_appdir_prefix_from_this_input
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/determine_appdir_prefix_from_this_input_by_guessing_the_program_version.rb’ RBT.determine_appdir_prefix_from_this_input
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/determine_host_architecture.rb’ RBT.is_on_64_bit?
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/does_include.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/download.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/dual_compile.rb’ RBT.dual_compile(ARGV)
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/e_and_esystem.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/editor.rb’
#¶ ↑
#¶ ↑
This file can be used to set an error message.
#¶ ↑
require ‘rbt/toplevel_methods/error_message.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/fast_return_file_size_of_this_program.rb’ RBT.fast_return_file_size_of_this_program
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/feedback_program_description.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/files_and_directories_related_methods.rb’ pp RBT.get_all_directories_from
(‘/home/x/src/’) pp RBT.temp_directory?
pp RBT.programs_directory?
#¶ ↑
#¶ ↑
require ‘rb/toplevel_methods/ftp.rb’
#¶ ↑
#¶ ↑
The purpose of this file is mostly to collect game-specific toplevel methods into one file, so that this can also more easily be re-used from other projects.
#¶ ↑
require ‘rbt/toplevel_methods/games.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/generate_programs_version_yaml_file.rb’ RBT.generate_programs_version_yaml_file
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/gobolinux.rb’ puts RBT.is_this_a_real_gobolinux_system?
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/home_directory.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/html.rb’ RBT.create_html_page_for_these_programs(input)
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/install_libstdc_plus_plus.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/install_which_binaries.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/make_app_prefix.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/md5sum.rb’
#¶ ↑
#¶ ↑
Code in this file is for toplevel-functionality related to the meson build system (and ninja).
In particular it was necessary to quickly compile a certain program, such as atk, in an appdir-like approach, so the code elements here in this file were started in May 2019.
#¶ ↑
require ‘rbt/toplevel_methods/meson.rb’ RBT.run_meson_configure_step
RBT.meson_appdir_prefix
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/module_programs.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/no_trad_no_symlink.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/opn.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/patch.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/pin_and_unpin.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/rds.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/remove_file_extension.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/report_extended_information_about_this_program.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/report_how_many_binaries_are_registered.rb’ RBT.report_how_many_binaries_are_registered
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/return_array_of_programs_without_a_blfs_entry.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/return_binaries_of_this_program.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/return_location_to_this_programs_yaml_file.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/return_string_containing_all_program_versions.rb’ RBT.return_string_containing_all_program_versions_the_last_update_and_the_remote_URL
RBT.store_the_string_into_a_md_file
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/return_version_of_this_program.rb’ RBT.return_version_of_this_program
(:php’)
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/roebe.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/rubygems.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/run_make_then_make_install.rb’ RBT.run_make_then_make_install
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/run_makepkg_command.rb’
#¶ ↑
#¶ ↑
The purpose of this file here is to simply report which tags are available for the individual cookbooks.
#¶ ↑
require ‘rbt/toplevel_methods/show_available_tags.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/show_available_utility_scripts.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/show_last_configure_option.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/swift_return_version_of_this_program.rb’ RBT.swift_return_version_of_this_program
(:htop) # => “2.0.2”
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/symlink.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/to_bool.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/toplevel_methods.rb’ RBT.set_xorg_buffer
RBT.uchroot_compile(ARGV) # uchroot nasm bison RBT.return_string_showing_the_last_updated_programs
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/try_to_find_shortcut_for_a_chain_compiled_program.rb’ RBT.try_to_find_shortcut_for_a_chain_compiled_program
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/try_to_return_a_special_compile_component.rb’
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/url.rb’ RBT.find_url_for(ARGV)
RBT.remote_url_for?(:php) RBT.return_program_name_and_program_version_from_this_github_url
#¶ ↑
#¶ ↑
require ‘rbt/toplevel_methods/verbose_truth.rb’
#¶ ↑
#¶ ↑
require ‘rbt/utility_scripts/increment_program_version/constants.rb’
#¶ ↑
#¶ ↑
require ‘rbt/utility_scripts/report_the_kde_status.rb’ RBT.report_the_kde_status
#¶ ↑
#¶ ↑
require ‘rbt/utility_scripts/show_overview_over_available_utility_scripts.rb’
#¶ ↑
#¶ ↑
require ‘rbt/version/version.rb’
#¶ ↑
Constants
- ALL_BINARIES
- ALL_LIBRARIES
- ALL_TAGS
- ARRAY_HELP_OPTIONS
#¶ ↑
RBT::ARRAY_HELP_OPTIONS
(help tag)¶ ↑All the help options are stored here. These are the ones that work on e. g. “rbt –help”.
#¶ ↑
- ARRAY_HELP_VERSION_OPTIONS
#¶ ↑
ARRAY_HELP_VERSION_OPTIONS
¶ ↑#¶ ↑
- ARRAY_REGISTERED_ARCHIVES
#¶ ↑
ARRAY_REGISTERED_ARCHIVES
¶ ↑Keep these archive formats registered in this Array.
#¶ ↑
- ARRAY_SPECIAL_COMPONENT_CONTAINING_MANY_SUBCOMPONENTS
#¶ ↑
ARRAY_SPECIAL_COMPONENT_CONTAINING_MANY_SUBCOMPONENTS
¶ ↑Here we add constants that can be used like in this way:
ry --plasma1 ry --gnome3
#¶ ↑
- BASE_URL_TO_GNOME_SOURCES
#¶ ↑
BASE_URL_TO_GNOME_SOURCES
¶ ↑#¶ ↑
- BLFS_CHANGELOG_WEBPAGE
#¶ ↑
BLFS_CHANGELOG_WEBPAGE
¶ ↑#¶ ↑
- CAPITALIZE_PROGRAM_NAME
- CAPITALIZE_PROGRAM_NAMES
#¶ ↑
CAPITALIZE_PROGRAM_NAME
¶ ↑Whether we should capitalize the program names or not. The difference will then be e. g. “htop” versus “Htop”.
#¶ ↑
- CHAINED_PROGRAMS
- CHECK_FOR_BINARY_NAMES
#¶ ↑
CHECK_FOR_BINARY_NAMES
¶ ↑#¶ ↑
- CHECK_FOR_LIBRARY_NAMES
#¶ ↑
CHECK_FOR_LIBRARY_NAMES
¶ ↑#¶ ↑
- COLOURS
#¶ ↑
COLOURS
¶ ↑#¶ ↑
- COMMAND_NOT_FOUND
#¶ ↑
COMMAND_NOT_FOUND
¶ ↑#¶ ↑
- COMPILE_EVERYTHING_INTO_STANDALONE_DIRECTORY
#¶ ↑
COMPILE_EVERYTHING_INTO_STANDALONE_DIRECTORY
¶ ↑Whether to compile everything into a standalone directory or not.
#¶ ↑
- COOKBOOKS_BASE_DIRECTORY
#¶ ↑
COOKBOOKS_BASE_DIRECTORY
¶ ↑The following constant is actually only useful for my home system, and only if I don’t use any other setting. So this is mostly just here for legacy reasons.
#¶ ↑
- COOKBOOK_ALIASES
- CURRENT_VERSION_OF_LXQT
#¶ ↑
CURRENT_VERSION_OF_LXQT
¶ ↑Use this constant to keep track as to which lxqt version is the one that is currently tracked by
RBT
. It has to be manually updated (for now).#¶ ↑
- ColourMake
#¶ ↑
RBT::ColourMake
¶ ↑#¶ ↑
- ConfigureHelp
#¶ ↑
RBT::ConfigureHelp
¶ ↑#¶ ↑
- Cookbook
#¶ ↑
RBT::Cookbook
¶ ↑This will also “alias” methods such as
RBT::Cookbook
[].#¶ ↑
- CreateSlackwarePackage
#¶ ↑
RBT::CreateSlackwarePackage
¶ ↑#¶ ↑
- DEFAULT_ARCHIVE_TYPE
#¶ ↑
DEFAULT_ARCHIVE_TYPE
¶ ↑This constant may be required so that other classes know which is the default archive. This can then be used to, for example, repackage archives into this format.
#¶ ↑
- DEFAULT_COLOUR_TO_USE
#¶ ↑
DEFAULT_COLOUR_TO_USE
¶ ↑Specify what is our main colour to use for the
Cookbooks
project.#¶ ↑
- DEFAULT_ENTRY
- DEFAULT_PROGRAM_ENTRY
#¶ ↑
DEFAULT_PROGRAM_ENTRY
¶ ↑#¶ ↑
- DEPOT_DIR
#¶ ↑
DEPOT_DIR
¶ ↑Hardcoded path to the depot-directory.
#¶ ↑
- DIRECTORY_INDIVIDUAL_COOKBOOKS_AT_ROEBE_HOME
#¶ ↑
DIRECTORY_INDIVIDUAL_COOKBOOKS_AT_ROEBE_HOME
¶ ↑This constant is used mostly on my home system.
#¶ ↑
- DIRECTORY_RBT_PROFILES
#¶ ↑
DIRECTORY_RBT_PROFILES
¶ ↑This may be a path such as:
/home/Programs/Ruby/2.6.5/lib/ruby/site_ruby/2.6.0/rbt/misc/profiles/
#¶ ↑
- DIRECTORY_TO_THE_PROFILES
- DOWNLOAD_KDE_ORG
#¶ ↑
RBT::DOWNLOAD_KDE_ORG
¶ ↑#¶ ↑
- ENCODING_ISO
#¶ ↑
RBT::ENCODING_ISO
¶ ↑#¶ ↑
- ENCODING_UTF
#¶ ↑
RBT::ENCODING_UTF
¶ ↑#¶ ↑
- ERROR_LINE
- FILE_CCACHE
#¶ ↑
FILE_CCACHE
¶ ↑#¶ ↑
- FILE_CMAKE_LISTS
#¶ ↑
FILE_CMAKE_LISTS
¶ ↑#¶ ↑
- FILE_COMPILE_HOOKS
#¶ ↑
FILE_COMPILE_HOOKS
¶ ↑#¶ ↑
- FILE_COOKBOOK_ALIASES
#¶ ↑
FILE_COOKBOOK_ALIASES
¶ ↑#¶ ↑
- FILE_COOKBOOK_CHAINED_PROGRAMS
#¶ ↑
FILE_COOKBOOK_CHAINED_PROGRAMS
¶ ↑Easier constant to keep track of the chained cookbook-programs. In this context, a chain means a successive run of programs that are to be compiled.
This will then yield to a path such as the following:
/usr/lib/ruby/site_ruby/3.0.0/rbt/yaml/chained_programs/chained_programs.yml
#¶ ↑
- FILE_CPUINFO
#¶ ↑
FILE_CPUINFO
¶ ↑#¶ ↑
- FILE_GLOBAL_FLAGS
#¶ ↑
FILE_GLOBAL_FLAGS
¶ ↑#¶ ↑
- FILE_MESON_BUILD
#¶ ↑
FILE_MESON_BUILD
¶ ↑#¶ ↑
- FILE_PROGRAMS_DIRECTORY
#¶ ↑
FILE_PROGRAMS_DIRECTORY
¶ ↑#¶ ↑
- FILE_REGISTERED_BINARIES
#¶ ↑
FILE_REGISTERED_BINARIES
¶ ↑This may be a file path such as:
/home/Programs/Ruby/2.7.1/lib/ruby/site_ruby/2.7.0/rbt/yaml/registered/binaries.yml
cat $COOKBOOKS/yaml/registered_binaries.yml
#¶ ↑
- FILE_REGISTERED_GIR_FILES
#¶ ↑
FILE_REGISTERED_GIR_FILES
¶ ↑#¶ ↑
- FILE_REGISTERED_HEADERS
#¶ ↑
FILE_REGISTERED_HEADERS
¶ ↑Prefer to use the method
RBT.file_registered_headers
instead - this constant is mildly deprecated (but still available if you really need it).#¶ ↑
- FILE_REGISTERED_LIBRARIES
#¶ ↑
FILE_REGISTERED_LIBRARIES
¶ ↑This may be a file path such as:
/Programs/Ruby/2.4.1/lib/ruby/site_ruby/2.4.0/rbt/yaml/registered_libraries.yml
cat $RBT/yaml/registered_libraries.yml
#¶ ↑
- FILE_REGISTERED_PKGCONFIG_FILES
#¶ ↑
FILE_REGISTERED_PKGCONFIG_FILES
¶ ↑#¶ ↑
- FILE_SCONS
#¶ ↑
FILE_SCONS
¶ ↑#¶ ↑
- FILE_SETUP_PY
#¶ ↑
FILE_SETUP_PY
¶ ↑This constant can be useful if you have to install a program that depends on the file ‘setup.py’.
#¶ ↑
- FILE_SHORT_TUTORIAL
#¶ ↑
FILE_SHORT_TUTORIAL
¶ ↑#¶ ↑
- FILE_TIME_COMPILATION
#¶ ↑
FILE_TIME_COMPILATION
¶ ↑#¶ ↑
- FILE_TRY_TO_USE_THE_FILE_WINDOWS_COOKBOOK
#¶ ↑
FILE_TRY_TO_USE_THE_FILE_WINDOWS_COOKBOOK
¶ ↑#¶ ↑
- FILE_USE_FLAGS
#¶ ↑
FILE_USE_FLAGS
¶ ↑#¶ ↑
- FILE_USE_MD5SUM
#¶ ↑
FILE_USE_MD5SUM
¶ ↑#¶ ↑
- FILE_USE_PORG
#¶ ↑
FILE_USE_PORG
¶ ↑#¶ ↑
- FILE_WAF
#¶ ↑
FILE_WAF
¶ ↑#¶ ↑
- FILE_WINDOWS_COOKBOOK
#¶ ↑
FILE_WINDOWS_COOKBOOK
¶ ↑#¶ ↑
- GEM
#¶ ↑
GEM
¶ ↑#¶ ↑
- GNOME_FTP_URL
#¶ ↑
GNOME_FTP_URL
¶ ↑#¶ ↑
- GOBOLINUX_LAYOUT
#¶ ↑
GOBOLINUX_LAYOUT
¶ ↑This constant is probably only needed for gobolinux systems.
#¶ ↑
- HASH_DESIGNATED_COLOURS
#¶ ↑
HASH_DESIGNATED_COLOURS
¶ ↑#¶ ↑
- HASH_ENGLISH_NUMBERS
#¶ ↑
HASH_ENGLISH_NUMBERS
¶ ↑#¶ ↑
- HASH_INSTALLATION_INSTRUCTIONS
#¶ ↑
HASH_INSTALLATION_INSTRUCTIONS
¶ ↑This Hash gives us an easier handle to sanitize our data.
It has some constant-shortcuts that are convenient for use lateron.
For instance, RINSTALL means “ruby install”, PINSTALL means “python install”.
#¶ ↑
- HOME_DIRECTORY_FOR_USER_X
- HOME_FOR_X
#¶ ↑
RBT::HOME_FOR_X
¶ ↑This constant is mostly used on my home setup, so it will be fairly useless for other people.
#¶ ↑
- HOST_CPU
#¶ ↑
HOST_CPU
¶ ↑The host CPU that the scripts are running on.
#¶ ↑
- ISO_ENCODING
- InstallThisSlackwarePackage
#¶ ↑
RBT::InstallThisSlackwarePackage
¶ ↑#¶ ↑
- KDE_REGEX_FOR_REMOTE_ARCHIVES
#¶ ↑
KDE_REGEX_FOR_REMOTE_ARCHIVES
¶ ↑This is the regex that can be used in order to obtain the proper remote URL to the individual KDE packages.
As an example, have a look here:
https://rubular.com/r/3ZX5Rz8soGqjsw
#¶ ↑
- LAST_UPDATE
#¶ ↑
LAST_UPDATE
¶ ↑This specifies when the
RBT
project was last updated. It should be updated whenever theVERSION
constant changes.#¶ ↑
- LINUX
#¶ ↑
LINUX
¶ ↑#¶ ↑
- LZ
#¶ ↑
LZ
¶ ↑#¶ ↑
- MAKE_COMMAND_TO_USE
#¶ ↑
MAKE_COMMAND_TO_USE
¶ ↑Which make command to use by default.
#¶ ↑
- N
#¶ ↑
N
¶ ↑#¶ ↑
- NAMESPACE
#¶ ↑
NAMESPACE
¶ ↑Which namespace we shall use for the
RBT
project may be defined here.This is a Hash “constant”, so that we can more easily re-define it, if we have to.
#¶ ↑
- N_CHARACTERS_PER_LINE
#¶ ↑
RBT::N_CHARACTERS_PER_LINE
¶ ↑Default value to be used for word-wrap splitting.
#¶ ↑
- PROGRAM_VERSION
- PROJECT_BASE_DIRECTORY
#¶ ↑
RBT::PROJECT_BASE_DIRECTORY
¶ ↑#¶ ↑
- RBT_HOMEPAGE_URL
#¶ ↑
RBT_HOMEPAGE_URL
¶ ↑The
RBT
Homepage is defined here.#¶ ↑
- RBT_VERSION_NUMBER
- REGEXES_TO_SHOW_THE_SOURCE_DIRECTORY
#¶ ↑
REGEXES_TO_SHOW_THE_SOURCE_DIRECTORY
¶ ↑These regexes can be used to show/check for the source directory.
#¶ ↑
- REGEX_TO_SANITIZE_LIBRARIES
#¶ ↑
REGEX_TO_SANITIZE_LIBRARIES
¶ ↑Use this regex if you wish to sanitize some libraries.
#¶ ↑
- REGEX_TO_USE_FOR_FOR_GITHUB
#¶ ↑
REGEX_TO_USE_FOR_FOR_GITHUB
¶ ↑This constant is used to grab archives from github.
These archives have a form like:
https://github.com/ninja-build/ninja/archive/v1.7.1.tar.gz
The following example on rubular shows how to use this:
https://rubular.com/r/f78srzR8v8E0As
The match that will be returned is then a String such as:
1.7.1.tar.gz
#¶ ↑
- REGISTERED_COOKBOOK_ENTRIES
- REGISTER_COMPILED_PROGRAM
#¶ ↑
REGISTER_COMPILED_PROGRAM
¶ ↑Whether we should register compiled programs or not.
#¶ ↑
- REMOTE_DOWNLOAD_BASE_URL_FOR_LXQT
#¶ ↑
REMOTE_DOWNLOAD_BASE_URL_FOR_LXQT
¶ ↑#¶ ↑
- REMOTE_DOWNLOAD_URL_FOR_KDE_PLASMA
#¶ ↑
REMOTE_DOWNLOAD_URL_FOR_KDE_PLASMA
¶ ↑#¶ ↑
- REMOTE_DOWNLOAD_URL_FOR_LXQT
#¶ ↑
REMOTE_DOWNLOAD_URL_FOR_LXQT
¶ ↑The following constant should have an URL such as:
https://downloads.lxqt.org/0.14.1.html
#¶ ↑
- REMOTE_PUB_MATE_DESKTOP_RELEASES
#¶ ↑
REMOTE_PUB_MATE_DESKTOP_RELEASES
¶ ↑#¶ ↑
- REMOTE_PUB_MATE_DESKTOP_RELEASES_LATEST_VERSION
#¶ ↑
REMOTE_PUB_MATE_DESKTOP_RELEASES_LATEST_VERSION
(mate tag)¶ ↑This should be used as the base for the download-functionality in the file check_for_mate_desktop_updates.rb
This would correspond to an URL like:
https://pub.mate-desktop.org/releases/1.24/ https://pub.mate-desktop.org/releases/1.26/ https://pub.mate-desktop.org/releases/
#¶ ↑
- REMOTE_SLACKWARE_HOMEPAGE
#¶ ↑
REMOTE_SLACKWARE_HOMEPAGE
¶ ↑#¶ ↑
- REMOTE_URL_FOR_KDE_APPLICATIONS
#¶ ↑
RBT::REMOTE_URL_FOR_KDE_APPLICATIONS
¶ ↑The KDE applications include software such as “dolphin”. They are now called “KDE Gear” rather than “KDE Applications”.
The URL may look like this:
https://download.kde.org/stable/release-service/?C=M;O=D
To batch-update these applications, do:
update_kde_applications updatekdeapplications
#¶ ↑
- REMOTE_URL_FOR_KDE_FRAMEWORKS
#¶ ↑
REMOTE_URL_FOR_KDE_FRAMEWORKS
¶ ↑This URL should point to the latest KDE-frameworks release.
Presently, (08 September 2018) the latest KDE-frameworks release is 5.50.0 (the URL, oddly enough, does not include the trailing “0”). Subsequent releases neither have had a trailing “0”.
To batch-update from the commandline, try this:
update_kde_frameworks updatekdeframeworks
#¶ ↑
download.kde.org/stable/frameworks/5.115/
#¶ ↑
- REMOTE_URL_FOR_KDE_PLASMA
#¶ ↑
REMOTE_URL_FOR_KDE_PLASMA
(plasma tag)¶ ↑Always point to the latest KDE-Plasma (upstream) URL here with this constant, such as www.kde.org/info/plasma-5.14.3.php.
To invoke updating all KDE-plasma components from the commandline, you may issue the following command:
update_kde_plasma updatekdeplasma
#¶ ↑
- REMOTE_URL_FOR_KDE_PORTING_AIDS
#¶ ↑
REMOTE_URL_FOR_KDE_PORTING_AIDS
¶ ↑This constant must come after the constant
REMOTE_URL_FOR_KDE_FRAMEWORKS
has been defined.To update these, try:
rbt --update_porting_aids update_porting_aids
#¶ ↑
download.kde.org/stable/frameworks/5.115/portingAids/
#¶ ↑
- REMOTE_URL_TO_THE_HOMEBREW_FORMULAS
#¶ ↑
RBT::REMOTE_URL_TO_THE_HOMEBREW_FORMULAS
¶ ↑#¶ ↑
- REMOTE_URL_TO_THE_MATE_DESKTOP_COMPONENTS
#¶ ↑
REMOTE_URL_TO_THE_MATE_DESKTOP_COMPONENTS
¶ ↑This constant specifies where we can find the (remote) source code to the mate-desktop, via HTTP-file listing.
#¶ ↑
- REPORT_SPECIFIC_PROGRAM_NAME
#¶ ↑
REPORT_SPECIFIC_PROGRAM_NAME
¶ ↑#¶ ↑
- ROEBE_FILE_GLOBAL_FLAGS
#¶ ↑
ROEBE_FILE_GLOBAL_FLAGS
¶ ↑This constant here is only for my home system, hence the prefix ROEBE in it.
#¶ ↑
- ROEBE_PATH_TO_COOKBOOKS
- RUBY_SRC
- RUBY_SRC_DIR
#¶ ↑
RUBY_SRC_DIR
¶ ↑This deliberately hard-coded constant is for my home system - it helps speed up the development process if I can use such constants as shortcuts.
#¶ ↑
- RUBY_SRC_DIRECTORY
- RUBY_SRC_DIR_AT_HOME
- RUBY_SRC_DIR_RBT
#¶ ↑
RUBY_SRC_DIR_RBT
¶ ↑This constant is only useful on my home system.
It corresponds to:
/home/x/programming/ruby/src/rbt/lib/rbt/
#¶ ↑
- RUBY_SRC_DIR_RBT_YAML
#¶ ↑
RUBY_SRC_DIR_RBT_YAML
¶ ↑This constant may correspond to the String “/home/x/programming/ruby/src/rbt/lib/rbt/yaml/”.
#¶ ↑
- RUBY_SRC_DIR_RBT_YAML_AT_HOME
#¶ ↑
RUBY_SRC_DIR_RBT_YAML_AT_HOME
¶ ↑#¶ ↑
- RUBY_SRC_RBT_COOKBOOKS
#¶ ↑
RUBY_SRC_RBT_COOKBOOKS
¶ ↑This constant refers to the following path on my home system:
/home/x/programming/ruby/src/rbt/lib/rbt/yaml/cookbooks/
#¶ ↑
- SHALL_WE_DEBUG
- SHELL_ERROR_CODE
#¶ ↑
SHELL_ERROR_CODE
¶ ↑Shell Error code - to append. Since as of September 2022 this won’t include any ‘ ’ character. Before that it did.
# ¶ ↑
- SHOW_EXTRA_INFORMATION
#¶ ↑
SHOW_EXTRA_INFORMATION
¶ ↑#¶ ↑
- SPECIFICATION_OF_REGISTERED_COOKBOOK_ENTRIES
- STOP_ON_ERROR
#¶ ↑
STOP_ON_ERROR
¶ ↑Whether we stop on error or not.
#¶ ↑
- TABULATOR
#¶ ↑
TABULATOR
¶ ↑#¶ ↑
- TARBZ2
- TARGET_CPU
#¶ ↑
TARGET_CPU
¶ ↑The target CPU that we are running on.
#¶ ↑
- TARGZ
- TARXZ
- TAR_BZ2
#¶ ↑
TAR_BZ2
¶ ↑#¶ ↑
- TAR_GZ
#¶ ↑
TAR_GZ
¶ ↑#¶ ↑
- TAR_XZ
#¶ ↑
TAR_XZ
¶ ↑Several archive types are kept here.
#¶ ↑
- TRY_TO_DOWNLOAD_IF_NOT_FOUND
#¶ ↑
RBT::TRY_TO_DOWNLOAD_IF_NOT_FOUND
¶ ↑Whether to try and download a program if we can not find it locally.
#¶ ↑
- URL_TO_REMOTE_CHANGELOG
#¶ ↑
URL_TO_REMOTE_CHANGELOG
¶ ↑Where to keep the remote changelog, if we make use of one that is.
This is no longer in use as of February 2024 - but, for the time being, we will retain it.
#¶ ↑
- URL_TO_THE_DOCUMENTATION
#¶ ↑
URL_TO_THE_DOCUMENTATION
¶ ↑#¶ ↑
- USE_ABSOLUTE_SYMLINKING
#¶ ↑
RBT::USE_ABSOLUTE_SYMLINKING
¶ ↑#¶ ↑
- USE_FLAGS
- USE_MAIN_ENCODING
- USE_TAGS
#¶ ↑
USE_TAGS
¶ ↑Whether to use (and thus symlink) tags. Can be changed via the yaml configuration file.
#¶ ↑
- USE_THIS_ENCODING
#¶ ↑
RBT::USE_THIS_ENCODING
¶ ↑Main pointer towards the main Encoding for the
RBT
project.#¶ ↑
- USR_INCLUDE_DIR
#¶ ↑
USR_INCLUDE_DIR
¶ ↑This can be standalone because it will be ALWAYS absolute, pointing towards “/usr/include/”.
#¶ ↑
- VERSION
#¶ ↑
VERSION
¶ ↑Which version does
RBT
have. Query via:RBT::VERSION
.PROGRAM_VERSION
is just an alias to it - stick to usingVERSION
instead “officially” whenever possible.#¶ ↑
- YAML_DATABASE_DIRECTORY
#¶ ↑
YAML_DATABASE_DIRECTORY
¶ ↑Directory definition to use our yaml databases.
#¶ ↑
- YAML_FILE_REGISTERED_BINARIES
- YAML_FILE_REGISTERED_LIBRARIES
- YAML_FILE_REGISTERED_TAGS
- ZIP
#¶ ↑
ZIP
¶ ↑#¶ ↑
Public Class Methods
#¶ ↑
RBT.action
(action tag, actions tag)¶ ↑
The second argument to this method defaults to ARGV since as of May 2022.
If you want to require all actions then use this line:
require 'rbt/requires/require_actions.rb'
#¶ ↑
# File lib/rbt/actions/actions.rb, line 27 def self.action( action_that_is_desired = nil, optional_argument1 = ARGV, # This is typically the main input to this method. options_hash = {}, &block ) action_that_is_desired = action_that_is_desired.to_s.delete('?').to_sym _ = optional_argument1 # Easier "pointer" here. # ======================================================================= # # Before September 2022 this method turned the variable optional_argument1 # into a String, if it was an Array. This is no longer done, as we lose # information that way. # ======================================================================= # case action_that_is_desired # (case tag) # ======================================================================= # # === :cmake # ======================================================================= # when :cmake, :run_cmake require 'rbt/cmake/cmake.rb' RBT.cmake(_, &block) # ======================================================================= # # === :run_meson_configure_step # ======================================================================= # when :run_meson_configure_step require 'rbt/toplevel_methods/meson.rb' RBT.run_meson_configure_step(_, &block) # ======================================================================= # # === :run_meson # # This entry point runs the whole meson-stack, aka "meson", "ninja" # and then "ninja install". # ======================================================================= # when :run_meson use_this_prefix = '/usr/' if _ and !_.empty? use_this_prefix = _ end esystem 'meson --prefix='+use_this_prefix+' --libdir='+use_this_prefix+'/lib BUILD_DIRECTORY' cd('BUILD_DIRECTORY') esystem 'ninja' esystem 'ninja install' # ======================================================================= # # === :meson_appdir_prefix # ======================================================================= # when :meson_appdir_prefix, :MesonAppdirPrefix require 'rbt/toplevel_methods/meson.rb' RBT.meson_appdir_prefix # ======================================================================= # # === :map_this_input_to_that_registered_program # # Usage examples from within a .rb file: # # action(:map_this_input_to_that_registered_program, _) # RBT.action(:map_this_input_to_that_registered_program, _) # # ======================================================================= # when :map_this_input_to_that_registered_program, :MapThisInputToThatRegisteredProgram require 'rbt/actions/individual_actions/map_this_input_to_that_registered_program/map_this_input_to_that_registered_program.rb' RBT::Action::MapThisInputToThatRegisteredProgram[_, &block] # This also is automatically { :be_quiet } # ======================================================================= # # === :check_for_available_versions # # Commandline usage example: # # raction check_for_available_versions # # ======================================================================= # when :check_for_available_versions, :CheckForAvailableVersions require 'rbt/utility_scripts/check_for_available_versions.rb' RBT.check_for_available_versions(_, &block) # ======================================================================= # # === :cookbooks # ======================================================================= # when :cookbooks, :Cookbooks, :cookbook, :Cookbook, :sanitize_cookbook, :SanitizeCookbook, :sanitized_cookbook, :sanitize_data, :SanitizedData, :cookbook_for, :CookbookFor, :cookbook_dataset, :CookbookDataset require 'rbt/requires/require_the_cookbook_class.rb' RBT.sanitize_cookbook(_, options_hash, &block) # ======================================================================= # # === :create_app_dir_skeleton # # This entry point must be similar to: # # rcp htop-1.2 # rcp htop-1.2 --blank # rcppwd # # Commandline invocation example: # # raction create_app_dir_skeleton wesnoth-1.2.3 # # ======================================================================= # when :create_app_dir_skeleton, :create_appdir_skeleton, :CreateAppDirSkeleton, :create_program_skeleton, :create_program, :CreateProgram, :appdir_skeleton, :rcp require 'rbt/actions/individual_actions/create_app_dir_skeleton/create_app_dir_skeleton.rb' RBT.create_app_dir_skeleton(_, &block) # ======================================================================= # # === :save_the_available_programs_versions # ======================================================================= # when :save_the_available_programs_versions, :SaveTheAvailableProgramsVersions require 'rbt/utility_scripts/save_the_available_programs_versions.rb' RBT::SaveTheAvailableProgramsVersions.new # ======================================================================= # # === :backup_program # ======================================================================= # when :backup_program, :BackupProgram require 'rbt/utility_scripts/backup_program.rb' RBT.backup_program(_) # ======================================================================= # # === :software_manager # # This is the general action that can be used to install or otherwise # compile a program from its source code. The class that will handle # this step is RBT::Action::Installer. In other words, this entry point # can be used to compile a program. # # It is just about the most important entry point for RBT.actions() # in general. # # Usage examples: # # RBT.action(:compile_program, 'gcc') # RBT.action(:compile_program, :lfs1) # RBT.action(:compile_program, :lfs2) # RBT.action(:compile_program, :lfs3) { :use_sound } # RBT.action(:installer, :lfs2) # RBT.installer(:htop) # # Commandline usage examples: # # raction software_manager lfs2 # raction installer lfs2 # # ======================================================================= # when :software_manager, :SoftwareManager, :sm, :SM, :installer, :Installer, :install, # ← Not 100% sure about this alias here yet, but we'll see (February 2024) :compile_program, :compile require 'rbt/actions/individual_actions/software_manager/software_manager.rb' # ===================================================================== # # === Add support for "lfs1", "lfs2", "lfs3" as input here: # ===================================================================== # if _.is_a?(Array) and _.first.to_s.start_with?('lfs') _ = _.first.to_s end if _.to_s.start_with?('lfs') # Assume: :lfs1 # =================================================================== # # Load the dataset from the file lfs_steps.yml next: # =================================================================== # dataset = YAML.load_file("#{project_yaml_directory?}lfs/lfs_steps.yml") _ = dataset[ _.to_s.delete_prefix('lfs').to_i - 1 ] end RBT.software_manager(_, &block) # ======================================================================= # # === :registered_binaries # # This action will always return how many registered binaries are # available for the RBT project. # # Usage example from within ruby code: # # action(:registered_binaries) # # ======================================================================= # when :registered_binaries, :RegisteredBinaries require 'rbt/registered/registered_binaries.rb' return RBT.registered_binaries? # ======================================================================= # # === :generate_homepage # ======================================================================= # when :generate_homepage, :GenerateHomepage require 'rbt/cookbooks/generate_homepage/generate_homepage.rb' RBT.generate_homepage(_) # ======================================================================= # # === :check_for_duplicate_binaries # ======================================================================= # when :check_for_duplicate_binaries, :CheckForDuplicateBinaries require 'rbt/utility_scripts/check_for_duplicate_binaries.rb' RBT::CheckForDuplicateBinaries.new(_, &block) # ======================================================================= # # === :disable_md5sum_calculation # ======================================================================= # when :disable_md5sum_calculation require 'rbt/requires/require_the_cookbook_class.rb' RBT::Action::Cookbooks::SanitizeCookbook.disable_md5sum_calculation # Cookbooks::Cookbook must provide this method. # ======================================================================= # # === :run_make_then_make_install # ======================================================================= # when :run_make_then_make_install require 'rbt/toplevel_methods/run_make_then_make_install.rb' RBT.run_make_then_make_install # ======================================================================= # # === :return_chained_programs # ======================================================================= # when :return_chained_programs, :ReturnChainedPrograms require 'rbt/constants/constants.rb' return RBT.return_chained_programs # ======================================================================= # # === :change_tab_title # # This entry point can be used to rename a KDE konsole tab. # ======================================================================= # when :change_tab_title, :ChangeTabTitle, :consider_changing_the_tab_title, :ConsiderChangingTheTabTitle, :rename_konsole_tab, :rename_shell, :set_title, :consider_renaming_the_kde_konsole_tab require 'rbt/toplevel_methods/toplevel_methods.rb' RBT.consider_changing_the_tab_title(_[0], _[1]) # ======================================================================= # # === :check_for_inclusion # ======================================================================= # when :check_for_inclusion, :CheckForInclusion require 'rbt/cookbooks/check_for_inclusion/check_for_inclusion.rb' RBT::Cookbooks::CheckForInclusion.new(_) # ======================================================================= # # === :cookbook_aliases # ======================================================================= # when :cookbook_aliases, :CookbookAliases, :cookbooks_aliases, :CookbooksAliases require 'rbt/aliases/aliases.rb' RBT.cookbook_aliases # ======================================================================= # # === :ntrad # ======================================================================= # when :ntrad, :non_traditional, :appdir require 'rbt/actions/individual_actions/ntrad/ntrad.rb' _ = [_].flatten.compact work_on_these_programs = [_].flatten.compact RBT.ntrad(work_on_these_programs, &block) # ======================================================================= # # === :suggest_cookbook_for # # Usage example from within ruby code: # # action(:suggest_cookbook_for, :htop) # # ======================================================================= # # bl $RBT/actions/individual_actions/cookbooks/suggest_cookbook_for/suggest_cookbook_for.rb # ======================================================================= # when :suggest_cookbook_for require 'rbt/actions/individual_actions/cookbooks/suggest_cookbook_for/suggest_cookbook_for.rb' RBT.suggest_cookbook_for(_, &block) # ======================================================================= # # === :symlink_into_the_usr_bin_hierarchy # # Symlink the given Array into the /usr/bin/ hierarchy. Optionally a # directory can be given as main input. # # Invocation example: # # RBT.action(:symlink_into_the_usr_bin_hierarchy, :ninja) # # ======================================================================= # when :symlink_into_the_usr_bin_hierarchy require 'rbt/utility_scripts/symlink_into_the_usr_bin_hierarchy.rb' RBT::SymlinkIntoTheUsrBinHierarchy.new(_, &block) # ======================================================================= # # === :to_current # # You can pass the program name and program version into this entry # point. Passing the full path is also possible. # # Usage example: # # RBT.action(:to_current, 'htop-1.2') # # ======================================================================= # when :to_current, :ToCurrent require 'rbt/actions/individual_actions/to_current/to_current.rb' RBT.to_current(_, &block) # ======================================================================= # # === :symlink_from_to_current # # Usage example from within ruby files: # # action(:symlink_from_to_current, _) # # ======================================================================= # when :symlink_from_to_current, :SymlinkFromToCurrent, :symlink_this_appdir, :SymlinkThisAppdir require 'rbt/utility_scripts/symlink_from_to_current/symlink_from_to_current.rb' RBT::SymlinkFromToCurrent.new(_) # ======================================================================= # # === :force # # This variant forcues the symlink-action. # ======================================================================= # when :force, :symlink_from_to_current2, :SymlinkFromToCurrent2 require 'rbt/utility_scripts/symlink_from_to_current/symlink_from_to_current.rb' _ = RBT::SymlinkFromToCurrent.new(_, :do_not_run_yet) _.do_force_symlink _.run # ======================================================================= # # === :infobox_for # ======================================================================= # when :infobox_for, :InfoboxFor, :infobox, :Infobox, :flexbox, :Flexbox begin # Try to pull in the sexy flexbox. require 'ascii_paradise/requires/require_flexbox.rb' AsciiParadise::Flexbox.new(_, &block) rescue LoadError :flexbox_is_not_available end # ======================================================================= # # === :rbt_version # ======================================================================= # when :rbt_version require 'rbt/version/version.rb' return RBT.version? # ======================================================================= # # === :ensure_that_the_log_directory_exists # # Usage example: # # action(:ensure_that_the_log_directory_exists) # # ======================================================================= # when :ensure_that_the_log_directory_exists _ = log_directory? mkdir(_) unless File.directory? _ # ======================================================================= # # === :generate_version_file # # Usage example: # # action(:generate_version_file) # # ======================================================================= # when :generate_version_file, :GenerateVersionFile require 'rbt/toplevel_methods/generate_programs_version_yaml_file.rb' RBT.generate_programs_version_yaml_file # ======================================================================= # # === :test_this_alias # ======================================================================= # when :test_this_alias, :rbt_test_alias require 'rbt/toplevel_methods/available_programs.rb' require 'rbt/aliases/aliases.rb' RBT.test_this_alias(_) # ======================================================================= # # === :prefix_object # ======================================================================= # when :prefix_object, :PrefixObject, :prefix, :Prefix require 'rbt/prefix/prefix.rb' _ = _.first if _.is_a? Array RBT.prefix_object(_, &block) # ======================================================================= # # === :return_appdir_prefix # # Usage example: # # action(:return_appdir_prefix, 'htop') # # ======================================================================= # when :return_appdir_prefix, :appdir_prefix RBT.return_appdir_prefix(_) # ======================================================================= # # === :determine_appdir_prefix_from_this_input # # Usage example: # # RBT.installer(:determine_appdir_prefix_from_this_input) # # ======================================================================= # when :determine_appdir_prefix_from_this_input RBT.determine_appdir_prefix_from_this_input(_) # ======================================================================= # # === :extract # # This entry point allows the user to extract an archive. # # It is a special entry point, because it can also handle pseudo # symbols, such as in the following case: # # RBT.action(:extract, ':htop') { :be_silent } # # This will take htop from its default position on the local filesystem. # # Usage example: # # RBT.action(:extract, '/home/x/src/htop/htop-3.1.2.tar.xz', extract_to: '/Depot/jjjj/') # # Commandline invocation example: # # raction mate_desktop # # ======================================================================= # when :extract, :Extract, :action_extracter, :extract_what_to require 'rbt/actions/individual_actions/extract/extract.rb' extract_to = options_hash[:extract_to] if options_hash.is_a?(Hash) unless _.is_a?(Symbol) _ = _.to_s end if extract_to.nil? extract_to = RBT.log_directory? end RBT.extract(_, extract_to, &block) # ======================================================================= # # === :program_version # # This entry point will specifically make use of # ProgramInformation.program_version? to find out the program-version # from a given String. # # Commandline usage example: # # raction program_version gtkmm-3.24.7 # # ======================================================================= # when :program_version, :ProgramVersion require 'program_information' return ProgramInformation.program_version?(_, &block) # ======================================================================= # # === :program_name # # This entry point will specifically make use of # ProgramInformation.program_name? to find out the program-name from # a given String. # # Commandline usage example: # # raction program_name gtkmm-3.24.7 # # ======================================================================= # when :program_name, :ProgramName require 'program_information' return ProgramInformation.program_name?(_, &block) # ======================================================================= # # === :increment_program_version # # Commandline usage example: # # raction increment_program_version # # ======================================================================= # when :increment_program_version, :IncrementProgramVersion, :increment, :Increment require 'rbt/utility_scripts/increment_program_version/increment_program_version.rb' RBT.increment_program_version # ======================================================================= # # === report_mate_desktop_version # # Commandline invocation example: # # raction mate_desktop # # ======================================================================= # when :report_mate_desktop_version, :report_the_mate_desktop_version, :report_mate_desktop, :mate_desktop_version, :mate_version, :mate_desktop, :mate? require 'rbt/actions/individual_actions/information/report_mate_desktop_version.rb' RBT.report_mate_desktop_version # ======================================================================= # # === :create_program_version_url_file # # Usage example: # # RBT.action(:CreateProgramVersionUrlFile, :ruby) # # Commandline invocation example: # # raction create_program_version_url_file # # ======================================================================= # when :create_program_version_url_file, :CreateProgramVersionUrlFile, :program_version_url_file require 'rbt/actions/individual_actions/information/create_program_version_url_file.rb' RBT.create_program_version_url_file(_) # ======================================================================= # # === :compile_the_python_addons # ======================================================================= # when :compile_the_python_addons require 'rbt/requires/require_the_installer_class.rb' compile_object = RBT::Action::Installer.new { :dont_run_yet } compile_object.compile_the_python_addons compile_object.do_initiate_batch_compilation # ======================================================================= # # === :gitty # ======================================================================= # when :gitty, :Gitty require 'rbt/utility_scripts/gitty.rb' RBT.gitty(_) # ======================================================================= # # === :simple_appdir_configure # # bl $RBT/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb # # ======================================================================= # when :simple_appdir_configure, :SimpleAppdirConfigure require 'rbt/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb' RBT.simple_appdir_configure(_) # ======================================================================= # # === :file_ldd_dataset # ======================================================================= # when :file_ldd_dataset, :ldd_file require 'rbt/utility_scripts/simplified_ldd_output.rb' RBT.file_ldd_dataset? # ======================================================================= # # === :ldd_dataset # # Usage example: # # dataset = RBT.action(:ldd_dataset) # # ======================================================================= # when :ldd_dataset, :LddDataset require 'rbt/utility_scripts/simplified_ldd_output.rb' RBT.ldd_dataset? # ======================================================================= # # === :create_ldd_dataset # # This will create a new ldd-dependencies file, containing all # local libraries. # # Commandline invocation example: # # rbt_action create_ldd_dataset # # ======================================================================= # when :create_ldd_dataset, :create_dependencies_of_libraries_file, :CreateDependenciesOfLibrariesFile require 'rbt/utility_scripts/simplified_ldd_output.rb' RBT.create_ldd_dataset # ======================================================================= # # === :show_configuration_options # # This entry point allows the user to query the configuration # options used by a given program. On my home computer I have # aliased this to "sco", so I can just do "sco gcc" to query # the configuration options used by gcc. # ======================================================================= # when :show_configuration_options, :ShowConfigurationOptions, :sco require 'rbt/requires/require_show_configuration_options.rb' RBT.show_configuration_options(_, &block) # ======================================================================= # # === :scan_for_blfs_programs # # Commandline invocation example: # # raction scan_for_blfs_programs # # ======================================================================= # when :scan_for_blfs_programs, :ScanForBlfsPrograms, :missing_blfs, :MissingBlfs require 'rbt/actions/individual_actions/cookbooks/scan_for_blfs_programs/scan_for_blfs_programs.rb' RBT.scan_for_blfs_programs # ======================================================================= # # === :return_blfs # # This variant, although a slight misnomer, is for commandline use. # # It will simply print the BLFS of the program at hand. # # Commandline invocation example: # # rbt_action return_blfs # # ======================================================================= # when :return_blfs require 'rbt/actions/individual_actions/cookbooks/blfs/blfs.rb' # bl $RBT/actions/individual_actions/cookbooks/blfs/blfs.rb e RBT.return_blfs_page_of_this_program(_, &block) # ======================================================================= # # === :copy_these_archives # ======================================================================= # when :copy_these_archives, :CopyTheseArchives, :copy, :Copy require 'rbt/utility_scripts/copy_these_archives.rb' RBT.copy_these_archives(_) # ======================================================================= # # === :not_found_libraries # # This entry point allows the user to show libraries that are missing, # aka "not found libraries". # ======================================================================= # when :not_found_libraries, :NotFoundLibraries require 'rbt/utility_scripts/not_found_libraries.rb' RBT.not_found_libraries # ======================================================================= # # === :remove_empty_directories # # Commandline usage example: # # raction remove_empty_directories # # ======================================================================= # when :remove_empty_directories, :RemoveEmptyDirectories require 'rbt/utility_scripts/remove_empty_directories.rb' RBT.remove_empty_directories(_) # ======================================================================= # # === :show_manual_steps # # Commandline usage example: # # raction show_manual_steps glibc # # ======================================================================= # when :show_manual_steps require 'rbt/utility_scripts/show_manual_steps.rb' RBT.show_manual_steps(_) # ======================================================================= # # === :chain_compile # # Invocation example: # # raction chain_compile kde5_plasma # # ======================================================================= # when :chain_compile, :ChainCompile require 'rbt/utility_scripts/chain_compile.rb' RBT.chain_compile(_, &block) # ======================================================================= # # === :show_compile_chain # # Invocation example: # # raction show_compile_chain kde5_plasma # # ======================================================================= # when :show_compile_chain, :ShowCompileChain, :display_compile_chain, :DisplayCompileChain, :show_compile_chain_of, :ShowCompileChainOf require 'rbt/actions/individual_actions/show_compile_chain/show_compile_chain.rb' RBT.show_compile_chain(_) # ======================================================================= # # === :download_all_source_archives # ======================================================================= # when :download_all_source_archives, :DownloadAllSourceArchives, :obtain_source_archives, :ObtainSourceArchives, :batch_download_all_source_archives, :BatchDownloadAllSourceArchives require 'rbt/cookbooks/download_all_source_archives/download_all_source_archives.rb' RBT::Cookbooks::DownloadAllSourceArchives.new(_) # ======================================================================= # # === :batch_validate_the_cookbook_recipes # ======================================================================= # when :batch_validate_the_cookbook_recipes, :BatchValidateTheCookbookRecipes, :validate_entries, :ValidateEntries require 'rbt/checks_and_validations/batch_validate_the_cookbook_recipes.rb' RBT.validate_entries # ======================================================================= # # === :homepage # ======================================================================= # when :homepage, :report_the_homepage, :report_homepage require 'rbt/cookbooks/homepage/homepage.rb' RBT.homepage(_) # ======================================================================= # # === :compile_in_traditional_manner # # This entry point will compile via the /usr/ prefix. # ======================================================================= # when :compile_in_traditional_manner require 'rbt/utility_scripts/compile_in_traditional_manner.rb' RBT::CompileInTraditionalManner.new(_) # ======================================================================= # # === :store_abbreviations # # Commandline usage example: # # raction abbrev # # ======================================================================= # when :store_abbreviations, :StoreAbbreviations, :abbrev require 'rbt/toplevel_methods/available_programs.rb' RBT.store_abbreviations # ======================================================================= # # === :update_available_programs # # Commandline usage example: # # raction update_available_programs # # ======================================================================= # when :update_available_programs, :UpdateAvailablePrograms, :save_available_programs, :SaveAvailablePrograms require 'rbt/toplevel_methods/available_programs.rb' RBT.store_available_programs_into_a_yaml_file # ======================================================================= # # === :url1 # # This will display the url1 content on the commandline. # # Commandline invocation example: # # raction url1 openssl # raction url1 cairo # raction url1 pango # raction url1 sdl2 # raction url1 sdl2image # raction url1 sdl2mixer # # ======================================================================= # when :url1 result = action(:SanitizeCookbook, _, &block) e result.url? # ======================================================================= # # === :url2 # # This will display the url2 content on the commandline. # # Commandline invocation example: # # raction url2 ruby # # ======================================================================= # when :url2 result = action(:SanitizeCookbook, _, &block) e result.url2? # ======================================================================= # # === :return_blfs_page_of_this_program # # Usage examples: # # RBT.action(:blfs, 'glibc') # action(:blfs, 'abc') { :def } # action(:return_blfs_page_of_this_program, 'abc') { :def } # # Commandline invocation example: # # rbt_action return_blfs_page_of_this_program htop # # ======================================================================= # when :return_blfs_page_of_this_program, :return_blfs_entry_for, :blfs_page_of_this_program, :blfs_page, :report_all_blfs_entries require 'rbt/actions/individual_actions/cookbooks/blfs/blfs.rb' RBT.return_blfs_page_of_this_program(_, &block) # ======================================================================= # # === :blfs_instance # # This will return an instance of class BLFS. # # Usage example: # # action(:blfs_instance, 'abc') { :def } # # ======================================================================= # when :blfs_instance, :BlfsInstance, :blfs, :Blfs require 'rbt/actions/individual_actions/cookbooks/blfs/blfs.rb' RBT.blfs_instance(_, &block) # ======================================================================= # # === :validate_blfs_entries # # Commandline usage example: # # raction validate_blfs_entries # # ======================================================================= # when :validate_blfs_entries require 'rbt/checks_and_validations/validate_blfs_entries.rb' RBT.validate_blfs_entries # ======================================================================= # # === :paste_blfs # ======================================================================= # when :paste_blfs require 'rbt/requires/require_the_installer_class.rb' _ = RBT::Action::Installer.new(_, :do_not_run_yet) _.try_to_show_the_BLFS_content_of_this_program(_) # ======================================================================= # # === :cleanup_system_tags # # Usage example: # # action(:CleanupSystemTags) { :be_quiet } # # ======================================================================= # when :cleanup_system_tags, :CleanupSystemTags require 'rbt/utility_scripts/cleanup_system_tags.rb' RBT::CleanupSystemTags.new(_, &block) # ======================================================================= # # === :allowed_cookbook_entries # ======================================================================= # when :allowed_cookbook_entries, :AllowedCookbookEntries require 'rbt/checks_and_validations/allowed_cookbook_entries.rb' RBT::Cookbooks::AllowedCookbookEntries.new # ======================================================================= # # === :static_overview_of_the_available_binaries_on_this_computer_system # ======================================================================= # when :static_overview_of_the_available_binaries_on_this_computer_system, :StaticOverviewOfTheAvailableBinariesOnThisComputerSystem require 'rbt/utility_scripts/static_overview_of_the_available_binaries_on_this_computer_system.rb' RBT.static_overview_of_the_available_binaries_on_this_computer_system # ======================================================================= # # === :validate_cookbook_aliases # # Usage example: # # RBT.action(:validate_cookbook_aliases) # # Commandline usage example: # # raction validate_cookbook_aliases # # ======================================================================= # when :validate_cookbook_aliases, :ValidateCookbookAliases, :validate_the_cookbook_aliases, :ValidateTheCookbookAliases require 'rbt/checks_and_validations/validate_cookbook_aliases.rb' RBT.validate_cookbook_aliases # ======================================================================= # # === :expand_cookbooks # # Commandline invocation example: # # raction expand_cookbooks # # ======================================================================= # when :expand_cookbooks, :ExpandCookbooks, :expand, :EXPAND, :expand_this_cookbook, :ExpandThisCookbook require 'rbt/actions/individual_actions/cookbooks/expand_cookbooks/expand_cookbooks.rb' RBT.expand_cookbooks(_) # ======================================================================= # # === :show_last_updated # # Usage example: # # action(:ShowLastUpdated) # # Commandline usage example: # # raction show_last_updated # # ======================================================================= # when :show_last_updated, :ShowLastUpdated require 'rbt/cookbooks/show_last_updated.rb' RBT.show_last_updated(_) # ======================================================================= # # === :purge_incorrect_yaml_directories_in_the_programs_hierarchy # # Commandline usage example: # # raction purge_incorrect_yaml_directories_in_the_programs_hierarchy # # ======================================================================= # when :purge_incorrect_yaml_directories_in_the_programs_hierarchy, :PurgeIncorrectYamlDirectoriesInTheProgramsHierarchy require 'rbt/utility_scripts/purge_incorrect_yaml_directories_in_the_programs_hierarchy.rb' RBT::PurgeIncorrectYamlDirectoriesInTheProgramsHierarchy.new(_, &block) # ======================================================================= # # === :binary_name_belongs_to_which_program # ======================================================================= # when :binary_name_belongs_to_which_program, :BinaryNameBelongsToWhichProgram require 'rbt/utility_scripts/binary_name_belongs_to_which_program.rb' RBT::BinaryNameBelongsToWhichProgram.new(_, &block) # ======================================================================= # # === :check_for_gnome_updates # ======================================================================= # when :check_for_gnome_updates, :CheckForGnomeUpdates require 'rbt/check_for_updates/check_for_gnome_updates.rb' RBT::Cookbooks::CheckForGnomeUpdates.new(_, &block) # ======================================================================= # # === :register_program_files_into_yaml_database # ======================================================================= # when :register_program_files_into_yaml_database, :RegisterProgramFilesIntoYamlDatabase require 'rbt/utility_scripts/register_program_files_into_yaml_database.rb' RBT.register_program_files_into_yaml_database(_, &block) # ======================================================================= # # === :colour_make_install # ======================================================================= # when :colour_make_install, :ColourMakeInstall require 'rbt/make/colour_make_install.rb' RBT.colour_make_install(_) # ======================================================================= # # === :filter_for_valid_program_names # # Here we will modify e. g. "htop.yml" towards "htop" or "hto" towards # "htop". # ======================================================================= # when :filter_for_valid_program_names, :main_filter, :sanitize_this_program_name require 'rbt/actions/individual_actions/filter_for_valid_program_names/filter_for_valid_program_names.rb' return RBT.filter_for_valid_program_names(_) # ======================================================================= # # === :show_how_many_files_are_tracked # # Invocation example from the commandline: # # raction show_how_many_files_are_tracked # # ======================================================================= # when :show_how_many_files_are_tracked, :ShowHowManyFilesAreTracked require 'rbt/actions/individual_actions/statistics/show_how_many_files_are_tracked.rb' RBT.show_how_many_files_are_tracked # ======================================================================= # # === :compile_strategies # # Invocation example from the commandline: # # raction compile_strategies # # ======================================================================= # when :compile_strategies, :CompileStrategies, :report_the_compile_strategies, :ReportTheCompileStrategies require 'rbt/actions/individual_actions/statistics/compile_strategies.rb' RBT.report_the_compile_strategies # ======================================================================= # # === :show_compile_time_statistics # # Invocation example from the commandline: # # raction show_compile_time_statistics # # ======================================================================= # when :show_compile_time_statistics, :ShowCompileTimeStatistics require 'rbt/actions/individual_actions/statistics/show_compile_time_statistics.rb' RBT.show_compile_time_statistics # ======================================================================= # # === :return_compile_time_statistics # # Commandline usage example: # # raction return_compile_time_statistics # # ======================================================================= # when :return_compile_time_statistics, :ReturnCompileTimeStatistics require 'rbt/actions/individual_actions/statistics/return_compile_time_statistics.rb' pp RBT.return_compile_time_statistics # ======================================================================= # # === :apply_sed_operations # ======================================================================= # when :apply_sed_operations, :ApplySedOperations require 'rbt/utility_scripts/apply_sed_operations.rb' RBT.apply_sed_operations(_) # ======================================================================= # # === :local_check_for_latest # # Commandline usage example: # # raction local_check_for_latest # # ======================================================================= # when :local_check_for_latest, :LocalCheckForLatest require 'rbt/cookbooks/local_check_for_latest/local_check_for_latest.rb' RBT.local_check_for_latest # ======================================================================= # # === :create_and_populate_pkgconfig_directory # # Commandline invocation example: # # raction create_and_populate_pkgconfig_directory # # ======================================================================= # when :create_and_populate_pkgconfig_directory, :CreateAndPopulatePkgconfigDirectory, :consider_creating_and_populating_the_pkgconfig_directory, :ConsiderCreatingAndPopulatingThePkgconfigDirectory require 'rbt/misc/create_and_populate_pkgconfig_directory.rb' CreateAndPopulatePkgconfigDirectory.new(_) # ======================================================================= # # === :update_entry # ======================================================================= # when :update_entry, :UpdateEntry require 'rbt/requires/require_class_update_entry.rb' RBT::UpdateEntry.new(_, &block) # ======================================================================= # # === :remove_program # ======================================================================= # when :remove_program, :RemoveProgram require 'rbt/utility_scripts/remove_program.rb' RBT.remove_program(_) # ======================================================================= # # === :remove_programs # # This is the plurarl form. # ======================================================================= # when :remove_programs, :RemovePrograms require 'rbt/utility_scripts/remove_programs/remove_programs.rb' RBT.remove_programs # ======================================================================= # # === :return_xfce_version # ======================================================================= # when :return_xfce_version require 'rbt/toplevel_methods/try_to_return_a_special_compile_component.rb' # ======================================================================= # # === :report_xfce_version # # Commandline invocation example: # # raction xfce_version # raction xfce? # # ======================================================================= # when :report_xfce_version, :xfce_version, :xfce? require 'rbt/actions/individual_actions/information/report_xfce_version.rb' RBT.report_xfce_version # ======================================================================= # # === :highest # # Usage example: # # action(:highest) # # Commandline invocation example: # # raction highest 55 # # ======================================================================= # when :highest require 'rbt/actions/individual_actions/information/highest.rb' RBT.highest(_) # ======================================================================= # # === :create_dependencies_file # # This entry point is specifically for GoboLinux, allowing the user # to create a dependencies file. # ======================================================================= # when :create_dependencies_file, :CreateDependenciesFile require 'rbt/linux/gobolinux/create_dependencies_file.rb' create_dependencies_file = RBT::Linux::Gobolinux::CreateDependenciesFile.new( _[0], _[1], :dont_run_yet ) create_dependencies_file.allow_creation_of_resources create_dependencies_file.run # Finally, run it. # ======================================================================= # # === :show_dependencies_of # ======================================================================= # when :show_dependencies_of require 'rbt/cookbooks/show_dependencies_of.rb' RBT.show_dependencies_of(_) # ======================================================================= # # === :update_kde_porting_aids # ======================================================================= # when :update_kde_porting_aids, :UpdateKdePortingAids require 'rbt/check_for_updates/update_kde_porting_aids.rb' RBT.update_kde_porting_aids # ======================================================================= # # === :update_kde_apps # ======================================================================= # when :update_kde_apps, :UpdateKdeApps, :update_kde_application, :UpdateKdeApplication, :update_kde_applications, :UpdateKdeApplications require 'rbt/check_for_updates/update_kde_applications.rb' RBT.update_kde_applications # ======================================================================= # # === :update_kde_framework # ======================================================================= # when :update_kde_framework require 'rbt/check_for_updates/update_kde_framework.rb' RBT.update_kde_framework # ======================================================================= # # === :missing_use_this_build_system_entry # # Commandline usage example: # # raction missing_use_this_build_system_entry # # ======================================================================= # when :missing_use_this_build_system_entry, :missing_build_system, :MissingBuildSystem require 'rbt/checks_and_validations/missing_use_this_build_system_entry.rb' RBT.missing_use_this_build_system_entry # ======================================================================= # # === :update_all_ruby_gems # ======================================================================= # when :update_all_ruby_gems, :check_for_new_release_on_rubygems, :check_for_new_releases_on_rubygems require 'rbt/check_for_updates/check_for_new_release_on_rubygems.rb' RBT.update_all_ruby_gems # ======================================================================= # # === :check_for_existing_source_directories # ======================================================================= # when :check_for_existing_source_directories, :CheckForExistingSourceDirectories require 'rbt/cookbooks/check_for_existing_source_directories.rb' RBT.check_if_source_directories_exist # ======================================================================= # # === :try_to_return_a_special_compile_component # # rbt_action try_to_return_a_special_compile_component # # ======================================================================= # when :try_to_return_a_special_compile_component, :TryToReturnASpecialCompileComponent require 'rbt/toplevel_methods/try_to_return_a_special_compile_component.rb' RBT.try_to_return_a_special_compile_component(_) # ======================================================================= # # === :generate_shell_completion # ======================================================================= # when :generate_shell_completion, :GenerateShellCompletion require 'rbt/generate_files/generate_shell_completion.rb' RBT.generate_shell_completion(_) # ======================================================================= # # === :symlink_all_upcased_programs_to_downcased_variants # ======================================================================= # when :symlink_all_upcased_programs_to_downcased_variants, :SymlinkAllUpcasedProgramsToDowncasedVariants require 'rbt/utility_scripts/symlink_all_upcased_programs_to_downcased_variants.rb' RBT::SymlinkAllUpcasedProgramsToDowncasedVariants.new # ======================================================================= # # === :package_rbt_scripts # ======================================================================= # when :package_rbt_scripts, :PackageRbtScripts require 'rbt/utility_scripts/package_rbt_scripts.rb' RBT::PackageRbtScripts.new # ======================================================================= # # === :sed_wrapper # ======================================================================= # when :sed_wrapper, :SedWrapper require 'rbt/actions/individual_actions/sed_wrapper/sed_wrapper.rb' RBT.sed_wrapper(_) # ======================================================================= # # === :report_how_many_binaries_are_registered # # Commandline invocation example: # # raction report_how_many_binaries_are_registered # # ======================================================================= # when :report_how_many_binaries_are_registered require 'rbt/toplevel_methods/report_how_many_binaries_are_registered.rb' RBT.report_how_many_binaries_are_registered # ======================================================================= # # === :search_for_tags # ======================================================================= # when :search_for_tags, :SearchForTags, :stag require 'rbt/requires/require_search_for_tags.rb' RBT.search_for_tags(_) # ======================================================================= # # === :remove_all_symlinks # ======================================================================= # when :remove_all_symlinks, :RemoveAllSymlinks require 'rbt/utility_scripts/remove_all_symlinks.rb' RemoveAllSymlinks.new # ======================================================================= # # === :url_new # ======================================================================= # when :url_new require 'rbt/cookbooks/url/url.rb' RBT::Cookbooks::Url.new(_) # ======================================================================= # # === :url # ======================================================================= # when :url require 'rbt/cookbooks/url/url.rb' RBT.return_url1_of_this_program(_) # ======================================================================= # # === :create_shell_script_containing_these_program_versions # ======================================================================= # when :create_shell_script_containing_these_program_versions, :generate_a_big_shell_script require 'rbt/shell/create_shell_script_containing_these_program_versions.rb' RBT.create_shell_script_containing_these_program_versions # ======================================================================= # # === :create_shell_scripts # ======================================================================= # when :create_shell_scripts, :create_bash_scripts, :to_bash, :CreateBashScripts require 'rbt/generate_files/create_bash_scripts.rb' RBT::CreateBashScripts.new # bl $RBT/create_bash_scripts.rb # ======================================================================= # # === :register_everything # # Commandline invocation example: # # raction register_everything # # ======================================================================= # when :register_everything, :RegisterEverything require 'rbt/registered/register_everything.rb' RBT.register_everything # ======================================================================= # # === :show_all_about # # Usage example: # # RBT.action(:show_all_about, 'ruby') # # Commandline invocation example: # # raction show_all_about ruby # # ======================================================================= # when :show_all_about, :ShowAllAbout require 'rbt/actions/individual_actions/information/show_all_about.rb' RBT.show_all_about(_) # ======================================================================= # # === :remove_libtool_files # # Invocation example: # # raction remove_libtool_files kde5_plasma # # ======================================================================= # when :remove_libtool_files, :delete_libtool_files require 'rbt/libtool/remove_libtool_files/remove_libtool_files.rb' RBT.remove_libtool_files(_) # ======================================================================= # # === :expanded_cookbooks # # raction expanded_cookbooks htop # # ======================================================================= # when :expanded_cookbooks, :ExpandedCookbooks, :expanded require 'rbt/actions/individual_actions/cookbooks/expanded_cookbook/expanded_cookbook.rb' pp RBT.expanded_cookbook(_).dataset? # ======================================================================= # # === :aggregate_information_from_the_expanded_cookbooks # # Commandline invocation example: # # raction aggregate # # ======================================================================= # when :aggregate_information_from_the_expanded_cookbooks, :aggregate require 'rbt/actions/individual_actions/information/aggregate_information_from_the_expanded_cookbooks.rb' RBT.aggregate_information_from_the_expanded_cookbooks(_) # ======================================================================= # # === :scan_source_archive # ======================================================================= # when :scan_source_archive, :ScanSourceArchive require 'rbt/cookbooks/scan_source_archive/scan_source_archive.rb' RBT.scan_source_archive # ======================================================================= # # === :report_the_registered_programs # # Invocation example from the commandline: # # raction report_the_registered_programs # # ======================================================================= # when :report_the_registered_programs, :ReportTheRegisteredPrograms require 'rbt/utility_scripts/report_the_registered_programs.rb' RBT.report_the_registered_programs # ======================================================================= # # === :feedback_licenses # # Commandline usage example: # # raction feedback_licenses # # ======================================================================= # when :feedback_licenses, :feedback_licences, :FeedbackLicenses, :FeedbackLicences require 'rbt/cookbooks/feedback_licenses.rb' RBT.feedback_licenses(_) # bl $RUBY_COOKBOOKS/lib/cookbooks/feedback_licenses.rb # ======================================================================= # # === :scan_for_missing_last_update_entries # ======================================================================= # when :scan_for_missing_last_update_entries, :missing_last_update_entries require 'rbt/checks_and_validations/scan_for_missing_last_update_entries.rb:class' RBT::Cookbooks::ScanForMissingLastUpdateEntries.new # ======================================================================= # # === check_for_mate_desktop_updates # # Commandline invocation example: # # raction check_for_mate_desktop_updates # # ======================================================================= # when :check_for_mate_desktop_updates, :CheckForMateDesktopUpdates, :mate_updates require 'rbt/check_for_updates/check_for_mate_desktop_updates.rb' RBT.check_for_mate_desktop_updates # ======================================================================= # # === :show_all_statistics # # Usage example: # # RBT.action(:show_all_statistics) # # Commandline invocation example: # # raction show_all_statistics # # ======================================================================= # when :show_all_statistics, :ShowAllStatistics, :show_statistics, :ShowStatistics require 'rbt/actions/individual_actions/statistics/show_all_statistics.rb' RBT.show_all_statistics # ======================================================================= # # === :display_barplot_statistics # # Usage example: # # action(:display_barplot_statistics) # # Invocation example from the commandline: # # raction display_barplot_statistics # # ======================================================================= # when :display_barplot_statistics require 'rbt/actions/individual_actions/statistics/display_barplot_statistics.rb' RBT.display_barplot_statistics # ======================================================================= # # === :uninstall # ======================================================================= # when :uninstall require 'rbt/utility_scripts/uninstall.rb' RBT.uninstall(_) # ======================================================================= # # === :what_could_become_an_app_dir # ======================================================================= # when :what_could_become_an_app_dir require 'rbt/utility_scripts/what_could_become_an_app_dir.rb' RBT.what_could_become_an_app_dir # ======================================================================= # # === :run_configure # # Usage example: # # RBT.action(:run_configure, :htop) # # ======================================================================= # when :run_configure, :configure require 'rbt/actions/individual_actions/configure/configure.rb' RBT::Actions::Configure.new(_) # ======================================================================= # # === :run_configure # # This will really just run "./configure" basically. # # Usage example: # # RBT.installer(:htop) # # ======================================================================= # when :simple_run_configure, :simple_configure yielded = nil if block_given? yielded = yield end cmd = "./configure #{_}" case yielded # ===================================================================== # # === :colourize_and_padded # ===================================================================== # when :colourize_and_padded, :colourized_and_padded e e steelblue(cmd) e system cmd # ===================================================================== # # === :colourized # ===================================================================== # when :colourized, :colourize e steelblue(cmd) system cmd else # else without colours. esystem cmd end # ======================================================================= # # === :all_urls # ======================================================================= # when :all_urls, :all_URLs require 'rbt/cookbooks/all_urls/all_urls.rb' RBT.all_urls(_) # ======================================================================= # # === :create_registered_tags # # Commandline usage example: # # raction create_registered_tags # # ======================================================================= # when :create_registered_tags, :CreateRegisteredTags require 'rbt/registered/registered_tags.rb' RBT.create_registered_tags # ======================================================================= # # === :feedback_description_of # # Commandline usage example: # # raction feedback_description_of ruby # # ======================================================================= # when :feedback_description_of require 'rbt/actions/individual_actions/information/feedback_description_of.rb' RBT.feedback_description_of(_) # ======================================================================= # # === :feedback_program_description # # This entry point will quickly show the description of the given # program, onto the commandline. # # Commandline usage example: # # raction feedback_program_description ruby # # ======================================================================= # when :feedback_program_description require 'rbt/toplevel_methods/feedback_program_description.rb' RBT.feedback_program_description(_) # ======================================================================= # # === :create_cookbook_yaml_file # # Commandline usage example: # # raction create_cookbook_yaml_file libxml2 # # ======================================================================= # when :create_cookbook_yaml_file, :create_new_cookbook, :create_a_new_cookbook require 'rbt/cookbooks/create_cookbook_yaml_file/create_cookbook_yaml_file.rb' RBT.create_cookbook_yaml_file(_) # ======================================================================= # # === :update_tags # # This entry point will update the registered tags. # ======================================================================= # when :update_tags, :registered_tags require 'rbt/registered/registered_tags.rb' RBT::RegisteredTags.new # ======================================================================= # # === :chained_programs # ======================================================================= # when :chained_programs require 'rbt/constants/constants.rb' return RBT.chained_programs? # ======================================================================= # # === :url_action # ======================================================================= # when :url_action require 'rbt/url_action/url_action.rb' RBT::UrlAction[_] # ======================================================================= # # === :dual_compile # ======================================================================= # when :dual_compile require 'rbt/toplevel_methods/dual_compile.rb' RBT.dual_compile(_) # ======================================================================= # # === :custom_toolchain # ======================================================================= # when :custom_toolchain require 'rbt/requires/require_the_installer_class.rb' RBT::Action::Installer.new(_) # ======================================================================= # # === :chroot_compile # ======================================================================= # when :chroot_compile require 'rbt/toplevel_methods/chroot_and_chown_related_code.rb' RBT.chroot_compile(_) # ======================================================================= # # === :uchroot_compile # ======================================================================= # when :uchroot_compile require 'rbt/toplevel_methods/toplevel_methods.rb' RBT.uchroot_compile(_) # uchroot nasm bison # ======================================================================= # # === :generate_all_slack_desc_files # # This action allows the user to batch-create all slack-desc files. # ======================================================================= # when :generate_all_slack_desc_files require 'rbt/requires/require_the_installer_class.rb' _ = RBT::Action::Installer.new(:dont_run_yet) target = "#{rbt_log_directory?}slackware_desc_files/" opnn; mkdir(target, :be_verbose) cd target RBT.all_programs?.each {|entry| _.generate_slack_desc_file_for_this_program(entry) } # ======================================================================= # # === :trad # ======================================================================= # when :trad, :traditional require 'rbt/utility_scripts/compile_in_traditional_manner.rb' RBT::CompileInTraditionalManner.new(_) # ======================================================================= # # === :report_where_the_source_directory_can_be_found # ======================================================================= # when :report_where_the_source_directory_can_be_found, :report_base_directory, :report_archive_directory e "#{rev}The directory for source archives can be found at:" e e " #{sdir(RBT.source_directory?)}" e # ======================================================================= # # === :report_host_cpu # ======================================================================= # when :report_host_cpu e "#{rev}The host system (CPU) in use is: "\ "#{sfancy(host_cpu?)}" # ======================================================================= # # === :manual_steps # ======================================================================= # when :manual_steps require 'rbt/requires/require_the_installer_class.rb' compile_this_program = _.first compile_object = RBT::Action::Installer.new(compile_this_program, :do_not_run_yet) compile_object.set_compile_this_program(compile_this_program) compile_object.menu('--manual-steps') compile_object.run # ======================================================================= # # === :find_all_archive_types # ======================================================================= # when :find_all_archive_types require 'rbt/cookbooks/find_all_archive_types.rb' RBT::Cookbooks::FindAllArchiveTypes.new(_).show_results # ======================================================================= # # === :beautify_configure_help_output # ======================================================================= # when :beautify_configure_help_output require 'rbt/utility_scripts/beautify_configure_help_output.rb' RBT::BeautifyConfigureHelpOutput.new(_) # ======================================================================= # # === :colour_make # ======================================================================= # when :colour_make require 'rbt/make/make.rb' RBT::Make.new(_) # ======================================================================= # # === :compile_via_appdir_prefix_without_symlinking # ======================================================================= # when :compile_via_appdir_prefix_without_symlinking require 'rbt/toplevel_methods/compile_via_appdir_prefix_without_symlinking.rb' RBT.compile_via_appdir_prefix_without_symlinking(_) # ======================================================================= # # === :feedback_all_available_formats # ======================================================================= # when :feedback_all_available_formats require 'rbt/cookbooks/sanitize_cookbook/misc.rb' RBT::Cookbooks::SanitizeCookbook.feedback_all_available_formats # ======================================================================= # # === :create_snapcraft_file # ======================================================================= # when :create_snapcraft_file require 'rbt/cookbooks/create_snapcraft_file.rb' RBT::Cookbooks::CreateSnapcraftFile.new(_) # ======================================================================= # # === :extra_information # ======================================================================= # when :extra_information require 'rbt/utility_scripts/extra_information.rb' RBT::ExtraInformation.show(_) # ======================================================================= # # === :autoupdate_this_program # ======================================================================= # when :autoupdate_this_program require 'rbt/utility_scripts/autoupdate_this_program.rb' RBT::AutoupdateThisProgram.new(_) # ======================================================================= # # === :autosymlink # ======================================================================= # when :autosymlink require 'rbt/utility_scripts/autosymlink.rb' RBT::Autosymlink.new(_) # ======================================================================= # # === :compile_these_programs # # Invocation example: # # compile_these_programs php python # # ======================================================================= # when :compile_these_programs require 'rbt/requires/require_the_installer_class.rb' if _.is_a?(String) and _.include?(' ') _ = optional_argument1.split(' ') end _.each {|entry| RBT::Action::Installer.new(entry) } # ======================================================================= # # === :compile_into_home_dir # ======================================================================= # when :compile_into_home_dir, :home_dir require 'rbt/utility_scripts/compile_into_home_dir.rb' RBT::CompileIntoHomeDir.new(_) # ======================================================================= # # === :home_dir_without_symlinking # ======================================================================= # when :home_dir_without_symlinking, :home_dir_without_symlink require 'rbt/utility_scripts/compile_into_home_dir_without_symlinking.rb' RBT::CompileIntoHomeDirWithoutSymlinking.new(_) # ======================================================================= # # === :parse_help # ======================================================================= # when :parse_help, :parse_configure_help require 'rbt/utility_scripts/parse_configure_help.rb' RBT::ParseConfigureHelp.new(_) # ======================================================================= # # === :query_file_association # ======================================================================= # when :query_file_association require 'rbt/utility_scripts/query_file_association.rb' RBT::QueryFileAssociation.new(_) # ======================================================================= # # === :make # ======================================================================= # when :make require 'rbt/make/make.rb' RBT::Make.new(_).run # ======================================================================= # # === :show_versions_of_these_programs # # Usage example: # # show_versions_of_these_programs htop php ruby # # ======================================================================= # when :show_versions_of_these_programs require 'rbt/utility_scripts/show_versions_of_these_programs.rb' RBT::ShowVersionsOfThesePrograms.new(_) # ======================================================================= # # === :toolchain # ======================================================================= # when :toolchain require 'rbt/utility_scripts/toolchain.rb' RBT::Toolchain.new(_) # ======================================================================= # # === :chainer # ======================================================================= # when :chainer require 'rbt/utility_scripts/chainer.rb' RBT::Chainer.new(_) # ======================================================================= # # === :check_for_binary_duplicates # ======================================================================= # when :check_for_binary_duplicates require 'rbt/toplevel_methods/check_for_binary_duplicates.rb' RBT.check_for_binary_duplicates # ======================================================================= # # === :create_programs_url_file # ======================================================================= # when :create_programs_url_file require 'rbt/actions/individual_actions/information/create_program_version_url_file.rb' RBT.create_programs_url_file # ======================================================================= # # === :create_log_directory # # This entry point can be used to create a new default log # directory for the RBT gem. # ======================================================================= # when :create_log_directory, :log_directory require 'rbt/toplevel_methods/files_and_directories_related_methods.rb' RBT.create_log_directory # ======================================================================= # # === :report_total_size_of_all_archives # # Invocation example: # # raction report_total_size_of_all_archives # # ======================================================================= # when :report_total_size_of_all_archives require 'rbt/toplevel_methods/archive_related_code.rb' RBT.report_total_size_of_all_archives # ======================================================================= # # === :create_html_page_for_these_programs # # Invocation example: # # create_html_page_for_these_programs php ruby libx11 zlib # # ======================================================================= # when :create_html_page_for_these_programs require 'rbt/toplevel_methods/html.rb' _ = _ if _.is_a?(String) and _.include?(' ') _ = _.split(' ') end RBT.create_html_page_for_these_programs(_) # ======================================================================= # # === :create_programs_version_html_file # # Commandline invocation example: # # raction create_programs_version_html_file # # ======================================================================= # when :create_programs_version_html_file require 'rbt/toplevel_methods/html.rb' RBT.create_programs_version_html_file # ======================================================================= # # === :find_url_for # ======================================================================= # when :find_url_for require 'rbt/toplevel_methods/url.rb' RBT.find_url_for(_) # ======================================================================= # # === :find_likely_directory # ======================================================================= # when :find_likely_directory require 'rbt/actions/individual_actions/find_likely_directory/find_likely_directory.rb' RBT.find_likely_directory(_) # ======================================================================= # # === :binary_of # ======================================================================= # when :binary_of require 'rbt/utility_scripts/binary_name_belongs_to_which_program.rb' RBT::BinaryNameBelongsToWhichProgram.new(_) # ======================================================================= # # === :headers # ======================================================================= # when :headers require 'rbt/actions/individual_actions/headers/headers.rb' RBT.headers(ARGV).report # ======================================================================= # # === :remove_symlinks # ======================================================================= # when :remove_symlinks require 'rbt/utility_scripts/remove_symlinks.rb' RBT::RemoveSymlinks.new(_) # ======================================================================= # # === :show_available_tags # ======================================================================= # when :show_available_tags require 'rbt/toplevel_methods/show_available_tags.rb' RBT.show_available_tags(:default, :be_quiet) # ======================================================================= # # === :download # ======================================================================= # when :download, :rbt_download # A necessary "alias". require 'rbt/toplevel_methods/download.rb' RBT.download(_) # ======================================================================= # # === :libtool # ======================================================================= # when :libtool require 'rbt/libtool/libtool.rb' RBT.libtool(_) # ======================================================================= # # === :gather_information # ======================================================================= # when :gather_information require 'rbt/actions/individual_actions/information/gather_information.rb' RBT.gather_information(_) # ======================================================================= # # === :multi_url_displayer # ======================================================================= # when :multi_url_displayer, :multi_URL_displayer require 'rbt/cookbooks/multi_url_displayer/multi_url_displayer.rb' RBT::Cookbooks::MultiUrlDisplayer.new(_) # ======================================================================= # # === :create_pkgconfig_file # ======================================================================= # when :create_pkgconfig_file require 'rbt/generate_files/create_pkgconfig_file.rb' RBT::CreatePkgconfigFile.new(_) # ======================================================================= # # === :install_this_rubygem # # Usage example: # # RBT.action(:install_this_rubygem, 'path_to_the.gem') # # Commandline invocation example: # # raction install_gem /home/x/src/rails/rails-7.0.1.gem # # ======================================================================= # when :install_this_rubygem, :install_this_gem, :install_gem RBT.install_this_rubygem(_) # ======================================================================= # # === :build_detector # # Commandline invocation example: # # raction build_detector # # ======================================================================= # when :build_detector require 'rbt/utility_scripts/build_detector.rb' RBT::BuildDetector.new(_).report # ======================================================================= # # === :raw_cookbook # # Usage example: # # RBT.action(:raw_cookbook, 'glib') # # ======================================================================= # when :raw_cookbook, :raw require 'rbt/actions/individual_actions/cookbooks/raw_cookbook/raw_cookbook.rb' RBT.raw_cookbook(_, options_hash, &block) # ======================================================================= # # === :check_this_cookbook_file_for_errors # # Commandline invocation example: # # raction check_this_cookbook_file_for_errors ruby # # ======================================================================= # when :check_this_cookbook_file_for_errors require 'rbt/toplevel_methods/check_this_cookbook_file_for_errors.rb' RBT.check_this_cookbook_file_for_errors(_) # ======================================================================= # # === :remove_outdated_archives # # Commandline invocation example: # # raction remove_outdated_archives # # ======================================================================= # when :remove_outdated_archives require 'rbt/utility_scripts/remove_outdated_archives.rb' RBT::RemoveOutdatedArchives.new(_) # ======================================================================= # # === :scookie # ======================================================================= # when :scookie require 'rbt/toplevel_methods/report_extended_information_about_this_program.rb' RBT.report_extended_information_about_this_program(_) # ======================================================================= # # === :find_alternative_archive # # Usage example: # # RBT.action(:find_alternative_archive, '$MY_SRC/gdkpixbuf/gdk-pixbuf') # # Commandline invocation example: # # raction find_alternative_archive $MY_SRC/gdkpixbuf/gdk-pixbuf # # ======================================================================= # when :find_alternative_archive, :alternative_archive, :return_alternative_archive require 'rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb' return RBT.return_alternative_archive(_) # ======================================================================= # # === :generate_programs_version_yaml_file # # Usage example: # # RBT.action(:generate_programs_version_yaml_file) # # Commandline invocation example: # # raction generate_programs_version_yaml_file # # ======================================================================= # when :generate_programs_version_yaml_file require 'rbt/toplevel_methods/generate_programs_version_yaml_file.rb' RBT.generate_programs_version_yaml_file # ======================================================================= # # === :try_to_find_shortcut_for_a_chain_compiled_program # # Usage example: # # RBT.action(:try_to_find_shortcut_for_a_chain_compiled_program, 'kde1') # # Commandline invocation example: # # raction shortcut_to_chain_compiled_program kde1 # # ======================================================================= # when :try_to_find_shortcut_for_a_chain_compiled_program, :shortcut_to_chain_compiled_program require 'rbt/toplevel_methods/try_to_find_shortcut_for_a_chain_compiled_program.rb' e RBT.try_to_find_shortcut_for_a_chain_compiled_program(_) # ======================================================================= # # === :get_all_files_from # # Usage example: # # RBT.action(:get_all_files_from, '/home/x/src/htop/') # # ======================================================================= # when :get_all_files_from RBT.get_all_files_from(_) # ======================================================================= # # === :infer_build_system # # Usage example: # # RBT.action(:infer_build_system) # # Commandline invocation example: # # raction installer php # # ======================================================================= # when :infer_build_system, :infer require 'rbt/actions/individual_actions/infer_build_system/infer_build_system.rb' RBT.infer_then_report_the_build_system(_) # ======================================================================= # # === :fast_return_file_size_of_this_program # # Usage example: # # RBT.action(:fast_return_file_size_of_this_program, 'glib') # # ======================================================================= # when :fast_return_file_size_of_this_program require 'rbt/toplevel_methods/fast_return_file_size_of_this_program.rb' RBT.fast_return_file_size_of_this_program(_, &block) # ======================================================================= # # === :make_app_prefix # ======================================================================= # when :make_app_prefix require 'rbt/toplevel_methods/make_app_prefix.rb' RBT.make_app_prefix(_) # ======================================================================= # # === :check_for_invalid_entries_in_this_cookbook # ======================================================================= # when :check_for_invalid_entries_in_this_cookbook require 'rbt/actions/individual_actions/checks_and_validations/check_for_invalid_entries_in_this_cookbook.rb' RBT::Action::Cookbooks::CheckForInvalidEntriesInThisCookbook.new(_) # ======================================================================= # # === nil # ======================================================================= # when nil e 'Please provide a valid action to the RBT.action() '\ 'method (nil was supplied).' else # else tag e "#{rev}Not a registered action: "\ "#{action_that_is_desired} "\ "(class: #{action_that_is_desired.class})" end end
#¶ ↑
RBT.aggregate_information_from_the_expanded_cookbooks
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/information/aggregate_information_from_the_expanded_cookbooks.rb, line 170 def self.aggregate_information_from_the_expanded_cookbooks( optional_argument1, extract_to = :default ) RBT::Action::AggregateInformationFromTheExpandedCookbooks.new end
#¶ ↑
RBT.are_we_on_gobolinux?
¶ ↑
This method can help us when we wish to determine whether we are on GoboLinux or whether we are not.
Note that this will return a “static” result. If you need a value that is dynamic, you ought to query an instance variable instead.
#¶ ↑
# File lib/rbt/toplevel_methods/gobolinux.rb, line 35 def self.are_we_on_gobolinux? require 'rbt/constants/constants.rb' return_this = false use_this_env_key = 'IS_ON_GOBOLINUX' if ENV.has_key? use_this_env_key if ENV[use_this_env_key].to_s == '1' return_this = true end elsif File.exist? ::RBT.file_is_on_gobolinux return_this = true elsif GOBOLINUX_LAYOUT.to_s == '1' # The constant GOBOLINUX_LAYOUT is a String. return_this = true elsif File.exist?(RBT.file_is_on_gobolinux) and (File.read(RBT.file_is_on_gobolinux).strip.to_s == '1') return_this = true elsif is_this_a_real_gobolinux_system? return_this = true end return return_this end
This method will return an Array of all BLFS entries. It will not hold any specific information about the programs that hold these BLFS entries.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/blfs/blfs.rb, line 555 def self.array_all_BLFS_entries array = [] all_yaml_files = Dir["#{cookbook_directory?}*.yml"] content_of_all_yaml_files = all_yaml_files.map {|entry| "#{File.read(entry)}\n" }.join("\n") array = content_of_all_yaml_files.scan( /^ blfs:\n - (.+)$/ # Grab the relevant entries here. ).flatten return array end
#¶ ↑
RBT.array_all_BLFS_entries_attributed
¶ ↑
This method will (silently) return an Array with all entries that have the BLFS tag.
This method is similar to RBT.array_all_BLFS_entries
, but it will also return all BLFS entries associated with the corresponding program name.
This method used grep in the past, but will use Dir[] and .scan() since as of 21.05.2020 instead. This should make it work better on windows specifically, for instance.
The result will look like this:
["libpcap", "https://www.linuxfromscratch.org/blfs/view/svn/basicnet/libpcap.html"], ["xulrunner", "https://www.linuxfromscratch.org/blfs/view/7.5/x/xulrunner.html"],
Usage example:
x = RBT.return_all_blfs_entries; pp x; ''
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/blfs/blfs.rb, line 592 def self.array_all_BLFS_entries_attributed array = [] all_yaml_files = Dir["#{cookbook_directory?}*.yml"] content_of_all_yaml_files = all_yaml_files.map {|entry| "#{File.read(entry)}\n" }.join("\n") array = content_of_all_yaml_files.scan( /^(.+):\n^ blfs:\n - (.+)$/ ) return array end
#¶ ↑
RBT.array_all_rubygems
¶ ↑
This method will return all rubygems, as an Array.
This can then be used in other programs, such as in RBT
to batch-install all rubygems.
#¶ ↑
# File lib/rbt/toplevel_methods/rubygems.rb, line 42 def self.array_all_rubygems # ======================================================================= # # This is a bit hack-ish, but it is also fast. We will scan for entries # that hold the content 'url1:'; and also the substring '.gem' within # that entry. Other entries will be ignored. # ======================================================================= # array = [] # ======================================================================= # # Obtain all .yml files first: # ======================================================================= # all_yaml_files = Dir["#{RBT.individual_cookbooks_directory?}*.yml"] all_yaml_files.each {|path_to_the_yaml_file| name_of_the_program = File.basename(path_to_the_yaml_file.sub(/\.yml$/,'')) dataset_of_the_program = File.read(path_to_the_yaml_file) if dataset_of_the_program =~ /^ url1: .*\.gem$/ # =================================================================== # # In this case we will assume that it is a ruby .gem file, so we # add it into the Array that will be returned. # =================================================================== # array << name_of_the_program end } array.sort # Keep it sorted, for easier reading. end
#¶ ↑
RBT.array_binary_duplicates
¶ ↑
This method will return an Array of all “/usr/bin/” binary duplicates, or from wherever else you wish to get the listing of duplicates. The default target is “/usr/bin/” but you could also pass in the argument “/usr/bin/”, as second argument to this method.
The first argument to this method is the directory where your main binaries should reside at. On GoboLinux-like systems, this will default to ‘/System/Index/bin’.
Invocation example for this method from within ruby code:
array = RBT.array_binary_duplicates
#¶ ↑
# File lib/rbt/toplevel_methods/check_for_binary_duplicates.rb, line 31 def self.array_binary_duplicates( from_this_directory = :default, to = :default ) # ======================================================================= # # The following two case-menus will handle the :default arguments # passed. The default is, on my home system, for '/System/Index/bin/' # as the first argument, and for '/usr/bin/' as the second argument # to this method here. # ======================================================================= # case from_this_directory # ======================================================================= # # === :default # ======================================================================= # when :default from_this_directory = RBT.sysbin_directory? end case to # ======================================================================= # # === :default # ======================================================================= # when :default to = '/usr/bin/' end array = [] Dir["#{from_this_directory}*"].each {|this_file| # Return the Array here. name_of_the_program = File.basename(this_file) target_file = "#{to}#{name_of_the_program}" if File.exist? target_file array << target_file end } return array end
#¶ ↑
RBT.autoswitch_python?
¶ ↑
Whether to autoswitch python or whether to not autoswitch python.
If set to true then RBT
will attempt to switch to another python version, if it is available. It will try to do so only once, though.
#¶ ↑
# File lib/rbt/configuration/configuration.rb, line 174 def self.autoswitch_python? RBT.configuration?.autoswitch_python end
#¶ ↑
RBT.available_programs?
¶ ↑
This method will return an Array of all available (registered or otherwise made known) programs.
By default it will return a list of programs from the given .yml files.
The optional argument allows us to also use abbreviations, if the argument is the Symbol called :include_abbreviations, :include_aliases or :with_aliases. (These symbols are aliases and do the same.)
The reason why this is not enabled by default is primarily because many other files are only interested in the directly registered programs.
The aliases will at first appear in a Hash, with key->value pairs such as:
"gnomewe"=>"gnomeweather"
Obviously we are here only interested in the keys, which is why the code below will use the method .keys().
Keep in mind that whenever you wish to compile one such program, you need to check to which the program may point at.
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 384 def self.available_programs?( extra_arguments = nil ) array = determine_available_programs case extra_arguments # ======================================================================= # # === :include_abbreviations # ======================================================================= # when :include_abbreviations, :include_aliases, :with_aliases, :with_abbreviations keys = @hash_aliases_to_the_available_programs.keys array << keys else if extra_arguments.is_a? Symbol e "Warning - not registered Symbol called :#{extra_arguments.to_s}" end end # ======================================================================= # # The resulting Array that will be returned from this method will # always be sorted and contain only unique entries: # ======================================================================= # array = array.flatten.uniq.sort array # Return the Array finally. end
#¶ ↑
RBT.batch_compile
¶ ↑
This method can be used to batch compile programs.
The second argument to this method controls as to whether we will make use of chained programs or not.
#¶ ↑
# File lib/rbt/toplevel_methods/batch_compile.rb, line 17 def self.batch_compile( i = ARGV, try_to_use_chained_programs = true ) require 'rbt/constants/constants.rb' require 'rbt/requires/require_actions.rb' i = [i].flatten.compact compile_object = action(:Installer) { :do_not_run_yet } i.each {|compile_this_program| if compile_this_program.is_a?(String) and compile_this_program.include?(',') compile_this_program = compile_this_program.split(',').map(&:strip) end # ===================================================================== # # Obtain the Array next that will hold our chained programs. # ===================================================================== # if RBT.chained_programs?.include? compile_this_program and try_to_use_chained_programs compile_this_program = RBT.chained_programs?[compile_this_program] end compile_object.set_compile_these_programs(i) compile_object.run compile_object.reset } end
#¶ ↑
RBT.blfs_instance
¶ ↑
This method will guarantee that a new instance of class Blfs is returned.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/blfs/blfs.rb, line 537 def self.blfs_instance( i = ARGV, &block ) if block_given? return RBT::Action::Cookbooks::Blfs.new(i, &block) else return RBT::Action::Cookbooks::Blfs.new(i) # { :no_colours_be_quiet } end end
#¶ ↑
RBT.build_type?
¶ ↑
This should default to the current directory.
The method will return a Symbol, such as :configure or :cmake.
If the build type can not be determined then :unknown will be returned.
Usage examples:
RBT.build_type? # => :configure RBT.build_type? # => :cmake
#¶ ↑
# File lib/rbt/utility_scripts/build_detector.rb, line 265 def self.build_type? RBT::BuildDetector.build_type? end
#¶ ↑
RBT.chained_programs?
¶ ↑
Simply return the dataset from the yaml file here.
The file that is used here is the file chained_programs.yml, which you can access via:
bl $RSRC/rbt/lib/rbt/yaml/chained_programs.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 694 def self.chained_programs?( i = RBT.file_cookbook_chained_programs ) YAML.load_file(i) end
#¶ ↑
RBT.check_and_report_whether_file_exists
¶ ↑
The first argument to this method must be the path to the archive.
#¶ ↑
# File lib/rbt/toplevel_methods/report_extended_information_about_this_program.rb, line 18 def self.check_and_report_whether_file_exists( i, optional_cookbook_object = nil ) i = i.to_s unless File.exist? i opnn; Colours.ewarn 'This archive does not exist locally, at' opnn; Colours.ewarn " `#{Colours.sfile(i)}#{swarn('`')}" if optional_cookbook_object if optional_cookbook_object.do_not_download? opne 'This is, however had, no problem as it will not' opne 'be downloaded anyway.' end end cliner :lightblue end end
#¶ ↑
RBT.check_for_binary_duplicates
¶ ↑
This method will check for binary duplicates in the directory /usr/bin/.
#¶ ↑
# File lib/rbt/toplevel_methods/check_for_binary_duplicates.rb, line 72 def self.check_for_binary_duplicates array_binary_duplicates.each {|target_file| surrounded_target_file = "`#{target_file}`" colourized_target_file = sfile(surrounded_target_file) padded_and_colourized_target_file = colourized_target_file.ljust(70) e "#{rev}Yes, #{padded_and_colourized_target_file} #{rev}is a duplicate." } end
#¶ ↑
RBT.check_for_faulty_current_symlinks
¶ ↑
This method is mostly an ad-hoc method. It will try to remove entries such as /home/Programs/Libsndfile/Current1.0.31 specifically.
#¶ ↑
# File lib/rbt/checks_and_validations/check_for_faulty_current_symlinks.rb, line 31 def self.check_for_faulty_current_symlinks( in_this_directory ) if in_this_directory.is_a? Array in_this_directory = in_this_directory.first end if in_this_directory.nil? in_this_directory = ::RBT.programs_dir? end in_this_directory = in_this_directory.dup in_this_directory << '/' unless in_this_directory.end_with? '/' all_current_symlinks = Dir[in_this_directory+'**/**'].select {|entry| File.symlink?(entry) and entry.include?('/Current') } # ======================================================================= # # Next, distinguish between: # # "/home/Programs/Libsndfile/Current" # # and: # # "/home/Programs/Libsndfile/Current1.0.31" # # ======================================================================= # all_faulty_current_symlinks = all_current_symlinks.select {|entry| last_char = entry[-1, 1] (last_char =~ /\d+/) } if all_faulty_current_symlinks.empty? opn(namespace: 'RBT'); e 'No faulty symlinks were found.' opn(namespace: 'RBT'); e 'The directory that was checked was `'+ ::Colours.sdir(in_this_directory)+ rev+'`.' else opne 'Faulty symlinks were found. These will be removed next.' all_faulty_current_symlinks.each {|entry| opne 'Next removing the faulty symlink at '+entry+'.' remove_symlink(entry) } end end
#¶ ↑
RBT.check_for_invalid_entries_in_this_cookbook
¶ ↑
This method will also check for invalid entries in the given cookbook .yml file.
#¶ ↑
# File lib/rbt/actions/individual_actions/checks_and_validations/check_for_invalid_entries_in_this_cookbook.rb, line 432 def self.check_for_invalid_entries_in_this_cookbook( i = ARGV, &block ) return RBT::Action::Cookbooks::CheckForInvalidEntriesInThisCookbook.new(i, :do_not_run_yet, &block) end
#¶ ↑
RBT.check_this_cookbook_file_for_errors
¶ ↑
The first argument should be an existing .yml file holding the dataset that may be faulty.
#¶ ↑
# File lib/rbt/toplevel_methods/check_this_cookbook_file_for_errors.rb, line 60 def self.check_this_cookbook_file_for_errors( this_file = "#{RUBY_SRC_RBT_COOKBOOKS}jasper.yml" ) if this_file.is_a? Array this_file = this_file.first end if this_file.nil? this_file = "#{RUBY_SRC_RBT_COOKBOOKS}jasper.yml" end unless this_file.end_with?('.yml') unless File.exist? '.yml' this_file = project_yaml_dir?+'cookbooks/'+this_file+'.yml' end end if File.exist? this_file registered_cookbook_entries = RBT.registered_cookbook_entries? dataset = YAML.load_file(this_file) key = dataset.keys.first available_entries_from_the_cookbooks_file = dataset[key].keys # ===================================================================== # # Next, obtain the entries that were not registered. Keep in mind # that this Array may be entry. # ===================================================================== # these_entries_were_not_registered = available_entries_from_the_cookbooks_file.reject {|entry| registered_cookbook_entries.include? entry } unless these_entries_were_not_registered.empty? opn; e 'The file at `'+sfile(this_file)+'`' opn; e 'contains at the least one erroneous entry.' these_entries_were_not_registered.each {|this_entry_is_not_included| opn; e 'The entry `'+sfancy(this_entry_is_not_included)+rev+ '` is not registered.' } else opn; e rev+'Everything is fine for the file '+ sfile(this_file)+rev+'.' opn; e "#{rev}It has #{RBT.violet('no incorrect entries')}." end else opn; e "#{rev}No file exists at #{sfile(this_file)}#{rev}." end end
#¶ ↑
RBT.check_whether_this_yaml_file_has_two_url1_entries
¶ ↑
The argument to this method should be the local file path, e. g. “foobar.yml”, as a String. Make
sure that the file exists before calling this method here.
Usage example:
RBT.check_whether_this_yaml_file_has_two_url1_entries('xcbutilerrors.yml')
#¶ ↑
# File lib/rbt/actions/individual_actions/checks_and_validations/check_for_invalid_entries_in_this_cookbook.rb, line 419 def self.check_whether_this_yaml_file_has_two_url1_entries( i = ARGV ) _ = RBT::Action::Cookbooks::CheckForInvalidEntriesInThisCookbook.new(i) { :do_not_run_yet } return _.check_whether_this_yaml_file_has_two_url1_entries(:default, i) end
#¶ ↑
RBT.chmod
(chmod tag)¶ ↑
Use this method to chmod a file or a directory. It also works with several files/directories passed in as Array.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 166 def self.chmod( this_file, permission = 0755 ) if this_file.is_a? Array this_file.each { |file| chmod(file, permission) } else File.chmod(permission.to_i, this_file) end end
#¶ ↑
RBT.chroot_compile
¶ ↑
This method can be used to chroot-compile a given program, that is, to compile it INTO the chroot. The default prefix for that chroot environment will be /usr/. This is currently a hardcoded path.
This is mostly a “hackish” method in that I needed it to quickly compile programs into my main chroot, for when I build it up.
#¶ ↑
# File lib/rbt/toplevel_methods/chroot_and_chown_related_code.rb, line 23 def self.chroot_compile( this_program = ARGV, use_this_as_prefix = '/Depot/Chroot/usr/' # The default prefix target. ) require 'rbt/requires/require_actions.rb' if this_program.is_a? Array this_program.flatten! this_program.compact! this_program.map! {|entry| if entry =~ /^\d+$/ # If it is a number only, such as 1, 2, 3 etc. file_installation_procedure = RBT.file_installation_procedere if File.exist? file_installation_procedure dataset = YAML.load_file(file_installation_procedere)['default'] entry = dataset[entry.to_i - 1] else no_file_exists_at(file_installation_procedure) end end entry } end # ======================================================================= # # Finally delegate towards class RBT::Compile. # ======================================================================= # action(:Installer, program) {{ use_this_as_prefix: use_this_as_prefix }} end
#¶ ↑
RBT.cliner
¶ ↑
This method accepts block-parameters such as :unicode, which will be “converted” into a corresponding horizontal line via a certain unicode block-symbol.
Usage example:
RBT.cliner('_', :steelblue)
#¶ ↑
# File lib/rbt/toplevel_methods/cliner.rb, line 41 def self.cliner( use_this_token = '=', use_this_colour = nil, &block ) case use_this_token # === :do_not_use_colours when :do_not_use_colours use_this_token = '=' use_this_colour = nil # === :default when :default use_this_token = '=' end case use_this_colour when :default use_this_colour = nil end # ======================================================================= # # === Handle blocks given to this method next # ======================================================================= # if block_given? yielded = yield case yielded when :unicode_middle_horizontal_bar begin # ================================================================= # # Fetch the unicode block here. # ================================================================= # require 'roebe/requires/require_unicode.rb' use_this_token = ::Roebe.horizontal_double_bar rescue LoadError end when :unicode begin # ================================================================= # # Fetch the unicode block here. # ================================================================= # require 'roebe/requires/require_unicode.rb' use_this_token = ::Roebe.return_horizontal_unicode_block rescue LoadError end end end if use_this_token.is_a? Hash if use_this_token.has_key? :use_colour use_this_colour = use_this_token[:use_colour] use_this_token = '=' # Restore the default in this case. end end case use_this_token when nil, :default use_this_token = '=' # <- Restore to the default in this case. end if use_this_colour # Support e. g. "konsole_dodgerblue" next. if use_this_colour.is_a?(Symbol) or ( use_this_colour.to_s.start_with?('konsole_dodgerblue') and !use_this_colour.to_s.include?('colour_') ) # ================================================================= # # In this case, rewrite the colour-code a little, such as from # 'konsole_dodgerblue' towards 'konsole_colour_blue'. # ================================================================= # unless use_this_colour.is_a? Symbol use_this_colour = 'konsole_colour_'+use_this_colour.to_s.split('_').last end end e ::Colours.send(use_this_colour, (use_this_token * 80)) else if use_this_token.is_a? Symbol if ::Colours.respond_to?(use_this_token) use_this_token = ::Colours.send(use_this_token, '=') else use_this_token = ::Colours::HtmlColoursMethods.send(use_this_token, '=') end end e (use_this_token * 80) end end
#¶ ↑
RBT.compile
¶ ↑
The first argument should be the name of the program that you wish to compile, such as :htop or ‘htop’.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14836 def self.compile( this_program = nil, optional_arguments = nil ) _ = RBT::Action::SoftwareManager.new(this_program, :do_not_run_already) # ========================================================================= # # Pass any extra arguments into the menu() interface. # ========================================================================= # _.menu(optional_arguments) if optional_arguments _.run end
#¶ ↑
RBT.compile_via_appdir_prefix_without_symlinking
¶ ↑
This method will compile via a versioned AppDir approach, but will not symlink after compilation has finished.
#¶ ↑
# File lib/rbt/toplevel_methods/compile_via_appdir_prefix_without_symlinking.rb, line 15 def self.compile_via_appdir_prefix_without_symlinking(i = ARGV) require 'rbt/requires/require_actions.rb' i = [i].flatten.compact i.each {|this_program| _ = actions(:Installer, this_program) {{ run_already: :do_not_run_yet, symlink_after_compilation_has_finished: false }} _.do_use_an_appdir_prefix _.run } end
#¶ ↑
RBT.compile_via_environment_variable_as_prefix
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/compile_via_environment_variable_as_prefix.rb, line 165 def self.compile_via_environment_variable_as_prefix( compile_these_programs = ARGV, use_this_environment_variable = :default ) RBT::CompileViaEnvironmentVariableAsPrefix.new( compile_these_programs, use_this_environment_variable ) end
#¶ ↑
RBT.configure_appdir_prefix
¶ ↑
This method will return the AppDir prefix, based on the given input, which defaults to the current working directory.
#¶ ↑
# File lib/rbt/toplevel_methods/configure_appdir_prefix.rb, line 53 def self.configure_appdir_prefix( i = return_pwd ) i = i.first if i.is_a? Array if i.nil? or i.empty? i = return_pwd end target = File.basename(i) _ = './configure --prefix='+ return_appdir_prefix(target) e _ end
#¶ ↑
RBT.configure_has_a_higher_priority_than_meson?
¶ ↑
This method will return true if “configure” has a higher priority than “meson”. A yaml file keeps track of these priorities, so if you wish to change the priority, you have to modify the content of that .yml file.
The name of that yaml file:
build_systems_priorities.yml
#¶ ↑
# File lib/rbt/toplevel_methods/configure_has_a_higher_priority_than_meson.rb, line 29 def self.configure_has_a_higher_priority_than_meson?( this_file = RBT.file_build_system_priorities ) array = YAML.load_file(this_file) array.index('configure') < array.index('meson') end
#¶ ↑
RBT.consider_changing_the_tab_title
(shell tag)¶ ↑
Use this method to change the title of a tab in a Terminal like Bash.
# ¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 469 def self.consider_changing_the_tab_title( i = return_program_name_then_hyphen_then_the_program_version, shall_we_rename_the_tab_title = rename_tab_title? ) case shall_we_rename_the_tab_title # ======================================================================= # # === :do_rename_the_tab # ======================================================================= # when :do_rename_the_tab, :do_rename, :default, nil shall_we_rename_the_tab_title = true end # ======================================================================= # # First check whether we ought to rename the tab title or not. # ======================================================================= # if shall_we_rename_the_tab_title case i # ===================================================================== # # === :default # ===================================================================== # when :default # This is the current hardcoded default. May change at a later time. i = return_program_name_then_hyphen_then_the_program_version # ===================================================================== # # === :clear # ===================================================================== # when :clear i = '.' end # ===================================================================== # # Query whether Roebe is available or not. # ===================================================================== # if Object.const_defined?(:Roebe) and shall_we_rename_the_tab_title # Only use it if the user enabled this. if Roebe.respond_to? :rename_konsole_title_to # ================================================================= # # Rename the konsole-title here. # ================================================================= # Roebe.rename_konsole_title_to(i, :be_quiet) else e "The namespace #{sfancy('Roebe')} does not respond to the method" e 'rename_konsole_title_to()' e 'Either the functionality is missing - or something has not' e 'been properly required. Either way, we can not rename the' e 'konsole tab for now.' end end end unless i.empty? end
#¶ ↑
RBT.convert_global_env
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/convert_global_env.rb, line 12 def self.convert_global_env(i) unless Object.const_defined? :ConvertGlobalEnv begin require 'convert_global_env' rescue LoadError; end end i = i.first if i.is_a? Array if Object.const_defined? :ConvertGlobalEnv and i.include?('$') # Assume an ENV variable here. i = ConvertGlobalEnv.convert(i.dup).dup end return i end
#¶ ↑
RBT.copy_recursively
¶ ↑
We can use a call to system(), or the pure ruby version, in order to recursively copy files. But you may not enough information if the pure ruby version is used.
“noop” means “No Op” aka “No Operation”. “No Op” is a dummy task that always completes successfully. It is most often used in a task whose role is to delete files.
The method signature upstream is:
cp_r(src, dest, preserve: nil, noop: nil, verbose: nil, dereference_root: true, remove_destination: nil) (mod_func)
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1326 def self.copy_recursively( what, where_to = '/usr/', be_verbose = false ) if what.is_a? String what << '.' unless what.end_with? '.' end begin ::FileUtils.cp_r( what, where_to )#, # nil, # for preserve # nil, # for noop # be_verbose # for verbose #) rescue Exception => error pp error end end
#¶ ↑
RBT.create_directory
¶ ↑
Internal Wrapper to create a directory.
We will also check if a Dir exists before actually creating it. This is the method of choice for creating a directory. Use it for all the RBT
scripts, whenever you need to create a directory.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 391 def self.create_directory( where = '/Depot/Packages/', use_this_mode = 0755, be_verbose = :be_quiet, do_use_opnn = true, &block ) _yielded = nil # Not currently in use as of Dec 2022. if block_given? _yielded = yield end case use_this_mode when :be_verbose be_verbose = :be_verbose use_this_mode = :default end if where.is_a? Array where.each {|entry| create_directory( entry, use_this_mode, be_verbose, do_use_opnn ) } else if File.directory? where unless where.end_with? '/' # Append a /. where = where.dup if where.frozen? where << '/' end end case use_this_mode when :default # Default value is 0755. use_this_mode = 0755 when Hash if use_this_mode.has_key? :verbosity use_this_mode = use_this_mode.delete(:verbosity) end use_this_mode = 0755 when '', true use_this_mode = 0755 when :be_verbose use_this_mode = 0755 be_verbose = true end # ===================================================================== # # Handle special symbols given to be_verbose. # ===================================================================== # case be_verbose when Hash # =================================================================== # # === :verbosity # =================================================================== # if be_verbose.has_key? :verbosity be_verbose = be_verbose.delete(:verbosity) end # ===================================================================== # # === :be_quiet # ===================================================================== # when :be_quiet, :be_silent be_verbose = false end case do_use_opnn when :do_not_use_opn, :do_not_use_opnn do_use_opnn = false end if File.exist? where if be_verbose opnn if do_use_opnn e "Directory `#{sdir(where)}` already exists, thus" opnn if do_use_opnn e 'skipping creating a new one.' end else if where if be_verbose opnn if do_use_opnn e "Creating the directory `#{sdir(where)}` next." end unless File.directory? where options_hash = { mode: use_this_mode, verbose: false } # =============================================================== # # The variable where can be a String such as # "/home/Programs/Tepl/Current/yaml/". We have # to keep in mind that the mkdir-part may fail, # so a rescue clause has to be used. # =============================================================== # begin FileUtils.mkdir_p(where, **options_hash) rescue Errno::EEXIST e "The directory `#{sdir(where)}` can not be created" e 'as some target, or an incorrect symlink, '\ 'already exists.' end # if be_verbose # opnn if do_use_opnn # e "Can not write into the directory `#{sdir(where)}` "\ # "due to insufficient permissions." # end end else opnn if do_use_opnn; e 'No directory was given.' end end end end
#¶ ↑
RBT.create_html_page_for_these_programs
¶ ↑
This method works on an Array as its input. This Array should be about programs that you want to see an auto-generated webpage containing some information about this program.
#¶ ↑
# File lib/rbt/toplevel_methods/html.rb, line 81 def self.create_html_page_for_these_programs(array = ARGV) if array.is_a?(String) and array.start_with?(':') array = array.to_s.delete(':').to_sym end if array.is_a? Symbol require 'rbt/utility_scripts/search_for_tags/search_for_tags.rb' # ===================================================================== # # Handle special cases such as KDE5. # ===================================================================== # case array # case tag # ===================================================================== # # === cookbooks --create_html_page_for_these_programs=:kde5 # ===================================================================== # when :kde, :kde5 array = RBT.return_all_programs_that_match_this_tag(:kde5) # ===================================================================== # # === cookbooks --create_html_page_for_these_programs=:kde5_toolchain # ===================================================================== # when :kde5_toolchain # =================================================================== # # This variant here should be equivalent to LFS/BLFS, in the proper # order. This thus requires a yaml file. # =================================================================== # dataset = load_yaml(RBT.file_cookbook_chained_programs) array = dataset['kde5_foundation']+ dataset['kde5_plasma']+ dataset['kde5_applications']+ dataset['kde5_porting_aids'] if array.is_a? String # Well ... :) array.delete!(' ') array = array.split(',') end end end if array.is_a? Array if array.first.is_a?(String) and array.first.include?(',') # <- Input such as ["php,kio,ruby"] array = array.first.split(',') end array.flatten! if array.size > 20 opn; e 'More than 20 entries were given (exactly '+ sfancy(array.size.to_s)+'). This may take a while.' end @html_page_content = "<html>".dup begin require 'cyberweb' @html_page_content << Cyberweb.return_unicode_meta rescue LoadError; end @html_page_content << "<head><title>HTML Pages for programs</title>"\ "<style>pre { font-size: 1.4em; }</style>"\ "</head><body><hr>\n".dup # Reset again. array.each_with_index {|this_program, index| index += 1 # =================================================================== # # For each program, we do the same actions: # # (1) Obtain the dataset via Cookbooks::Cookbook.new() OR # from the expanded directory containing all yaml files. # (2) # =================================================================== # if File.directory?(RBT.directory_expanded_cookbooks) and File.exist?(target_file = "#{RBT.directory_expanded_cookbooks}#{this_program}.yml") dataset = load_yaml(target_file) remote_url = dataset['url1'.to_sym] description = dataset['raw_description'.to_sym] licence = dataset['licence'.to_sym] homepage = dataset['homepage'.to_sym].to_s binaries = dataset['binaries'.to_sym] libraries = dataset['libraries'.to_sym] else dataset = action(:SanitizeCookbook, this_program) remote_url = dataset.url1? description = dataset.raw_description? licence = dataset.licence? homepage = dataset.homepage? binaries = dataset.binaries? libraries = dataset.binaries? end if licence.is_a? Array licence = licence.join(', ') end @html_page_content << "<p>\n<h3 style=\"color:darkgreen\"><b style=\"color:darkblue\">"\ "#{index})</b> #{this_program}</h3><br>\n" @html_page_content << " <span style=\"margin-left: 1em; font-weight:bold; color: darkblue\">wget #{remote_url}<span><br><br>\n" unless description.to_s.empty? # <- Ignore empty descriptions. @html_page_content << "<pre>#{description}</pre>\n" end # =================================================================== # # Add the binaries next: # =================================================================== # if binaries and binaries.is_a?(Array) and !binaries.empty? @html_page_content << "Binaries:<br><br>\n" binaries.each {|this_binary| @html_page_content << "<span style=\"margin-left:2em\">→ #{this_binary}<span><br>\n" } @html_page_content << "<br>\n" end # =================================================================== # # Add the libraries next: # =================================================================== # if libraries and libraries.is_a?(Array) and !libraries.empty? @html_page_content << "Libraries:<br><br>\n" libraries.each {|this_binary| @html_page_content << "<span style=\"margin-left:2em\">→ #{this_binary}<span><br>\n" } @html_page_content << "<br>\n" end @html_page_content << "licence: #{licence}<br><br>\n" @html_page_content << "homepage: <a href=\"#{homepage}\">#{homepage}</a><br>\n" @html_page_content << "</p><br><hr>\n" } # ===================================================================== # # Next, store that HTML page somewhere. # ===================================================================== # what = @html_page_content into = "#{log_dir?}programs.html" opn; e "Storing these #{sfancy(array.size)} #{rev}programs into the file:" e e " #{sfile(into)}" e write_what_into(what, into) @html_page_content = ''.dup # Clear it again here. else opn; e 'This method requires an Array as input.' end end
#¶ ↑
RBT.create_log_directory
¶ ↑
This method will create the log directory, e. g. “/tmp/rbt/” or wherever else the user has set this directory to be at.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 204 def self.create_log_directory( _ = log_directory? ) if _ unless !File.directory?(_) opn; e "Creating the directory `#{sdir(_)}` now." FileUtils.mkdir_p(_) else opn; e "The directory at `#{sdir(_)}` already exists." end else opn; e 'No directory could be created as no input was given.' end end
#¶ ↑
RBT.create_program_version_url_file
¶ ↑
The boolean argument that can be passed to this method determines as to whether we will also show the time when the program has been last updated. By default this is true, meaning that we WILL show when a program has been last updated.
To invoke this method from the commandline, do:
rbt --create_program_version_url_file
#¶ ↑
# File lib/rbt/actions/individual_actions/information/create_program_version_url_file.rb, line 248 def self.create_program_version_url_file( also_show_last_update = :default # Since Feb 2018, we will show the last update by default. ) if also_show_last_update and also_show_last_update.is_a?(Array) and also_show_last_update.empty? also_show_last_update = :default end case also_show_last_update # case tag # ========================================================================= # # === :also_show_last_update # ========================================================================= # when :also_show_last_update, :include_last_update, :default also_show_last_update = true end RBT::Action::CreateProgramVersionUrlFile.new {{ show_last_update: also_show_last_update }} end
#¶ ↑
RBT.create_programs_version_html_file
¶ ↑
Commandline
invocation example:
rbt --create_programs_version_html_file
The default input file can be found at:
/Depot/Temp/rbt/CookbookDirectory/programs_version_url.txt
#¶ ↑
# File lib/rbt/toplevel_methods/html.rb, line 31 def self.create_programs_version_html_file( use_this_file = RBT.file_programs_version ) updated_when = "#{RBT.return_date} #{RBT.return_time}" # ======================================================================= # # Generate a .html file. # ======================================================================= # if File.exist? use_this_file if use_this_file.end_with? '.yml' dataset = YAML.load_file(use_this_file) _ = ''.dup dataset.each_pair {|key, value| padded_key = ("#{key}:").ljust(50) _ << " <b>#{padded_key} #{value}</b>\n" } dataset = _ end dataset = '<html><title>Programs of Cookbooks Version: '+RBT.version?+ ' Last updated: '+updated_when+ '</title><body> Last update: <b>'+updated_when+'</b><br> <pre style="font-size: 1.4em">'+ dataset+'</pre></body></html>' # ======================================================================= # # Store that file next: # ======================================================================= # use_this_file = "#{RBT.temp_directory?}programs_version.html" opn; e "Generating a new file at "\ "`#{::Colours.sfile(use_this_file)}#{::Colours.rev}`." write_what_into( dataset, use_this_file ) # Store it here. else no_file_exists_at(use_this_file) end end
#¶ ↑
RBT.create_simple_version_file
¶ ↑
This method has been specifically created to allow the Java bindings in the RBT
project to compile stuff.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 585 def self.create_simple_version_file hash = {} target_directory = RBT.base_dir_to_store_expanded_cookbooks? if File.directory? target_directory all_files = Dir[target_directory+'*.yml'] all_files.each {|this_file| dataset = YAML.load_file(this_file) program_name = dataset[:program_name] program_path = dataset[:program_path] hash[program_name] = program_path } what = hash.map {|key, value| "#{key.downcase}: #{value}\n" }.join into = "#{log_dir?}simple_version_file.md" e "#{rev}Storing into `#{sfile(into)}`." write_what_into(what, into) else e "No directory at #{sdir(target_directory)}." end end
#¶ ↑
RBT.dependency_chain
¶ ↑
This method will calculate the full dependency chain of all given programs.
Usage example:
dependencies = RBT.dependency_chain(%w( php ruby python )) # => ["httpd", "libxml2 >= 2.6.31", "mysql", "sqlite3", and more ...
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 339 def self.dependency_chain(of_this_program = ARGV) array = [] of_this_program = [of_this_program].flatten.compact # ======================================================================= # # Always work on an Array past this point. # ======================================================================= # of_this_program.each {|this_program| target_file = RBT.path_to_expanded_directory?+this_program+'.yml' if File.exist? target_file dataset = YAML.load_file(target_file) deps_on = dataset[:required_deps_on] array << deps_on end } # ======================================================================= # # Now we finished the first iteration. Add another iteration now. # ======================================================================= # new_array = [] array.flatten! array.each {|inner_entry| if inner_entry.include? ' >' inner_entry = inner_entry.split(' >').first end inner_entry = RBT.path_to_expanded_directory?+inner_entry+'.yml' if File.exist? inner_entry dataset = YAML.load_file(inner_entry) deps_on = dataset[:required_deps_on] new_array << deps_on end } new_array.flatten! array << new_array array.flatten! array.uniq! return array end
#¶ ↑
RBT.determine_appdir_prefix_from_this_input
¶ ↑
This method will return a String such as “/Programs/Htop/1.1.1/” or “/home/Programs/Htop/1.1.1/”.
Since as of August 2022, if the input includes a ‘/’ then no modification will be made. This is done primarily for compatibility reasons.
#¶ ↑
# File lib/rbt/toplevel_methods/determine_appdir_prefix_from_this_input.rb, line 29 def self.determine_appdir_prefix_from_this_input( name_of_the_program = 'htop', version_of_the_program = nil ) if name_of_the_program.is_a? Array name_of_the_program = name_of_the_program.first end name_of_the_program = 'htop' if name_of_the_program.nil? if name_of_the_program and name_of_the_program.include?('/') return name_of_the_program # Return it here in this case. end new_prefix = ''.dup # ======================================================================= # # Append the "/Programs/" string next, or whatever else the user # designated as his or her programs-directory: # ======================================================================= # new_prefix << programs_directory? if name_of_the_program.nil? e 'Please supply a valid argument to this method.' e e 'A valid input-argument may be:' e e ' foobar-1.0' e raise 'A program-name (String) is required.' end # ======================================================================= # # === Safeguard against improper versions # ======================================================================= # if version_of_the_program.nil? if name_of_the_program.include?('-') version_of_the_program = ProgramInformation.return_version(name_of_the_program) name_of_the_program = ProgramInformation.return_name(name_of_the_program) else version_of_the_program = 'Current/' end end new_prefix << name_of_the_program.capitalize new_prefix << '/' if version_of_the_program new_prefix << "#{version_of_the_program}/" end return rds(new_prefix) end
#¶ ↑
RBT.determine_appdir_prefix_from_this_input_by_guessing_the_program_version
¶ ↑
This method is similar to the method defined in return_version_of_this_program.rb, but rather than using ‘Current/’ we will assume from the most current version in use of the program at hand (the first argument to this method).
#¶ ↑
# File lib/rbt/toplevel_methods/determine_appdir_prefix_from_this_input_by_guessing_the_program_version.rb, line 19 def self.determine_appdir_prefix_from_this_input_by_guessing_the_program_version( this_program ) require 'rbt/toplevel_methods/return_version_of_this_program.rb' require 'rbt/toplevel_methods/determine_appdir_prefix_from_this_input.rb' use_this_version = RBT.return_version_of_this_program(this_program) return RBT.determine_appdir_prefix_from_this_input(this_program, use_this_version) end
#¶ ↑
RBT.determine_available_programs
¶ ↑
This method will determine how many .yml files exist in the cookbook directory at hand.
Always keep the result (alphabetically) sorted.
Note that if we use a sqlite database then we could use this instead.
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 332 def self.determine_available_programs( load_which_dataset = :default ) case load_which_dataset # ======================================================================= # # === :default # ======================================================================= # when :default, :raw_cookbook_directory target = "#{RBT.cookbook_directory?}*.yml" Dir[target].map {|entry| File.basename(entry.sub(/\.yml$/,'')) }.sort end end
#¶ ↑
RBT.determine_host_architecture
¶ ↑
If you ever want to determine the host architecture, make use of this method here. This method will return a String, containing the host computer’s architecture. (x86_64 essentially means 64 bit binaries)
Invocation example:
RBT.determine_host_architecture # => "x86_64"
#¶ ↑
# File lib/rbt/toplevel_methods/determine_host_architecture.rb, line 23 def self.determine_host_architecture # ======================================================================= # # We use uname to query the host architecture. This will thus # not work on Windows. An alternative would be to use: # RbConfig::CONFIG['host'] # This is now what we will use. # ======================================================================= # # this_architecture = `uname -m`.to_s.chomp this_architecture = RbConfig::CONFIG['host'] if this_architecture.include? '-' this_architecture = this_architecture.split('-').first end return this_architecture end
#¶ ↑
RBT.do_not_show_names?
¶ ↑
This is the reverse complement to RBT.show_the_classname?
.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 165 def self.do_not_show_names? !RBT.show_the_classname? end
#¶ ↑
RBT.does_include_this_binary?
¶ ↑
This will return true if we have a binary with that name.
Usage examples:
RBT.does_include_this_binary? 'xxd' RBT.has_this_binary? 'xzcmp'
#¶ ↑
# File lib/rbt/toplevel_methods/all_binaries.rb, line 69 def self.does_include_this_binary?( i, perform_a_deep_check = false ) all_binaries = all_binaries? # ======================================================================= # # This entry point is for checking input such as "matescreenshot", # which could be "mate-screenshot". Note that as of January 2020 # this is only enabled for binaries - not sure if we need to enable # this for other input-type as well, but binaries make the most # sense. # ======================================================================= # if perform_a_deep_check all_binaries.transform_keys! {|entry| entry.delete('-') } end all_binaries.has_key?(i) end
#¶ ↑
RBT.does_include_this_library?
¶ ↑
This will return true if we have a binary with that name.
Usage example:
RBT.does_include_this_library? 'libc.so' RBT.has_this_library? 'xzcmp' RBT.is_this_library_included? 'xzcmp'
#¶ ↑
# File lib/rbt/toplevel_methods/does_include.rb, line 93 def self.does_include_this_library?(i) all_libraries?.has_key?(i) end
#¶ ↑
RBT.does_this_cookbook_file_have_any_erroneous_entry?
¶ ↑
This method will return a boolen value - true or false.
If true then the cookbook file in question has had an erroneous entry.
#¶ ↑
# File lib/rbt/toplevel_methods/check_this_cookbook_file_for_errors.rb, line 27 def self.does_this_cookbook_file_have_any_erroneous_entry?( this_file = "#{RUBY_SRC_RBT_COOKBOOKS}jasper.yml" ) if this_file.is_a? Array this_file = this_file.first end if this_file.nil? this_file = "#{RUBY_SRC_RBT_COOKBOOKS}jasper.yml" end if File.exist? this_file registered_cookbook_entries = RBT.registered_cookbook_entries? dataset = YAML.load_file(this_file) key = dataset.keys.first available_entries_from_the_cookbooks_file = dataset[key].keys # ===================================================================== # # Next, obtain the entries that were not registered. Keep in mind # that this Array may be entry. # ===================================================================== # these_entries_were_not_registered = available_entries_from_the_cookbooks_file.reject {|entry| registered_cookbook_entries.include? entry } !these_entries_were_not_registered.empty? else false # You have to ensure that the file exists on your own. end end
#¶ ↑
RBT.does_this_file_exist?
¶ ↑
This method will check whether a given file exists or whether it does not.
The second argument can be used to determine whether we shall use a file at a particular position on the filesystem, e. g. like ‘../include/’ that can be passed. This would check for the file at the directory below the current one, within the include/ subdirectory.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 267 def self.does_this_file_exist?( i = FILE_SCONS, prepend_this_for_the_check = nil ) if i.is_a? Array i = i.first end i = i.to_s unless i.is_a? String # We need a String past this point. if prepend_this_for_the_check unless prepend_this_for_the_check.is_a? String if prepend_this_for_the_check == true # ================================================================= # # true values are converted into '../' strings. # ================================================================= # prepend_this_for_the_check = '../'.dup end end i = i.dup.prepend( prepend_this_for_the_check.dup ) end File.exist? i end
#¶ ↑
RBT.does_this_remote_url_exist?
¶ ↑
This method will make use of class Wget to query whether a remote URL exists.
To test this method, try:
i = 'https://github.com/linuxwacom/libwacom/releases/download/libwacom-1.6/libwacom-1.6.tar.bz2' RBT.does_this_remote_url_exist? i
#¶ ↑
# File lib/rbt/toplevel_methods/url.rb, line 132 def self.does_this_remote_url_exist?(i) Wget.check_if_remote_file_exists(i) end
#¶ ↑
RBT.does_this_yaml_file_have_two_url1_entries?
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/checks_and_validations/check_for_invalid_entries_in_this_cookbook.rb, line 403 def self.does_this_yaml_file_have_two_url1_entries?(i) RBT.check_whether_this_yaml_file_has_two_url1_entries(i) == true end
#¶ ↑
RBT.download
¶ ↑
This method can be used to download a remote source archive, if the argument is a symbol. Additionally direct URLs can also be given.
The second argument is optional. If given then the method will attempt to download only a specific version from the remote location. In order for this to work, the method may first have to “probe” whether the remote file exists. For this functionality, wget it used.
In general the method depends on “wget”, largely due to reasons of simplicity.
Invocation examples:
RBT.download :htop RBT.download :php RBT.download :libx11
#¶ ↑
# File lib/rbt/toplevel_methods/download.rb, line 35 def self.download( i = ARGV, optional_use_this_version = nil ) # ======================================================================= # # Treat all input as an Array. # ======================================================================= # i = [i].flatten.compact i.each {|remote_url| # ===================================================================== # # === Handle symbols next # # Symbols will be treated differently, as we can assume that a user # normally would not pass in a Symbol to the method. So if we see # a Symbol, then we can also handle this situation in a special # manner. # ===================================================================== # if remote_url.is_a? Symbol case remote_url # =================================================================== # # === :pwd # =================================================================== # when :pwd # This is special - we will take the dirname. remote_url = File.basename(return_pwd).to_s if Object.const_defined?(ProgramInformation) and (remote_url =~ /\d+/) # ← And if it has at the least one number. remote_url = ProgramInformation.return_short_name(remote_url) end remote_url = remote_url.delete('-').to_sym end # RBT.location_of?() is available in rbt/toplevel_methods/url.rb remote_url = RBT.location_of?(remote_url) # ← This should return an Array. if remote_url.is_a? Array remote_url = remote_url.first end end # ===================================================================== # # Next, honour the situation where the user wants to specifically # download a specific version of a program. # ===================================================================== # if optional_use_this_version if optional_use_this_version.is_a? Hash if optional_use_this_version.has_key? :version optional_use_this_version = optional_use_this_version[:version] end end _ = optional_use_this_version # =================================================================== # # else it does not exist, so we try other archive formats. This # will be handled by the following Array. # =================================================================== # array_formats_to_check_for = %w( .tar.xz .tar.gz .tar.bz2 ) # =================================================================== # # The old URL will already be available in the variable remote_url. # =================================================================== # remote_url = RBT.return_remote_url_from_this_input( remote_url, optional_use_this_version ) require 'wget' if Wget.check_if_remote_file_exists(remote_url) array_formats_to_check_for = [] # Clear it here. else # ================================================================= # # We reject the ones that we already have checked before: # ================================================================= # array_formats_to_check_for.reject! {|entry| remote_url.end_with? entry } unless array_formats_to_check_for.empty? array_formats_to_check_for.each {|inner_entry| if Wget.check_if_remote_file_exists(inner_entry) # =========================================================== # # The next check is not ideal, but it may suffice for now. # After all we only need at the least one remote URl that # can be used. # =========================================================== # remote_url = inner_entry end } end end end if remote_url.empty? e "#{rev}The given #{crimson('URL')} was not found - "\ "thus, no download can occur." else e "#{rev}Next downloading from the remote "\ "URL `#{sfancy(remote_url)}#{rev}`." use_this_command = "wget #{remote_url}" e use_this_command result = `#{use_this_command} 2>&1` if result.include? 'ERROR 404: Not Found' e "#{rev}No archive/program was found at the remote url #{remote_url}." end if File.exist? File.basename(remote_url) e "#{rev}Success! The file can be found at `"\ "#{sfile( File.absolute_path(File.basename(remote_url)) )}#{rev}`." end end } end
#¶ ↑
RBT.dual_compile
¶ ↑
This method will first compile a program in the traditional manner, via the prefix /usr, before it will compile the same program again via its AppDir prefix.
#¶ ↑
# File lib/rbt/toplevel_methods/dual_compile.rb, line 17 def self.dual_compile( this_program = ARGV ) [this_program].flatten.compact.each {|entry| action(:Installer, entry) {{ use_this_prefix: :trad }} # (1) First compilation run. action(:Installer, entry) {{ use_this_prefix: :appdir }} # (2) Second compilation run. } end
#¶ ↑
RBT.enable_module_programs
¶ ↑
This method will be invoked when we require the cookbooks project in a special manner.
We add the individual cookbooks onto the Cookbooks
. namespace directly there.
This will then allow us to call methods such as:
RBT.htop
Do note that we will also radically override already existing methods, so this is functionality that should be used with care.
Testing this method can happen either like this:
RBT.enable_module_programs; RBT.htop require 'rbt/module_programs'; htop = RBT.htop require 'rbt/toplevel_methods/module_programs.rb'; RBT.enable_module_programs; htop = RBT.htop.hash?
#¶ ↑
# File lib/rbt/toplevel_methods/module_programs.rb, line 34 def self.enable_module_programs( also_add_reader_methods = true ) require 'rbt/requires/require_actions.rb' require 'rbt/requires/require_the_cookbook_class.rb' available_programs?.each {|this_program| self.class.class_eval { _ = this_program.to_sym if respond_to? _ # This here happens when we enable the methods. # This is just here as a placeholder, if we ever want # to debug this. else # ::RBT.e 'Defining the method `'+_.to_s+'` next.' # <- This is more o a debug-statement. define_method(_) { # Simply delegate to class Cookbook then. action(:sanitize_cookbook, this_program, :fast) } # ================================================================= # # We will additionally add reader-methods, if the argument is # set to true. These reader methods will directly return the # dataset, as a Hash. # # This can be tested like so in IRB: # # require 'rbt/module_programs'; x = RBT.htop.hash? # # ================================================================= # if also_add_reader_methods define_method("#{_}?") { # Simply delegate to class Cookbook then. action(:sanitize_cookbook, this_program, :fast).hash? } end end } } end
#¶ ↑
RBT.ensure_that_the_required_directories_exist
¶ ↑
This method ensures that the base-directory exists.
This can also be invoked from the commandline, by issuing:
rbt --ensure-that-the-required-directories-exist
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 273 def self.ensure_that_the_required_directories_exist( use_this_as_directory = RBT.store_into_this_directory?, be_verbose = false ) if block_given? yielded = yield case yielded when :be_verbose be_verbose = true when :be_quiet be_verbose = false end end if Dir.exist?(use_this_as_directory) if be_verbose opn; e "The directory at `#{use_this_as_directory}` "\ "already exists." end else target = File.dirname(use_this_as_directory) if File.writable?(target) require 'fileutils' opn; e "Creating directory `#{use_this_as_directory}`." FileUtils.mkdir_p(use_this_as_directory) else e "Can not write into the directory "\ "`#{use_this_as_directory}` as it is not writable. "\ "Consider using" e 'another setting for temp_directory.yml perhaps.' e e 'This file can be found here:' e e " #{file_temp_directory}" e end end end
#¶ ↑
RBT.esystem
¶ ↑
This method will output which system-command will be run; and then this command will be run, via system().
The argument to this method determines the system command at hand.
#¶ ↑
# File lib/rbt/toplevel_methods/e_and_esystem.rb, line 17 def self.esystem( i = '', use_this_colour = nil ) if i.is_a? Array i.each {|entry| esystem(entry) } else if use_this_colour case use_this_colour # =================================================================== # # === :fancy_colours # =================================================================== # when :fancy_colours use_this_colour = :mediumslateblue end e ::Colours.send(use_this_colour, i)+ ::Colours.rev else e i end system i end end
#¶ ↑
RBT.expand_cookbooks
¶ ↑
The first argument to this method should be the program-name whose .yml file we wish to autogenerate, such as ‘subversion’ or ‘htop’ or ‘ruby’.
It will then be expanded to its full, correct dataset.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/expand_cookbooks/expand_cookbooks.rb, line 293 def self.expand_cookbooks( i = ARGV, &block ) return RBT::Action::Cookbooks::ExpandCookbooks.new(i, &block) end
#¶ ↑
RBT.extract
¶ ↑
This toplevel-method can be used to extract an archive, such as “foobar-1.2.3.tar.xz”.
The functionality depends on the gem called extracter, so users have to install that gem - for instance via “gem install extracter”.
The second argument to this method should be the target directory onto which the archive will be extracted to. So, for instance, if the argument is ‘/tmp/’, then the archive will be extracted right into that directory.
Usage examples:
RBT.extract(ARGV) RBT.extract('/tmp/foobar-1.0.tar.xz','/Depot/j/')
#¶ ↑
# File lib/rbt/actions/individual_actions/extract/extract.rb, line 279 def self.extract( optional_argument1, extract_to = :default, # Where to extract the archive at hand. &block ) _ = RBT::Action::Extract.new(:do_not_run_yet, &block) _.set_extract_this_program(optional_argument1) _.invoke_class_extracter(:default_programs, extract_to) return _ end
#¶ ↑
RBT.fast_return_file_size_of_this_program
¶ ↑
This method will quickly return the file size of the given input program. It relies on the expanded cookbook dataset for this.
Invocation example from ruby:
RBT.fast_return_file_size_of_this_program(:htop) # => 213004
#¶ ↑
# File lib/rbt/toplevel_methods/fast_return_file_size_of_this_program.rb, line 26 def self.fast_return_file_size_of_this_program( i, use_this_as_database_backend = :use_the_expanded_cookbooks ) use_this_as_the_key = :archive_size if i.is_a? Array i = i.join(' ').strip end i = i.to_s unless i.is_a? String case use_this_as_database_backend # ======================================================================= # # === :default # # This is the default entry point. We will use the expanded cookbooks. # ======================================================================= # when :default, :use_the_expanded_cookbooks base_dir_to_store_expanded_cookbooks = RBT.base_dir_to_store_expanded_cookbooks? if File.directory? base_dir_to_store_expanded_cookbooks # =================================================================== # # Obtain the path to the expanded-cookbook .yml file next. # =================================================================== # target_file = "#{base_dir_to_store_expanded_cookbooks}#{i}.yml" if File.exist? target_file dataset = YAML.load_file(target_file) archive_size = dataset[use_this_as_the_key] return archive_size else no_file_exists_at(target_file) end else e "#{rev}No directory exists at "\ "#{base_dir_to_store_expanded_cookbooks}" end # ======================================================================= # # === :SQL # # This entry point was added in August 2022, to support sqlite databases. # ======================================================================= # when :SQL, :sql, :use_sqlite unless RBT.const_defined?(:CompileViaSQLDatabase) require 'rbt/requires/require_compile_via_sql_database.rb' end location_of_the_database = RBT::CompileViaSQLDatabase.location_of_the_database? result = `sqlite3 #{location_of_the_database} "select * from REGISTERED_PROGRAMS where PROGRAM_NAME = '#{i}';"` if result.include? '|' splitted = result.split('|') # The stored file size is at position 11. return splitted[11].to_i end end end
#¶ ↑
RBT.feedback_available_programs
¶ ↑
This method will report to the user, in a more verbose manner, which specific programs are registered in the RBT-project.
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 310 def self.feedback_available_programs result = ''.dup # Build up the return String. opn; e "Feedbacking all available programs next,"\ " #{available_programs.size} of them." available_programs?.each_with_index {|entry, index| index += 1 result << "(#{simp(index.to_s.rjust(3))}) #{sfancy(entry)}#{N}" } e result end
#¶ ↑
RBT.feedback_description_of_via_sanitize_cookbook
¶ ↑
Delegate towards the method .feedback_description_of().
Invocation example:
RBT.feedback_description_of(:htop)
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb, line 6344 def self.feedback_description_of_via_sanitize_cookbook(i) i = i.first if i.is_a? Array _ = RBT::Action::Cookbooks::SanitizeCookbook.new(i) _.feedback_description end
#¶ ↑
RBT.feedback_program_description
¶ ↑
This method will feedback the description of the program at hand, on the commandline. By default it will make use of the expanded dataset, by using :fast. If you want to make use of the simple dataset that may have to be sanitized (and thus will be slower), change this to :slow instead.
#¶ ↑
# File lib/rbt/toplevel_methods/feedback_program_description.rb, line 21 def self.feedback_program_description( i = ARGV ) require 'rbt/actions/actions.rb' i = i.first if i.is_a? Array raw_cookbook = action(:raw_cookbook, i) { :use_the_expanded_dataset } hash = raw_cookbook.hash? # ======================================================================= # # Note that the key is a Symbol, at the least since as of May 2022. # ======================================================================= # use_this_key = 'description'.to_sym description = hash[use_this_key] e RBT.wrap_at(description.lstrip, 80) end
#¶ ↑
RBT.file_abbreviations
¶ ↑
Note that this file will store only abbreviations to the programs, not the name of the program at hand.
On my home system this file may reside here:
/home/x/programming/ruby/src/rbt/lib/rbt/yaml/abbreviations_to_the_programs/abbreviations_to_the_programs.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 194 def self.file_abbreviations( project_yaml_directory = RBT.project_yaml_directory? ) "#{project_yaml_directory}"\ "abbreviations_to_the_programs/abbreviations_to_the_programs.yml" end
#¶ ↑
RBT.file_base_template_for_cookbook_yaml_files
¶ ↑
This constant specifies the path to the base-template file that can be used for creating new .yml files, for the RBT::Cookbooks
namespace.
This used to be the constant FILE_BASE_TEMPLATE_FOR_COOKBOOK_YAML_FILES until August 2022.
#¶ ↑
# File lib/rbt/constants/constants.rb, line 836 def self.file_base_template_for_cookbook_yaml_files "#{RBT.project_base_directory?}cookbooks/"\ "template/base_template_for_cookbook_yaml_files.md" end
#¶ ↑
RBT.file_compiled_programs
¶ ↑
This method will return a location such as “/Depot/Temp/rbt/compiled_programs.yml”.
Note that from this you can also obtain the “last compiled program”.
#¶ ↑
# File lib/rbt/configuration/configuration.rb, line 153 def self.file_compiled_programs "#{RBT.rbt_log_directory?}compiled_programs.yml" end
#¶ ↑
RBT.file_cookbook_aliases
¶ ↑
Simply return where the cookbook_aliases.yml file resides.
This is, for instance, here:
/Programs/Ruby/2.5.1/lib/ruby/site_ruby/2.5.0/rbt/yaml/cookbook_aliases.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 642 def self.file_cookbook_aliases "#{RBT.project_yaml_directory?}cookbook_aliases/cookbook_aliases.yml" end
#¶ ↑
RBT.file_cookbook_chained_programs
¶ ↑
This is the preferred way to determine where the file “cookbook_chained_programs.yml” can be found.
On my home system in April 2021, this yielded the following path:
/usr/lib/ruby/site_ruby/3.0.0/rbt/yaml/chained_programs/chained_programs.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 911 def self.file_cookbook_chained_programs "#{RBT.project_yaml_directory?}chained_programs/chained_programs.yml" end
#¶ ↑
RBT.file_is_on_gobolinux
¶ ↑
This file may be generated by RBT
if you issue any of the following commands:
rbt --is-on-gobolinux rbt --isongobolinux rbt isongobolinux
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 944 def self.file_is_on_gobolinux "#{RBT.log_directory?}is_on_gobolinux" end
#¶ ↑
RBT.file_predefined_installation_instructions
¶ ↑
Method to return where the file location is. There used to be a constant available called FILE_PREDEFINED_INSTALLATION_INSTRUCTIONS but this was removed in January 2019.
#¶ ↑
# File lib/rbt/constants/predefined_installation_instructions.rb, line 31 def self.file_predefined_installation_instructions( use_this_directory = RBT.project_yaml_directory? ) "#{use_this_directory}"\ "predefined_installation_instructions/predefined_installation_instructions.yml" end
#¶ ↑
RBT.file_programs_version_url
¶ ↑
This is the path to the .md file that keeps track of the programs-version and URL entries.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 966 def self.file_programs_version_url "#{RBT.log_dir?}CookbookDirectory/programs_version_url.md" end
#¶ ↑
RBT.file_registered_cookbook_entries
¶ ↑
Tell use where the file registered_cookbook_entries.yml is stored.
On my home system this may return a String such as:
/home/Programs/Ruby/2.7.1/lib/ruby/site_ruby/2.7.0/rbt/yaml/specification/registered_cookbook_entries.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 595 def self.file_registered_cookbook_entries( use_this_directory = yaml_directory? ) "#{use_this_directory}specification/registered_cookbook_entries.yml" end
#¶ ↑
RBT.file_source_directory?
¶ ↑
This method may return a path such as:
/home/Programs/Ruby/2.7.1/lib/ruby/site_ruby/2.7.0/rbt/yaml/configuration/configuration/source_directory.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 741 def self.file_source_directory? "#{RBT.configuration_directory?}source_directory.yml" end
#¶ ↑
RBT.file_specification_of_registered_cookbook_entries
¶ ↑
#¶ ↑
# File lib/rbt/constants/constants.rb, line 604 def self.file_specification_of_registered_cookbook_entries( use_this_directory = yaml_directory? ) "#{use_this_directory}specification/specification_of_registered_cookbook_entries.yml" end
#¶ ↑
RBT.file_storing_the_time_it_took_to_compile_programs
¶ ↑
Since as of August 2022 this is now a query-method.
This method can be used to query where the yaml-“database” is kept that contains our compile-times.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 956 def self.file_storing_the_time_it_took_to_compile_programs "#{RBT.log_directory?}database_storing_compile_times.yml" end
#¶ ↑
RBT.file_temp_directory
¶ ↑
This reader method will return the location to the file named “temp_directory.yml”, as a String.
On my system, the method may return a String such as
"/Programs/Ruby/2.5.1/lib/ruby/site_ruby/2.5.0/rbt/yaml/configuration/temp_directory.yml"
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 538 def self.file_temp_directory "#{RBT.configuration_directory?}"\ "temp_directory.yml" end
#¶ ↑
RBT.file_use_colours?
¶ ↑
This method will point to a path such as:
/Programs/Ruby/2.5.1/lib/ruby/site_ruby/2.5.0/rbt/yaml/configuration/use_colours.yml
#¶ ↑
# File lib/rbt/constants/constants.rb, line 557 def self.file_use_colours?( use_this_directory = @configuration_directory ) "#{use_this_directory}use_colours.yml" end
#¶ ↑
RBT.filter_for_valid_program_names
¶ ↑
Invocation examples:
RBT.filter_for_valid_program_names('mate1') # => "matedesktop" RBT.filter_for_valid_program_names('libarch') # => "libarchive"
#¶ ↑
# File lib/rbt/actions/individual_actions/filter_for_valid_program_names/filter_for_valid_program_names.rb, line 152 def self.filter_for_valid_program_names( i = ARGV, &block ) return RBT::Action::FilterForValidProgramNames.new(i, &block).result? end
#¶ ↑
RBT.find_cookbook_alias_for
¶ ↑
This method can be used to find a specific alias for a real, existing (and registered) program of the RBT
suite.
Usage example:
RBT.find_cookbook_alias_for 'perlx'
#¶ ↑
# File lib/rbt/aliases/aliases.rb, line 535 def self.find_cookbook_alias_for(i) RBT::Cookbooks::Aliases.new(i).value? end
#¶ ↑
RBT.find_url_for
¶ ↑
Use this method to find a specific URL quickly.
The method will return the first URL always, also called “url1”.
The method will also try to return url2 - and hence return an Array, if possible. Keep this in mind that you may have an Array as result from this method.
Usage examples:
RBT.find_url_for() RBT.find_url_for(:htop) # => ["http://hisham.hm/htop/releases/2.2.0/htop-2.2.0.tar.gz", "http://hisham.hm/htop/index.php?page=downloads"] RBT.url_for? :patch # => ["https://ftp.gnu.org/pub/gnu/patch/patch-2.7.6.tar.xz", "http://ftp.gnu.org/gnu/patch/?C=M;O=D"]
#¶ ↑
# File lib/rbt/toplevel_methods/url.rb, line 72 def self.find_url_for( i = ARGV, return_as_string = false ) case return_as_string when :return_as_string return_as_string = true end i = i.first if i.is_a? Array i = i.to_s # ======================================================================= # # Next, we will try to use the expanded dataset, if it exists. This # will be MUCH faster than instantiating a new ruby object, as is # done in the else clause. The drawback is that the expanded dataset # may not always have the most-up-to-date content. # ======================================================================= # expanded_file = RBT.return_location_to_this_programs_yaml_file(i) if File.exist? expanded_file if i.end_with? '.yml' i = i.dup if i.frozen? i.sub!(/\.yml$/,'') end dataset = YAML.load_file(expanded_file) if dataset.has_key?(i) dataset = dataset[i] end url1 = dataset['url1'] # Is a String. url2 = dataset['url2'] # Is a String. else # ===================================================================== # # Else we will instantiate a new, costly Cookbook instance. # ===================================================================== # _ = RBT.raw_cookbook(i) url1 = _.url1? # Return the URL here. url2 = _.url2? end url1 = url1.to_s.strip url2 = url2.to_s.strip if return_as_string url1.to_s else return [url1, url2] end end
#¶ ↑
RBT.fix_chown_root_entries_in_this_file
¶ ↑
This method can be used to replace all “chown root:root” entries with “chown 0:0” entries. It may be necessary for when we have setup a chroot.
#¶ ↑
# File lib/rbt/toplevel_methods/chroot_and_chown_related_code.rb, line 59 def self.fix_chown_root_entries_in_this_file( this_file = 'Makefile' ) what = ''.dup if File.exist? this_file File.readlines(this_file).each {|this_entry| if this_entry.include? 'chown root:root' this_entry.gsub!(/root:root/, '0:0') end what << this_entry } e "#{rev}Now modifying the file `#{sfile(this_file)}#{rev}`." write_what_into(what, this_file) end end
#¶ ↑
RBT.fix_incorrect_symlinks
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/check_for_invalid_current_symlinks.rb, line 219 def self.fix_incorrect_symlinks unless Object.const_defined?(:RBT) and RBT.const_defined?(:CheckForInvalidCurrentSymlinks) require 'rbt/utility_scripts/check_for_invalid_current_symlinks.rb' end ::RBT::CheckForInvalidCurrentSymlinks.new('--autocorrect') end
#¶ ↑
RBT.generate_pdf_tutorial_then_upload_it
¶ ↑
Use this method to upload the .pdf tutorial to a remote host.
#¶ ↑
# File lib/rbt/generate_files/generate_pdf_tutorial.rb, line 105 def self.generate_pdf_tutorial_then_upload_it RBT.generate_pdf_tutorial # Next comes the upload part. require 'ftp_paradise/without_gui_bindings' connection = FtpParadise.connect to: :shevy connection.set_to_binary_mode connection.upload_this_file RBT::GeneratePdfTutorial.store_pdf_file_where? end
#¶ ↑
RBT.generate_programs_version_yaml_file
¶ ↑
This method will create one big yaml file that is a Hash. This big Hash will have the name of all programs and the corresponding version of said programs.
The key will be the name of the program and the value will be the respective program version.
You can also pass in your own dataset. If you do so, remember to use a hash, with specific key->value pairs that reflect the name of the program and the specific version of said program.
You can invoke this method from the commandline, by issuing:
rbt --generate_version_file
#¶ ↑
# File lib/rbt/toplevel_methods/generate_programs_version_yaml_file.rb, line 36 def self.generate_programs_version_yaml_file( use_this_dataset = nil ) _ = ''.dup # We will append onto this String. unless use_this_dataset # This is the default behaviour/clause. hash = {} # We store into this hash here. target = RUBY_SRC_DIR_RBT_YAML+ 'programs_version/available_programs_versions.md' if is_on_roebe? e 'Reading in the dataset from this file:' e e sfile(" #{target}") e end unless File.exist? target e 'No file was found at '+sfile(target)+'.' exit end dataset = File.readlines(target) dataset.each {|line| splitted = line.split(' ').map(&:strip) opn; e "Now working on the program "\ "`#{Colours::HtmlColoursMethods.lightgray(splitted[0])}`." # =================================================================== # # Add onto the Hash next. Should keep it as a String. # =================================================================== # hash[splitted[0].downcase] = splitted[1].to_s } use_this_dataset = hash end use_this_dataset.each_pair {|key, value| value = '"'+value.to_s+'"' unless value.include? '"' _ << key.to_s+': '+value.to_s+N } # ======================================================================= # # Ok, now we should have all programs and the respective version # at hand - we can store it next. In the past, this made use of # YAML.dump() but for some strange reason, YAML.dump() gave strange # results; which is why I decided to generate the .yml file # on my own. # ======================================================================= # what = _ into = "#{RBT.yaml_directory?}programs_version/programs_version.yml" opn; e "Will also store into `#{sfile(into)}#{rev}`." write_what_into(what, into) # Store into the file programs_version.yml # ======================================================================= # # Store for my home-system as well. # ======================================================================= # if is_roebe? # On my system. into = "#{RUBY_SRC_DIR_RBT}yaml/programs_version/programs_version.yml" opn; e "Will also store into `#{sfile(into)}#{rev}`." write_what_into(what, into) end end
#¶ ↑
RBT.get_all_directories_from
¶ ↑
This will return all directories.
Invocation example:
RBT.get_all_directories_from('/home/x/src/')
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 247 def self.get_all_directories_from( here = return_pwd, return_full_path = false ) here << '/' unless here.end_with? '/' _ = Dir["#{here}*"] _.select! {|entry| File.directory?(entry) } result = _.map {|entry| "#{entry}/" } if return_full_path result.map! {|line| File.absolute_path(line) } end return result.sort # Keep the result sorted. end
#¶ ↑
RBT.get_all_files_from
¶ ↑
We will only obtain files through this method here.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1278 def self.get_all_files_from( this_dir = return_pwd, return_full_path = true, include_hidden_files = false ) this_dir = return_pwd if this_dir.nil? _ = this_dir.dup _ << '/*' unless _.end_with? '/*' _ = rds(_) # Make use of RBT:rds() here. _ = Dir[_].select {|entry| File.file?(entry) } return _ end
#¶ ↑
RBT.get_date
¶ ↑
As of Sep 2014, this method will return a string such as:
"12 Jan 2015"
#¶ ↑
# File lib/rbt/time/time.rb, line 41 def self.get_date current_day = Time.now.strftime('%d') # This will return a string such as "30". current_day+ ' '+ Date::MONTHNAMES[Date.today.month][0,3]+ # Only obtain the first three letters. ' '+ ::Time.now.strftime('%Y') end
#¶ ↑
RBT.get_extended_date
¶ ↑
This method is similar to RBT.get_date
, but we will not truncate the name of the month. So we may return a String such as “12 January 2023”.
#¶ ↑
# File lib/rbt/time/time.rb, line 56 def self.get_extended_date current_day = Time.now.strftime('%d') # This will return a string such as "30". current_month = Date::MONTHNAMES[Date.today.month] return "#{current_day}"\ " #{current_month}"\ " #{::Time.now.strftime('%Y')}" end
#¶ ↑
RBT.get_files_and_directories_from
¶ ↑
Simply combine RBT.get_all_directories_from
and RBT.get_files_from
via this method here.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 152 def self.get_files_and_directories_from( here = return_pwd ) _ = get_all_directories_from(here)+ get_all_files_from(here) return _.flatten end
#¶ ↑
RBT.gobolinux_naming_convention
¶ ↑
Easier toplevel method for accessing the functionality of class RBT::GobolinuxNamingConvention.
#¶ ↑
# File lib/rbt/linux/gobolinux/gobolinux_naming_convention.rb, line 142 def self.gobolinux_naming_convention(i) i = i.first if i.is_a? Array RBT::Gobolinux::NamingConvention.new(i).translated_name? end
#¶ ↑
RBT.hash_aliases_to_the_available_programs?
¶ ↑
Query method over the available aliases to the given programs. This will include the abbreviations, too.
Usage example:
RBT.hash_aliases_to_the_available_programs?['libxshmfenc'] # => "libxshmfence"
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 128 def self.hash_aliases_to_the_available_programs? @hash_aliases_to_the_available_programs end
#¶ ↑
RBT.hash_registered_binaries?
¶ ↑
This method is similar to the method RBT.registered_binaries?
- but rather than an Array we will return the original Hash.
#¶ ↑
# File lib/rbt/registered/registered_binaries.rb, line 247 def self.hash_registered_binaries? ALL_BINARIES end
#¶ ↑
RBT.home_directory?
¶ ↑
This should default towards /root or the user’s home directory.
For example, for the superuser on a system, this will expand into “/root/” or “/home/debug/”.
The method will ensure that a trailing ‘/’ is part of the result.
#¶ ↑
# File lib/rbt/toplevel_methods/home_directory.rb, line 19 def self.home_directory? ("#{ENV['HOME']}/").squeeze('/') end
#¶ ↑
RBT.infer_these_binaries_will_be_installed_by
¶ ↑
This method can be used to infer the binaries that may be installed by a given program at hand. This requires that the program has been installed already under an AppDir prefix.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/suggest_cookbook_for/suggest_cookbook_for.rb, line 802 def self.infer_these_binaries_will_be_installed_by( this_program = ARGV ) RBT.suggest_cookbook_for(this_program) { :do_not_report }.binaries? end
#¶ ↑
RBT.infer_these_libraries_will_be_installed_by
¶ ↑
This method can be used to infer the libraries that may be installed by a given program at hand. This requires that the program has been installed already under an AppDir prefix.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/suggest_cookbook_for/suggest_cookbook_for.rb, line 815 def self.infer_these_libraries_will_be_installed_by( this_program = ARGV ) RBT.suggest_cookbook_for(this_program) { :do_not_report }.libraries? end
#¶ ↑
RBT.initialize_configuration
¶ ↑
Use a method to initialize the configuration for the RBT
project.
#¶ ↑
# File lib/rbt/configuration/initialize_configuration.rb, line 19 def self.initialize_configuration # ======================================================================= # # We will set the @configuration variable to a specific value here. # ======================================================================= # RBT.set_configuration( # ===================================================================== # # Load up the data from the directory. This requires the file called # 'configuration_directory.rb'. # ===================================================================== # configuration_directory? # <- This is a String such as "/Programs/Ruby/2.5.1/lib/ruby/site_ruby/2.5.0/rbt/yaml/configuration/" ) # ======================================================================= # # === enable_gobolinux_config # # Use a specific "template" when we are on a GoboLinux distribution. # # Do also note that in the more recent GoboLinux versions, say past # the year 2017, the directories have changed a bit. The following # code will ONLY honour the current versions, not the older legacy # GoboLinux versions. # ======================================================================= # if @configuration.respond_to?(:enable_gobolinux_config) and @configuration.enable_gobolinux_config RBT.set_system_directory('/System/') # === SYSTEM_DIR @system_index_directory = "#{SYSTEM_DIR}Index/" RBT.set_source_directory('/Files/Compile/Source/') # /Files/Compile/Archives/ RBT.set_programs_directory('/Programs/') # Hardcoded, on GoboLinux. RBT.set_temp_directory(SYSTEM_DIR+'Variable/tmp/') # CONFIG.temp_dir RBT.set_depot_directory('/Depot/') @system_links_directory = "#{SYSTEM_DIR}Links/" RBT.set_packages_directory("#{DEPOT_DIR}Packages/") # This is not a Gobolinux Directory, though. @pkgconfig_directory = "#{SYSTEM_LINKS_DIR}Libraries/pkgconfig/" RBT.set_sysbin_directory("#{SYSTEM_INDEX}bin/") RBT.set_syslib_directory("#{SYSTEM_INDEX}lib/") RBT.set_sysinclude_directory("#{SYSTEM_INDEX}include/") RBT.set_system_settings_directory("#{SYSTEM_DIR}Settings/") RBT.set_system_share_directory("#{SYSTEM_LINKS_DIR}Shared/") @system_libexec_directory = "#{SYSTEM_INDEX}libexec/" @system_environment_directory = "#{SYSTEM_LINKS_DIR}Environment/" @system_tasks_directory = "#{SYSTEM_LINKS_DIR}Tasks/" @system_logs_directory = "#{SYSTEM_DIR}Logs/" @system_kernel_directory = "#{SYSTEM_DIR}Kernel/" else # ================================================================== # # Else, we will set the default variables here via the CONFIG # object. Keep a trailing / here. # ===================================================================== # # Keep a reference to the TEMP Directory used by the RBT Scripts here. # We will extract archives into this directory (the temp directory). # Before we will assign to the constant, we first have to do some # sanitizing. # ===================================================================== # _ = rds( @configuration.temp_directory ) if _.include? '#' # Chop off in this case. _ = _[0, _.index('#')].strip _ << '/' unless _.end_with? '/' end # ===================================================================== # # _ may be "/Depot/Temp/rbt/". # ===================================================================== # RBT.set_temp_directory(_) # ===================================================================== # # Keep a reference to the Programs dir. # ===================================================================== # RBT.set_programs_directory(@configuration.programs_directory) # ===================================================================== # # === The source directory # ===================================================================== # RBT.set_source_directory(@configuration.source_directory) # Where to store all Source files. # ===================================================================== # # === The /System/ directory # ===================================================================== # RBT.set_system_directory(@configuration.system_directory) # '/System/' RBT.set_sysbin_directory(@configuration.sysbin_directory) # Standard sysbin directory. RBT.set_syslib_directory(@configuration.syslib_directory) # Standard syslib directory. RBT.set_sysinclude_directory(@configuration.sysinclude_dir) # Standard include directory. # SYSLIB_DIR+'/pkgconfig/' # including pkgconfig RBT.set_depot_directory(@configuration.depot_dir) @system_logs_directory = rds(@configuration.system_logs+'/') # SYSTEM_DIR+'Logs' # Where to keep our syslogs. RBT.set_log_directory # Default it to some value. # ===================================================================== # # === SYSTEM_SETTINGS_DIR # # Where to keep the /etc equivalent. # ===================================================================== # RBT.set_system_settings_directory(@configuration.system_settings_dir) # ===================================================================== # # === The Packages Dir # # On my system it is at /Depot/Packages. # ===================================================================== # RBT.set_packages_directory(@configuration.packages_directory) # ===================================================================== # # === MY_SYSSHARE # # Next, handle the SYSSHARE_DIR directory. # ===================================================================== # if ENV['MY_SYSSHARE'] RBT.set_system_share_directory(ENV['MY_SYSSHARE'].dup) else RBT.set_system_share_directory(@configuration.sysshare_directory) end # ===================================================================== # # === PKGCONFIG_DIR # # PKGCONFIG_DIR is hardcoded for now. # ===================================================================== # @pkgconfig_directory = rds(@configuration.pkgconfig_dir+'/') end end
#¶ ↑
RBT.install_libstdc_plus_plus
¶ ↑
The following code was taken/adapted from:
http://www.linuxfromscratch.org/lfs/view/stable/chapter05/gcc-libstdc++.html
#¶ ↑
# File lib/rbt/toplevel_methods/install_libstdc_plus_plus.rb, line 19 def self.install_libstdc_plus_plus( shall_we_extract_the_tarball = true, # ← We could skip it, too. use_this_gcc_version = :infer_automatically, to = RBT.log_dir?, use_this_as_target_prefix = RBT.programs_directory? ) require 'rbt/requires/require_extracter.rb' require 'rbt/toplevel_methods/e_and_esystem.rb' case use_this_gcc_version # ======================================================================= # # === :infer_automatically # ======================================================================= # when :infer_automatically, # or hardcode it: '10.1.0' :infer unless RBT.respond_to? :swift_return_version_of_this_program require 'rbt/requires/swift_version.rb' end use_this_gcc_version = RBT.swift_return_version_of_this_program(:gcc) end what = "/home/x/src/gcc/gcc-#{use_this_gcc_version}.tar.xz" if shall_we_extract_the_tarball Extracter.what_to(what, to) end cd("#{to}#{use_this_gcc_version}/") use_this_as_host = 'x86_64-linux-gnu' target_dir = 'BUILD_FOR_LIBSTDC++' mkdir target_dir cd target_dir use_this_full_prefix_target = use_this_as_target_prefix+'Libstdc++/'+use_this_gcc_version _ = '../libstdc++-v3/configure \ --host='+use_this_as_host+' \ --prefix='+use_this_full_prefix_target+' \ --disable-multilib \ --disable-nls \ --disable-libstdcxx-threads \ --disable-libstdcxx-pch \ --with-gxx-include-dir='+use_this_as_target_prefix+'Gcc/Current/include/c++/'+use_this_gcc_version esystem _ esystem 'make' esystem 'make install' action(:ToCurrent, use_this_full_prefix_target) end
#¶ ↑
RBT.install_this_rubygem
¶ ↑
This method can be used to install a rubygem (.gem) archive.
In August 2022 the code was a bit changed - the old code made use of RBT::Compile
. During the rewrite of the RBT
project in August 2022 the method was simplified, to just use a direct “gem install” command.
We also now use the –local flag, but we may have to adapt this in the future, if this method here should also install remote gems. For now we only support installing local .gem files though.
Usage example:
RBT.install_this_rubygem('/tmp/thor-1.2.0.gem')
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 549 def self.install_this_rubygem( use_this_local_path, be_verbose = true ) unless RBT.const_defined?(:Installer) require 'rbt/requires/require_the_installer_class.rb' end # ======================================================================= # # The old code up until August 2022: # # compile_object = RBT::Action::Installer.new(:do_not_run_yet) # compile_object.determine_the_dataset_for_this_program(i) # compile_object.set_program_path(compile_object.cookbook_dataset_program_path?) # compile_object.install_this_ruby_gem(:default, :do_not_exit) # # ======================================================================= # cmd = "gem install --local #{use_this_local_path}" _ = RBT.file_ruby_gem_install_options if File.exist? _ cmd = cmd.dup cmd << " #{File.read(_)}" cmd.strip! end if be_verbose esystem cmd else system cmd end end
#¶ ↑
RBT.is_an_abbreviation?
¶ ↑
Usage example:
RBT.is_an_abbreviation? 'libxshmfe' # => true RBT.is_an_abbreviation? 'x11' # => true RBT.is_an_abbreviation? 'libx11' # => false
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 113 def self.is_an_abbreviation?(i) RBT.hash_aliases_to_the_available_programs?.has_key? i end
#¶ ↑
RBT.is_an_alias?
¶ ↑
This method will return true if the input is an alias, and otherwise it will return false.
We will get rid of ‘:’ in the input.
To test this method, do:
RBT.is_an_alias? 'htop' RBT.is_an_alias? 'blkid'
#¶ ↑
# File lib/rbt/aliases/aliases.rb, line 87 def self.is_an_alias?(i) RBT::Cookbooks::Aliases.new(i).is_an_alias? end
#¶ ↑
RBT.is_an_archive?
¶ ↑
This method will return true if the given input is considered to be an archive; and false otherwise.
#¶ ↑
# File lib/rbt/toplevel_methods/archive_related_code.rb, line 23 def self.is_an_archive?(i) if i.is_a? Array i.map {|entry| is_an_archive?(entry) } else ARRAY_REGISTERED_ARCHIVES.any? {|entry| entry = entry.to_s unless entry.is_a?(String) i and i.end_with?(entry) } end end
#¶ ↑
RBT.is_included?
¶ ↑
This method can be used to query whether a given input is included or whether it is not - that is, if the input may be a program that is registered in the RBT
project.
By default we will also include aliases, but this can be disabled, such as by using the Symbol :do_not_check_for_aliases as the second argument to this method.
Remember that all aliases in use are stored in a yaml file. If you want to add new aliases or change the existing ones, you may have to modify that yaml file.
In principle, we could also restrict this method here to only-aliases but I found that the API reads differently than this intent.
Usage examples for this method:
RBT.is_included? 'abiword' # => true RBT.is_included? 'aclocal'
#¶ ↑
# File lib/rbt/toplevel_methods/does_include.rb, line 35 def self.is_included?( i, honour_aliases = true ) if i require 'rbt/aliases/aliases.rb' i = i.join(' ').strip if i.is_a? Array # ===================================================================== # # We need a String past this point. # ===================================================================== # i = i.to_s unless i.is_a? String i.delete!(':') if i.include? ':' # We ignore ':' tokens. keys = available_programs? case honour_aliases # ===================================================================== # # === :default # ===================================================================== # when :default # Restore the default state in this case. honour_aliases = true # ===================================================================== # # === :do_not_honour_aliases # ===================================================================== # when :do_not_honour_aliases, :do_not_check_for_aliases, :do_not_use_aliases, :ignore_aliases, :user_disabled_this_setting_via_the_commandline honour_aliases = false end if honour_aliases aliases = RBT::Cookbooks::Aliases.new(i) all_aliases = aliases.dataset # =================================================================== # # Merge the keys together next, starting with the default programs. # ==================================================================== # keys << all_aliases.keys end keys.flatten! return keys.include?(i) else false end end
#¶ ↑
RBT.is_this_a_real_gobolinux_system?
¶ ↑
This method queries whether we are on a real GoboLinux system.
In order to determine this, as a true or false answer, we will ONLY check on local file-paths and possibly directory-paths.
We will check for three targets.
#¶ ↑
# File lib/rbt/toplevel_methods/gobolinux.rb, line 20 def self.is_this_a_real_gobolinux_system? File.exist?('/System/Aliens') and File.exist?('/System/Kernel/Boot/System.map') and File.symlink?('/System/Kernel/Boot/System.map') end
#¶ ↑
RBT.is_this_a_registered_pkgconfig_file?
¶ ↑
#¶ ↑
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 201 def self.is_this_a_registered_pkgconfig_file?(i = 'xau.pc') if File.exist? file_registered_pkgconfig_files dataset = YAML.load_file(file_registered_pkgconfig_files) dataset.has_key?(i) else false end end
#¶ ↑
RBT.is_this_partial_header_included?
¶ ↑
This method is a bit more “forgiving” than the method RBT.is_this_header_included.
Usage example:
RBT.is_this_partial_header_included?('libusb.h') # => true
#¶ ↑
# File lib/rbt/registered/registered_headers.rb, line 254 def self.is_this_partial_header_included?(i) result = all_headers?.transform_keys {|entry| File.basename(entry) } result.has_key?(i) end
#¶ ↑
RBT.is_this_program_included?
¶ ↑
This method can be used to determine whether the given input argument to this method is a registered program; aka whether this program is included as part of the RBT
project. A boolean will thus be returned, true indicating inclusion, and false indicating that the input is NOT a registered program.
Any input that is assumed to be a program, and included (thus returning true via this method), is additionally assumed to have an associated .yml dataset that describes how this program can be installed.
If the second argument is given, and is the Symbol :include_abbreviations or :with_abbreviations, or any similar symbol, then the abbreviations will also be considered.
Usage examples:
RBT.is_this_program_included? 'gawk' RBT.is_this_program_included? 'awk' RBT.is_this_program_included? 'wwk', :include_abbreviations
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 157 def self.is_this_program_included?( this_program, optional_argument = nil # <- Can be :include_abbreviations ) result = RBT.determine_available_programs.include?(this_program) case optional_argument # ======================================================================= # # === :do_not_check_for_aliases # ======================================================================= # when :do_not_check_for_aliases # This clause will not check for aliases. # ======================================================================= # # === :include_abbreviations # # This is the default value - see the symbol :default. # ======================================================================= # when :include_abbreviations, :with_abbreviations, :with_aliases, :default # ===================================================================== # # Keep a reference to the Hash that stores the aliases to the # available programs at hand. # ===================================================================== # abbreviations = RBT.hash_aliases_to_the_available_programs if abbreviations.has_key? this_program result = true end end result end
#¶ ↑
RBT.is_this_version_higher_than_that_version¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 379 def self.is_this_version_higher_than_that_version?( a, b, report_all_errors_to_the_user = true ) case report_all_errors_to_the_user # ======================================================================= # # === :do_not_report_any_errors # ======================================================================= # when :do_not_report_any_errors report_all_errors_to_the_user = false end begin a = Gem::Version.new(a) b = Gem::Version.new(b) a > b rescue Exception => error if report_all_errors_to_the_user e '-' * 80 pp error e '-' * 80 pp a pp b e '-' * 80 end end end
#¶ ↑
RBT.log_directory?
¶ ↑
Query method for the @log_directory variable. Prefer to use this method or any of its aliases rather than the constant called LOG_DIR.
On my home system this usually defaults to “/home/Temp/rbt/”.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 873 def self.log_directory? @log_directory end
#¶ ↑
RBT.make_app_prefix
¶ ↑
This method will ultimately execute a command such as this one here:
make PREFIX=/home/Programs/Xfce4-panel/4.14.3/ install
#¶ ↑
# File lib/rbt/toplevel_methods/make_app_prefix.rb, line 21 def self.make_app_prefix( for_this_program = :infer ) begin require 'program_information' rescue LoadError; end if for_this_program.is_a? Array and for_this_program.empty? for_this_program = :default end case for_this_program # ======================================================================= # # === :infer # # This is the default entry point to this method. # ======================================================================= # when :infer, :default _ = File.basename(return_pwd) program_name = ProgramInformation.return_name(_) program_version = ProgramInformation.return_version(_) target = programs_dir?+ program_name.capitalize+'/'+ program_version.to_s+'/' # esystem 'make PREFIX='+target cmd_to_run = "make PREFIX=#{target} install" e esystem cmd_to_run e end end
#¶ ↑
RBT.map_this_input_to_that_registered_program
¶ ↑
Usage example:
RBT.map_this_input_to_that_registered_program('mutool') # => "mupdf"
#¶ ↑
# File lib/rbt/actions/individual_actions/map_this_input_to_that_registered_program/map_this_input_to_that_registered_program.rb, line 336 def self.map_this_input_to_that_registered_program( i = ARGV, &block ) i = i.first if i.is_a? Array return RBT::Action::MapThisInputToThatRegisteredProgram.new(i, &block) end
#¶ ↑
RBT.meson_appdir_prefix
¶ ↑
The argument to this method defaults to the symbol called :use_cwd_as_input, which will be translated into the current working directory.
#¶ ↑
# File lib/rbt/toplevel_methods/meson.rb, line 120 def self.meson_appdir_prefix( i = :use_cwd_as_input ) case i when :use_cwd_as_input i = return_pwd end i = File.basename(i) require 'program_information' this_program_name = ProgramInformation.return_name(i).delete('-_') this_program_version = ProgramInformation.return_version(i) use_this_build_directory = 'BUILD_DIRECTORY_FOR_MESON' use_this_prefix = programs_dir?+ this_program_name.capitalize+ '/'+ this_program_version+ '/' esystem 'meson --prefix='+use_this_prefix+' '+use_this_build_directory cd use_this_build_directory esystem 'ninja' esystem 'ninja install' e "#{rev}If everything went fine then the program "\ "#{sfancy(this_program_name)} #{rev}has been compiled" e "#{rev}successfully into the prefix `#{sfancy(use_this_prefix)}#{rev}`." end
#¶ ↑
RBT.meson_build_file_exists?
¶ ↑
When we check for the file called “meson.build”, we must also keep in mind that we may use a build directory. This is the reason why the following code uses a variable.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 298 def self.meson_build_file_exists?( check_for_this_file = 'meson.build', prepend_this_for_the_check = nil ) case check_for_this_file when :default check_for_this_file = 'meson.build' end does_this_file_exist?( # Call the above method again here. check_for_this_file, prepend_this_for_the_check ) end
#¶ ↑
RBT.no_trad_no_symlink
¶ ↑
This method combines the two configure options “–no-trad” and “–no-symlink” into RBT::Action::Installer.new.
#¶ ↑
# File lib/rbt/toplevel_methods/no_trad_no_symlink.rb, line 15 def self.no_trad_no_symlink( these_programs = ARGV ) require 'rbt/requires/require_actions.rb' # ======================================================================= # # Make sure that RBT::Action::Installer is available next: # ======================================================================= # [these_programs].flatten.compact.each {|this_program| _ = action(:Installer, [ this_program,'--no-trad','--no-symlink' ] ) } end
#¶ ↑
RBT.opn
(opn tag, opnn tag)¶ ↑
The argument to this method may be interpreted as a “namespace” to be used.
#¶ ↑
# File lib/rbt/toplevel_methods/opn.rb, line 65 def self.opn( i = NAMESPACE, &block ) if @use_opn if i.is_a? String i.delete!('.') if i.include? '.' i = { namespace: i } end # ======================================================================= # # Support a little bit of padding: # ======================================================================= # if i.is_a?(Hash) and RBT.n_padding_to_use_for_opn? i.update(padding: @n_padding_to_use_for_opn) end Opn.opn(i, &block) # The NAMESPACE constant is already a Hash. end end
#¶ ↑
RBT.patch
¶ ↑
This will simply make use of the Linux
patch command (and wget too).
#¶ ↑
# File lib/rbt/toplevel_methods/patch.rb, line 16 def self.patch(i) if i.is_a? Array i.each {|entry| patch(entry) } else _ = File.basename(i) unless File.exist? _ esystem "wget #{i}" end esystem "patch -Np1 -i #{_}" end end
#¶ ↑
RBT.permanently_disable_colours
¶ ↑
This method can be used to permanently disable the colours for the RBT
project. This essentially just saves into the file ‘use_colours.yml’.
To invoke this method from the commandline, try this command:
rbt --permanently-disable-colours
#¶ ↑
# File lib/rbt/colours/permanently_disable_colours.rb, line 23 def self.permanently_disable_colours into = RBT.file_use_colours? what = YAML.dump(false) message_for_the_user = 'Permanently disabling the colours for the '\ 'RBT project.' opn; e message_for_the_user opn; e "(file: #{sfile(into)})" write_what_into(what, into) if is_on_roebe? into = "#{RUBY_SRC_DIR_AT_HOME}"\ "rbt/lib/rbt/yaml/configuration/"\ "#{File.basename(FILE_USE_COLOURS)}" opn; e message_for_the_user opn; e "(file: #{sfile(into)})" write_what_into(what, into) end end
#¶ ↑
RBT.permanently_set_source_directory
¶ ↑
Use this method if you wish to permanently modify the source directory, that is, the directory where our archives will be stored.
Invocation example from the commandline:
rbt --set_source_dir=/opt rbt --permanently-set-base-directory-to=/opt
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 776 def self.permanently_set_source_directory(i) i = i.dup if i.frozen? i << '/' unless i.end_with? '/' unless i.start_with? '/' i.prepend('/') # We require leading '/'. end # ======================================================================= # # Modify the yaml file next: # ======================================================================= # what = i into = RBT.file_source_directory write_what_into(what, into) if block_given? yielded = yield case yielded when :be_verbose e "We will permanently set to a new source "\ "directory next (#{sdir(i)})" end end opn; e "Setting the new source directory to point towards `#{sdir(what)}`." opn; e "Storing into the file `#{sfile(into)}` next." # ======================================================================= # # And also modify it on my home system, if IS_ROEBE is true. This will # go right into the configuration/ subirectory. # ======================================================================= # if is_on_roebe? into = "#{RUBY_SRC_DIR_RBT}yaml/configuration/"\ "#{File.basename(into)}" opn; e "Will also store into the file `#{sfile(into)}`." RBT.write_what_into(what, into) end RBT.set_source_base_directory(i) # And also sync it back. unless File.directory? i opne 'Since that directory does not exist, it will be created now.' mkdir(i) { :be_quiet } end end
#¶ ↑
RBT.permanently_set_temp_directory
¶ ↑
Use this method if you wish to permanently modify the temp directory, that is, the directory we will extract to (or to a subdirectory in that directory).
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 567 def self.permanently_set_temp_directory(i) case i # ======================================================================= # # === :default # ======================================================================= # when :default, :pwd, 'pwd' i = return_pwd.dup # Return the current working directory here. # ======================================================================= # # === :home_directory # ======================================================================= # when :home_directory i = (ENV['HOME'].to_s+'/').squeeze('/') end # ======================================================================= # # Next, ensure trailing '/' character - unless the input includes # a '$' character. # ======================================================================= # unless i.include? '$' i << '/' unless i.end_with? '/' end opn; e "Setting the new temp directory to point towards `#{sdir(i)}`." # ======================================================================= # # Modify the yaml file next: # ======================================================================= # what = i into = RBT.file_temp_directory_yaml RBT.write_what_into(what, into) # ======================================================================= # # And also modify it on my home system, if IS_ROEBE is set to true. # ======================================================================= # if is_on_roebe? into = "#{RUBY_SRC_DIR_RBT_YAML_AT_HOME}configuration/"\ "#{File.basename(into)}" RBT.write_what_into(what, into) end RBT.set_temp_directory(i) # And also sync it. unless File.directory? i opne 'Since that directory does not exist, it will be created now.' mkdir(i) { :be_quiet } end i # Also return the variable, so we can re-use it in other methods. end
#¶ ↑
RBT.pin_this_program
¶ ↑
This toplevel-method can be used to “pin” down a specific program.
Pinned-down programs can not be installed. Users
can unpin a pinned-down program though.
#¶ ↑
# File lib/rbt/toplevel_methods/pin_and_unpin.rb, line 17 def self.pin_this_program(i) require 'rbt/requires/require_raw_yaml.rb' if is_a_registered_program?(i) # ===================================================================== # # Store into this file: # ===================================================================== # into = "#{log_dir?}pinned_programs.yml" opne "Pinning the program #{sfancy(i)} next." array_these_programs_are_pinned = [] if File.exist? into array_these_programs_are_pinned << YAML.load_file(into) end array_these_programs_are_pinned << i opne "Storing into #{sfile(into)} next." array_these_programs_are_pinned.uniq! write_what_into( YAML.dump( array_these_programs_are_pinned ), into ) else opne "#{sfancy(i)}#{rev} can not be pinned because it is not registered." end end
#¶ ↑
RBT.project_base_directory?
¶ ↑
This method will yield to us the base directory of the RBT
project.
For example, it will return a String such as:
/Programs/Ruby/2.6.0/lib/ruby/site_ruby/2.6.0/rbt/ /home/Programs/Ruby/2.7.1/lib/ruby/site_ruby/2.7.0/rbt/
It may be another path on your computer system, such as /usr/lib/ruby/site_ruby/2.7.0/rbt/.
#¶ ↑
# File lib/rbt/project/project.rb, line 30 def self.project_base_directory? RBT::PROJECT_BASE_DIRECTORY end
#¶ ↑
RBT.publish_list_of_all_programs_version
¶ ↑
To invoke this method, do:
rbt --publish-list-of-all-programs-version
#¶ ↑
# File lib/rbt/toplevel_methods/ftp.rb, line 29 def self.publish_list_of_all_programs_version( file_programs_version = RBT.file_programs_version # This is the file 'programs_version.yml' ) _ = ''.dup opn; e 'The file '+sfile(file_programs_version)+' will next '\ 'be FTP-uploaded/published.' hash = YAML.load_file(file_programs_version) hash.each_pair {|name_of_the_program, program_version| _ << name_of_the_program.ljust(28)+program_version.to_s+N } what = _ into = "#{RBT.store_into_this_directory}programs_version.txt" opn; e 'Storing into `'+sfile(into)+'`.' RBT::SaveFile.write_what_into(what, into) RBT.upload_list_of_all_programs_version(into) # ========================================================================= # # Also upload a .html variant. # ========================================================================= # RBT.upload_list_of_all_programs_version(into, :html) end
#¶ ↑
RBT.query_binary_to_package
¶ ↑
The input argument should be the path to the directory that you wish to test. By default we will use ‘/usr/bin/’ as a target here.
#¶ ↑
# File lib/rbt/utility_scripts/query_binary_to_package.rb, line 252 def self.query_binary_to_package(i = '/usr/bin/') RBT::QueryBinaryToPackage.new(i) end
#¶ ↑
RBT.query_header_to_package
¶ ↑
The input argument should be the path to the directory that you wish to test. By default we will use ‘/usr/include/’ as a target here.
#¶ ↑
# File lib/rbt/utility_scripts/query_header_to_package.rb, line 247 def self.query_header_to_package(i = '/usr/include/') RBT::QueryHeaderToPackage.new(i) end
#¶ ↑
RBT.raw_cookbook
¶ ↑
Ideally use this method to instantiate a new raw cookbook instance.
Since as of February 2024 this is part of the RBT::Action
namespace.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/raw_cookbook/raw_cookbook.rb, line 1385 def self.raw_cookbook( i = ARGV, options_hash = {}, &block ) raw_cookbook = RBT::Action::Cookbooks::RawCookbook.new(i, :do_not_run_yet, &block) if options_hash and !options_hash.empty? options_hash.each_pair {|key, value| case key # ===================================================================== # # === :autogenerate_expanded_dataset # ===================================================================== # when :autogenerate_expanded_dataset raw_cookbook.set_autogenerate_expanded_dataset(value) end } end raw_cookbook.run return raw_cookbook end
#¶ ↑
RBT.remove_file
¶ ↑
Use this method to remove a file, but check if the file exists before actually deleting it. Additionally, also check for proper file permissions permissions as well.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 318 def self.remove_file( file, report_action = false ) file = file.dup if file.frozen? file.squeeze!('/') # We do not want double '/' entries. case report_action # ======================================================================= # # === :be_quiet # ======================================================================= # when :be_quiet report_action = false # ======================================================================= # # === :be_verbose # ======================================================================= # when :be_verbose report_action = true end can_we_delete_this_entry = false can_we_delete_this_entry = true if File.exist? file begin case File.ftype(file) when 'link' can_we_delete_this_entry = true end rescue Errno::ENOENT can_we_delete_this_entry = true # Failsafe. end # ======================================================================= # # We also have to handle symlinks, aka 'link', entries. These may no # longer exist, but we still will to delete such stray links, hence # why the above check has to be the way it is. # ======================================================================= # if can_we_delete_this_entry # ===================================================================== # # We need to check whether we can write to the file at hand. # ===================================================================== # base_directory = File.dirname(file) if File.writable? base_directory unless File.directory? file # Safeguard. if report_action e "Now removing the file `#{sfile(file)}`." end if File.exist? file File.delete(file) # Remove the file here. else if report_action e "No file exists at `#{sfile(file)}`." end end end else opnn(__FILE__) ewarn "Insufficient permission to remove file #{sfile(file)}" end else # Not sure if we should report this. if report_action opnn(__FILE__) ewarn "Trying to remove a file, but the file #{sfile(where)}" ewarn ' does not exist.' end end end
#¶ ↑
RBT.remove_file_extension
¶ ↑
This method will try to remove anything we declare to be an “improper file extension”. In other words this method will remove the trailing archive type of a file, such as .tar.xz or .tar.gz and so forth.
The order is important here, in particular for entries such as “foobar-1.0.tar.xz” or “foobar-1.0.tar.gz”.
File.basename() is used to not have to worry about leading components, or ‘/’ entries.
#¶ ↑
# File lib/rbt/toplevel_methods/remove_file_extension.rb, line 23 def self.remove_file_extension(i) i = i.dup if i.frozen? if i # i = File.basename(i.to_s) # This was disabled in May 2023. i = i.sub(/\.bz2$/, ''). # Handle .tar.bz2 entries. sub(/\.gz$/, ''). # Remove it before .tar.gz entries. sub(/\.zip$/, ''). sub(/\.har$/, ''). # Java .jar files. sub(/\.tbz$/, ''). sub(/\.xz$/, ''). sub(/\.lz$/, ''). # In particular to handle .tar.lz entries. sub(/\.Z$/, ''). sub(/\.7z$/, ''). sub(/\.tar$/, ''). sub(/\.js$/, ''). # Javascript .js files. sub(/\.tgz$/, ''). sub(/\.tbz2$/, ''). sub(/\.gzip$/, ''). sub(/\.phar$/, ''). sub(/\.txz$/, ''). sub(/\.gem$/, ''). # Handle ruby .gem files here. sub(/\.yml$/, ''). sub(/\.js$/, ''). sub(/-trunk/, ''). # ← Also remove weird things like that. sub(/-source/, ''). # ← and also this. sub(/&type=zip$/,'') end return i # Last but not least, always return it. end
#¶ ↑
RBT.remove_libtool_files_from
¶ ↑
Easier top-level API for removing libtool files from a certain directory (and subdirectories).
The input-argument should be a locally existing directory which should contain .la files.
#¶ ↑
# File lib/rbt/libtool/remove_libtool_files/remove_libtool_files.rb, line 183 def self.remove_libtool_files_from( this_directory = '' ) RBT::Libtool::RemoveLibtoolFiles.new(this_directory) # <- Just delegate to the class. end
#¶ ↑
RBT.report_all_registered_programs_of_homebrew
¶ ↑
#¶ ↑
# File lib/rbt/homebrew/registered_programs_of_homebrew.rb, line 49 def self.report_all_registered_programs_of_homebrew these_entries = RBT.return_all_registered_programs_of_homebrew e 'The following entries were found:' index = 0 these_entries.each {|name_of_the_program, program_version| index += 1 padded_index = (index.to_s.rjust(4)).ljust(6) colourized_and_padded_index = RBT.dodgerblue(padded_index) e ' '+colourized_and_padded_index+ name_of_the_program.delete('-').ljust(40)+ program_version } end
#¶ ↑
RBT.report_extended_information_about_this_program
¶ ↑
(feedback tag, debug tag, main tag)
Use this feedback-method to report extended information about a program, in a colourful manner. This program must have been registered in the Cookbooks
namespace - otherwise we can not really display much about that program at hand.
The input to this method can be either be a String or an Array.
#¶ ↑
# File lib/rbt/toplevel_methods/report_extended_information_about_this_program.rb, line 48 def self.report_extended_information_about_this_program( i ) commandline_arguments = [] if i.is_a? Array commandline_arguments << i.select {|line| line.start_with? '--'} i = i.first end commandline_arguments.flatten! commandline_arguments.compact! if i # ===================================================================== # # Delegate towards the sanitize_cookbook action next: # ===================================================================== # _ = action(:sanitize_cookbook, :do_not_run_yet) { :fast } unless commandline_arguments.empty? _.menu(commandline_arguments) # Pass the commandline arguments here. end _.find_this_program(i) _.report check_and_report_whether_file_exists( _.full_path?, _ ) end end
#¶ ↑
RBT.report_how_many_binaries_are_registered
¶ ↑
This method will report how many binaries are registered in total.
Example output from this method:
RBT: There are 3849 registered binaries in all cookbook files.
#¶ ↑
# File lib/rbt/toplevel_methods/report_how_many_binaries_are_registered.rb, line 25 def self.report_how_many_binaries_are_registered n_binaries = RBT.all_binaries.keys.uniq.size opn; e "#{rev}There are #{sfancy(n_binaries.to_s)} #{rev}registered "\ "binaries in all cookbook files." end
#¶ ↑
RBT.report_rbt_version
¶ ↑
This method will simply report the current RBT-version in use.
#¶ ↑
# File lib/rbt/version/version.rb, line 61 def self.report_rbt_version( optional_additional_activities = nil ) require 'rbt/toplevel_methods/e_and_esystem.rb' require 'rbt/colours/rev_simp_sdir_sfancy_sfile_and_swarn.rb' string = rbt_version? if optional_additional_activities case optional_additional_activities when :also_show_when_the_project_was_last_updated string = string.dup string << " (Last update: #{LAST_UPDATE})" end end e "#{sfancy(string)}#{rev}" end
#¶ ↑
RBT.report_the_kde_status
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/report_the_kde_status.rb, line 17 def self.report_the_kde_status require 'rbt/colours/html_colours.rb' n_rjust = 7 kde_frameworks_version = File.basename( REMOTE_URL_FOR_KDE_FRAMEWORKS ).rjust(n_rjust) kde_applications_version = File.basename( REMOTE_URL_FOR_KDE_APPLICATIONS.sub(/src\/$/,'') ).rjust(n_rjust) kde_plasma_version = File.basename( REMOTE_URL_FOR_KDE_PLASMA ).sub(/\.php$/,'').sub(/^plasma-/,''). rjust(n_rjust) e e " #{rev}#{mediumslateblue('KDE Frameworks version:')} "+ "#{cyan(kde_frameworks_version)}" e ' '+mediumslateblue('KDE Applications version: ')+ cyan(kde_applications_version) e ' '+mediumslateblue('KDE Plasma version: ')+ cyan(kde_plasma_version) e end
#¶ ↑
RBT.report_total_size_of_all_archives
¶ ↑
This method can be used to report the total size of all locally available archives.
Invocation example from the commandline:
rbt --report_total_size_of_all_archives
#¶ ↑
# File lib/rbt/toplevel_methods/archive_related_code.rb, line 74 def self.report_total_size_of_all_archives total_size = RBT.return_total_size_of_all_archives n_kilobytes = total_size / 1024.0 n_megabytes = n_kilobytes / 1024.0 n_gigabytes = n_megabytes / 1024.0 # ======================================================================= # # Finally, report it here. # ======================================================================= # e "#{rev}The total file size of all #{sfancy(available_programs.size.to_s)}"\ " #{rev}programs is #{total_size.to_s} bytes." e steelblue( " (#{n_kilobytes.round(2)} KB; " )+ tomato( "#{n_megabytes.round(2)} MB" )+ "#{rev}; "+ crimson( n_gigabytes.round(2).to_s+' GB' )+"#{rev})" end
#¶ ↑
RBT.report_where_the_cookbook_directory_can_be_found
¶ ↑
This method will report where the cookbook directory can be found.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 506 def self.report_where_the_cookbook_directory_can_be_found opn(namespace: RBT::NAMESPACE[:namespace]) e "#{rev}The cookbook directory can be found at this location:" e e Colours.sfancy(" #{RBT.individual_cookbooks_directory?}")+ rev e end
#¶ ↑
RBT.require_the_classes_for_individual_programs
¶ ↑
#¶ ↑
# File lib/rbt/requires/require_the_classes_for_individual_programs.rb, line 14 def self.require_the_classes_for_individual_programs Dir[ "#{RBT.project_base_directory?}misc/classes_for_individual_programs/*.rb" ].uniq.each {|file| require "rbt/misc/classes_for_individual_programs/#{File.basename(file)}" } end
#¶ ↑
RBT.require_the_registered_components
¶ ↑
This method will require all .rb files under the rbt/registered/ directory.
#¶ ↑
# File lib/rbt/requires/require_the_registered_components.rb, line 17 def self.require_the_registered_components Dir["#{RBT.base_directory?}registered/*.rb"].each {|file| require "rbt/registered/#{File.basename(file)}" } end
#¶ ↑
RBT.require_the_validation_scripts
¶ ↑
use this method to require the validation scripts. They are not automatically required, though, because they are not typically needed by the end user.
#¶ ↑
# File lib/rbt/requires/require_the_validation_scripts.rb, line 20 def self.require_the_validation_scripts Dir["#{RBT.validation_directory}*.rb"].uniq.each {|file| require "rbt/checks_and_validations/#{File.basename(file)}" } end
#¶ ↑
RBT.return_alias_program_name_for
¶ ↑
This method will return the (aliased) program name for the given input. If no alias name was found, it will return the input.
#¶ ↑
# File lib/rbt/aliases/aliases.rb, line 69 def self.return_alias_program_name_for(i) RBT::Cookbooks::Aliases.new(i).translate_alias end
#¶ ↑
RBT.return_all_abbreviations_of_this_array
¶ ↑
This method will calculate all abbreviations for a given program.
It will NOT include the self-name, e. g. to avoid redundant ‘php’ => ‘php’ entries.
For lib-entries, such as “libX11”, entries such as “X11” will also work in principle, but this conflicts with e. g. “x11perf”. So we have to keep this in mind.
To store these abbreviations from the commandline, issue the following instruction:
rbt --store
# ¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 218 def self.return_all_abbreviations_of_this_array( i = determine_available_programs ) require 'rbt/requires/require_raw_yaml.rb' require 'abbrev' # ======================================================================= # # The next constant refers to a location such as: # # /Programs/Ruby/2.5.1/lib/ruby/site_ruby/2.5.0/rbt/yaml/abbrevations_to_the_programs.yml # # ======================================================================= # file_abbreviations = RBT.file_abbreviations if File.exist?(file_abbreviations) and !File.empty?(file_abbreviations) # ===================================================================== # # If the abbreviations do exist, we will load up this file. # ===================================================================== # result = YAML.load_file(file_abbreviations) else # ===================================================================== # # Else we will have to re-create the file, or rather the content # of said file next. # ===================================================================== # result = {} # <- We will store into this Hash. # ===================================================================== # # Next, iterate over the registered programs: # ===================================================================== # i.each {|entry| # =================================================================== # # Obtain all abbreviations for this specific entry. # =================================================================== # abbreviations = Abbrev.abbrev([entry]) # =================================================================== # # Next, if entry starts with 'lib', we will enable more aliases # to this name. # =================================================================== # if entry.start_with? 'lib' suffix = entry[3 .. -1] more_abbreviations = {} loop { more_abbreviations[suffix] = entry suffix.chop! # Chop off the last character, then continue. break if suffix.size < 1 } more_abbreviations.update(abbreviations) abbreviations = more_abbreviations end # =================================================================== # # Now that the abbreviations have been entered, we will again # overwrite the result-hash with the core programs. # =================================================================== # abbreviations.reject! {|key, value| # ================================================================= # # Two conditions are possible here: # # key == value means that this is a self-alias # or # it has already been defined # # ================================================================= # (key == value) or i.include?(key) } result.update(abbreviations) } end if File.exist? FILE_COOKBOOK_ALIASES # ===================================================================== # # If the file "cookbook_aliases.yml" exists, use that file to merge # it into the above abbreviations-hash. # ===================================================================== # result.update( YAML.load_file(FILE_COOKBOOK_ALIASES) ) if result end # ======================================================================= # # Merge in the file "windows_cookbook.yml". # ======================================================================= # if File.exist?(FILE_WINDOWS_COOKBOOK) and File.exist?(FILE_TRY_TO_USE_THE_FILE_WINDOWS_COOKBOOK) and File.read(FILE_TRY_TO_USE_THE_FILE_WINDOWS_COOKBOOK).strip.start_with?("t") array = YAML.load_file(FILE_WINDOWS_COOKBOOK).keys array = Abbrev.abbrev(array) result.update(array) end result end
#¶ ↑
RBT.return_all_archives_from_this_directory
¶ ↑
This method will return all archives from a given directory.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 224 def self.return_all_archives_from_this_directory(i) i = i.first if i.is_a? Array i = i.dup if i.frozen? if i and File.directory?(i) i << '/' unless i.end_with? '/' end potential_matches = [] ARRAY_REGISTERED_ARCHIVES.each {|file_format| potential_matches << Dir["#{i}*#{file_format}"] } potential_matches.flatten.compact end
#¶ ↑
RBT.return_all_registered_programs_of_homebrew
¶ ↑
#¶ ↑
# File lib/rbt/homebrew/registered_programs_of_homebrew.rb, line 24 def self.return_all_registered_programs_of_homebrew require 'rbt/check_for_updates/base.rb' remote_url = REMOTE_URL_TO_THE_HOMEBREW_FORMULAS e "#{rev}Next checking the remote URL #{sfancy(remote_url)}#{rev}." _ = RBT::Cookbooks::CheckForRemoteWebpages.new _.obtain_dataset_from_the_remote_webpage( remote_url ) result = _.dataset? # ======================================================================= # # The following regex-check can be seen here: # # https://rubular.com/r/5b7Tsl61E6ovGO # # It has two matches. # ======================================================================= # use_this_regex = /<td><a href="\/formula\/([A-Za-z0-9]+)">.+<\/a>/ scanned = result.scan(use_this_regex).flatten.compact scanned end
#¶ ↑
RBT.return_alternative_archive
¶ ↑
This variant will return an array.
#¶ ↑
# File lib/rbt/actions/individual_actions/find_alternative_archive/find_alternative_archive.rb, line 186 def self.return_alternative_archive(i = ARGV) return RBT::Action::FindAlternativeArchive.new(i).return_alternative_archives end
#¶ ↑
RBT.return_appdir_prefix
¶ ↑
This method assumes that the input includes at the least one ‘-’, so that ProgramInformation can work on this properly.
Usage example:
RBT.return_appdir_prefix('htop-2.2.3')
#¶ ↑
# File lib/rbt/toplevel_methods/configure_appdir_prefix.rb, line 28 def self.return_appdir_prefix( of_this_program ) if of_this_program.is_a? Array of_this_program = of_this_program.first end # ======================================================================= # # In the past, before September 2022, the method used .delete('-'). # But this messed up ProgramInformation, so it was removed. # ======================================================================= # the_guessed_name = ProgramInformation.return_name( of_this_program ).capitalize return "#{programs_dir?}"\ "#{the_guessed_name}/"\ "#{ProgramInformation.return_version(of_this_program)}"\ "/" end
#¶ ↑
RBT.return_archive_type
¶ ↑
This method will feedback the archive type in use, for the given input at hand.
It is used in class RBT::UpdateEntry
, for example.
The default will be, as can be seen from the default argument, .tar.xz. Note that this assumption is not always correct, e. g. if the user does not repackage a given archive.
Note that the simple archives, such as .gem or .zip, could be detected automatically, but entries such as .tar.gz are harder to detect, hence why we will use a hardcoded case menu here.
Usage example:
RBT.return_archive_type('htop-1.2.0.tar.xz') # => '.tar.xz'
#¶ ↑
# File lib/rbt/toplevel_methods/archive_related_code.rb, line 117 def self.return_archive_type( i = '.tar.xz' ) if i.is_a? Array i = i.first end # ======================================================================= # # === .tar.xz # ======================================================================= # if i.end_with? '.tar.xz' '.tar.xz' # ======================================================================= # # === .xz # ======================================================================= # elsif i.end_with? '.xz' '.tar.xz' # ======================================================================= # # === .tar.gz # ======================================================================= # elsif i.end_with? '.tar.gz' '.tar.gz' # ======================================================================= # # === .tar.bz2 # ======================================================================= # elsif i.end_with? '.tar.bz2' '.tar.bz2' # ======================================================================= # # === .tar.lz # ======================================================================= # elsif i.end_with? '.tar.lz' '.tar.lz' # ======================================================================= # # === .gem # ======================================================================= # elsif i.end_with? '.gem' '.gem' # ======================================================================= # # === .zip # ======================================================================= # elsif i.end_with? '.zip' '.zip' # ======================================================================= # # === .jar # ======================================================================= # elsif i.end_with? '.jar' '.jar' # ======================================================================= # # === .phar # ======================================================================= # elsif i.end_with? '.phar' '.phar' # ======================================================================= # # === .js # ======================================================================= # elsif i.end_with? '.js' '.js' else # else try to make an "educated guess" - via File.extname(). # ===================================================================== # # But this can also return faulty results. For example, if the input # is "27.01.2019" then it does not make any sense to return ".2019" as # an archive type, since that is not an archive type. This is the # reason why specifically numbers are excluded in the following # check. # ===================================================================== # extname = File.extname(i) if extname.delete('.') =~ /^\d+$/ # If only numbers. extname = ''.dup end extname end end
#¶ ↑
RBT.return_array_of_programs_without_a_blfs_entry
¶ ↑
This method will return an Array that keeps track of all local cookbook files without a BLSF entry.
This functionality can then be used to output this Array on the commandline
#¶ ↑
# File lib/rbt/toplevel_methods/return_array_of_programs_without_a_blfs_entry.rb, line 20 def self.return_array_of_programs_without_a_blfs_entry array_of_programs_without_a_blfs_entry = [] # ======================================================================= # # First, obtain all available programs. # ======================================================================= # all_available_programs = RBT.available_programs? all_available_programs.each {|this_program| location = "#{individual_cookbooks_directory?}#{this_program}.yml" dataset = File.read(location) unless dataset =~ /^ blfs:/ array_of_programs_without_a_blfs_entry << this_program end } # ======================================================================= # # Next, return the Array. # ======================================================================= # return array_of_programs_without_a_blfs_entry end
#¶ ↑
RBT.return_array_of_this_tag
¶ ↑
This method will return an Array of programs that qualify for a given tag.
The input argument to this method should be the name of the tag that is being sought, such as ‘php’ or ‘kde5’.
Usage examples:
RBT.return_array_of_this_tag 'php' # => ["drupal", "eaccelerator"] RBT.return_array_of_this_tag 'kde5'
#¶ ↑
# File lib/rbt/cookbooks/search_for_tags/search_for_tags.rb, line 738 def self.return_array_of_this_tag(i) RBT::Cookbooks::SearchForTags.new(i.to_s) { :be_quiet }.array_of_programs.sort end
#¶ ↑
RBT.return_base_directory_of_this_program
¶ ↑
This method will return the base-directory for a given program, such as “/home/x/src/htop/” for the program htop.
A String is returned from this method.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 810 def self.return_base_directory_of_this_program(i) i = i.first if i.is_a? Array return "#{RBT.source_directory?}#{File.basename(i).delete('_')}/" end
#¶ ↑
RBT.return_binaries_of_this_program
¶ ↑
This method will return the binaries of a given program at hand.
An Array will be returned which may look like this, for the program called “ruby”:
["erb", "gem", "irb", "rake", "ri", "rdoc", "ruby"]
#¶ ↑
# File lib/rbt/toplevel_methods/return_binaries_of_this_program.rb, line 20 def self.return_binaries_of_this_program(i) require 'rbt/requires/require_actions.rb' require 'rbt/requires/require_the_cookbook_class.rb' i = i.first if i.is_a? Array action(:SanitizeCookbook, i) { :fast }.binaries? end
#¶ ↑
RBT.return_blfs_page_of_this_program
¶ ↑
This method will either return the BLFS page of the given program, as a String - or nil otherwise.
If a String is returned then we will assume that this is to the remote BLFS page entry of a (locally registered) program.
Returns:
- either a string - or nil
Invocation examples:
x = RBT.return_blfs_page_of_this_program('gcc') x = RBT.blfs(:openssl) # => http://www.linuxfromscratch.org/lfs/view/development/chapter06/openssl.html x = RBT.blfs(:zvbi) # => nil
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/blfs/blfs.rb, line 635 def self.return_blfs_page_of_this_program( this_program = 'gcc' ) _ = RBT.blfs_instance(this_program) { :be_quiet_and_no_colours_and_do_not_tamper_with_the_xorg_buffer_and_do_not_open_in_the_browser } result = _.remote_url? result = result.first if result.is_a? Array return result end
#¶ ↑
RBT.return_configuration_options_for?
¶ ↑
This method will delegate towards class RBT::Action::Cookbooks::SanitizeCookbook
.
Symbols are valid input to this method, as well as Strings.
Usage examples:
php_options = RBT.return_configuration_options_for? 'php' ruby_options = RBT.return_configuration_options_for? :ruby
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb, line 796 def self.return_configuration_options_for?( this_program = ARGV ) RBT.action(:SanitizeCookbook, this_program).configuration_options? end
#¶ ↑
RBT.return_configure_options_of_this_program
¶ ↑
This method will return the GNU configure options of a program - that is options such as “–enable-static” that may be passed to “./configure” on the commandline.
Usage example:
RBT.return_configure_options_of_this_program('php') # => "--enable-bcmath" and so forth
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb, line 6371 def self.return_configure_options_of_this_program(i) action(:sanitize_cookbook, i).configure_options? end
#¶ ↑
RBT.return_cookbook_dataset_for
¶ ↑
This will return the dataset for a given program, in a fast manner.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb, line 6355 def self.return_cookbook_dataset_for(i) RBT::Action::Cookbooks::SanitizeCookbook.return_dataset(i) { :fast } end
#¶ ↑
RBT.return_cookbook_for
¶ ↑
This is an easier toplevel method to create a new cookbook-instance. Use with care, though.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb, line 6305 def self.return_cookbook_for( i = :lua, &block ) if block_given? return RBT::Action::Cookbooks::SanitizeCookbook.new(i, &block) else return RBT::Action::Cookbooks::SanitizeCookbook.new(i) { :fast } end end
#¶ ↑
RBT.return_description_of
¶ ↑
This method will return the description of the given program at hand.
Usage example:
x = RBT.return_description_of(:ruby)
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb, line 6328 def self.return_description_of(i) i = i.first if i.is_a? Array _ = RBT::Action::Cookbooks::SanitizeCookbook.new(i) return _.description?.to_s end
#¶ ↑
RBT.return_games_components
¶ ↑
Return, as Array, all registered games that are part of the RBT
project.
Several aliases are available for this - see the aliases defined below the method here.
#¶ ↑
# File lib/rbt/toplevel_methods/games.rb, line 24 def self.return_games_components result = RBT.return_chained_programs['games'] if result.is_a? String result = result.split(',') end result.map!(&:strip) return result.sort end
#¶ ↑
return_gnome_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the Gnome stack.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 827 def self.return_gnome_components array = return_gnome1 array << return_gnome2 array << return_gnome3 array << return_gnome4 array << return_gnome5 array.flatten! return array end
#¶ ↑
RBT.return_gtk_widget
¶ ↑
This method should be moved into another .rb file in the long run, but for now it will just reside here.
#¶ ↑
# File lib/rbt/gui/universal_widgets/compile_program/compile_program.rb, line 758 def self.return_gtk_widget( which_widget = :compile_program ) result = nil case which_widget when :compile_program, :default result = ::RBT::GUI::Gtk::CompileProgram end return result end
#¶ ↑
RBT.return_homepage_of?
¶ ↑
This variant will silently return the homepage of a registered program, as a String.
If no homepage is registered in the .yml file then an empty String will be returned instead.
Usage example:
x = RBT.return_homepage_of? :htop # => "https://hisham.hm/htop/"
#¶ ↑
# File lib/rbt/cookbooks/homepage/homepage.rb, line 309 def self.return_homepage_of?(i = ARGV) _ = RBT::Cookbooks::Homepage.new(i) { :be_quiet } return _.homepage? end
#¶ ↑
RBT.return_kde5_applications
¶ ↑
This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.
As of 11.01.2020 there were 224 registered KDE5 applications in the RBT
project.
This can be determined via the following method:
RBT.return_kde5_applications.size
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 60 def self.return_kde5_applications result = return_chained_programs['kde5_applications'] result = result.split(',') if result.is_a? String result.map!(&:strip) return result end
#¶ ↑
RBT.return_kde5_foundation
¶ ↑
This method will return the Array of programs that constitute the KDE5 foundation.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 465 def self.return_kde5_foundation result = return_chained_programs['kde5_foundation'] result = result.split(',') if result.is_a? String result.map!(&:strip) return result end
#¶ ↑
RBT.return_kde5_plasma
¶ ↑
This method will return all registered KDE5 plasma components, via an Array. Whenever you need to obtain all KDE5-plasma components, you should use only this method.
In Januar 2020 there were 46 registered KDE5 plasma components.
This can be queried via: RBT.return_kde5_plasma
.size
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 450 def self.return_kde5_plasma result = return_chained_programs['kde5_plasma'] if result.is_a? String result = result.split(',') end result.map!(&:strip) return result end
#¶ ↑
RBT.return_kde5_porting_aids
¶ ↑
This will return all KDE5 porting aids.
Invoke this method like so:
ry --batch-compile=kde5_porting_aids
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 431 def self.return_kde5_porting_aids result = return_chained_programs['kde5_porting_aids'] result = result.split(',') if result.is_a? String result.map!(&:strip) return result end
#¶ ↑
RBT.return_kde5_portingaids
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 762 def self.return_kde5_portingaids( i = 1 ) result = nil big_array = return_porting_aids big_array.flatten! if i.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_location_to_this_programs_yaml_file
¶ ↑
Easier access-method to determine where the yaml file may be.
Invocation example:
RBT.return_location_to_this_programs_yaml_file 'ruby'
#¶ ↑
# File lib/rbt/toplevel_methods/return_location_to_this_programs_yaml_file.rb, line 23 def self.return_location_to_this_programs_yaml_file(i) i = i.to_s unless i.is_a? String unless i.end_with? '.yml' i = i.dup if i.frozen? i << '.yml' end result = "#{individual_cookbooks_directory?}#{i}".dup if is_on_roebe? # ===================================================================== # # Hardcoded on my own system. # ===================================================================== # possible_target = "#{DIRECTORY_INDIVIDUAL_COOKBOOKS_AT_ROEBE_HOME}#{i}".dup if File.exist? possible_target result = possible_target end end return result end
#¶ ↑
RBT.return_lxqt_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the LX-QT pool.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 522 def self.return_lxqt_components result = return_chained_programs['lxqt'] result = result.split(',') if result.is_a? String result.map!(&:strip) return result end
#¶ ↑
RBT.return_mate_desktop_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.
Usage example:
RBT.return_mate_desktop_components # => ["matedesktop", "libmatemixer", "libmateweather", etc...
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 135 def self.return_mate_desktop_components result = return_chained_programs['all_of_the_mate_desktop'] result = result.split(',') if result.is_a?(String) and result.include?(',') result.map!(&:strip) return result end
#¶ ↑
RBT.return_mate_desktop_version_array
(array tag)¶ ↑
This variant will return a nested Array with the proper versions in use.
Invocation example:
puts RBT.return_mate_desktop_version_array
#¶ ↑
# File lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb, line 696 def self.return_mate_desktop_version_array RBT::Action::ReportMateDesktopVersion.new { :do_not_report_anything }.array? end
#¶ ↑
RBT.return_mate_desktop_version_string
¶ ↑
This method will return the String that contains the information which mate-desktop components are available. That way we can then embed this String in other programs.
Usage example:
x = RBT.return_mate_desktop_version_string
#¶ ↑
# File lib/rbt/actions/individual_actions/information/report_mate_desktop_version.rb, line 712 def self.return_mate_desktop_version_string RBT::Action::ReportMateDesktopVersion.new { :do_not_report_anything }.string? end
#¶ ↑
RBT.return_post_xorg_server_components
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 615 def self.return_post_xorg_server_components result = return_chained_programs['xorg_server_and_post_xorg_server'] result = result.split(',') if result.is_a? String result.map!(&:strip) return result end
#¶ ↑
RBT.return_program_name_and_program_version_from_this_github_url
¶ ↑
This method will accept a String such as:
'https://github.com/commonmark/cmark/archive/0.29.0.tar.gz' 'https://github.com/brndnmtthws/conky/archive/v1.11.5.tar.gz'
It will then return something like:
'cmake-0.29.0' 'conky-1.11.5'
Thus, this is the program_name_and_program_version string from a valid cookbook .yml file.
Note that the method will NOT assume that the input to it is valid - it only works on input-strings such as the one specified above.
#¶ ↑
# File lib/rbt/toplevel_methods/url.rb, line 156 def self.return_program_name_and_program_version_from_this_github_url( i = 'https://github.com/commonmark/cmark/archive/0.29.0.tar.gz', use_this_as_the_program_name = nil ) result = ''.dup program_version = File.basename(i.dup) program_version = remove_archive_from_the_end( program_version.delete('v') # This .delete due to 'v'. ) if use_this_as_the_program_name.nil? use_this_as_the_program_name = i.split('/')[4] end result << "#{use_this_as_the_program_name}-#{program_version}" return result end
#¶ ↑
RBT.return_programs_from_this_url
¶ ↑
The task of this method is to return an Array of programs that can be found on a remote URL.
If we take the example below for KDE’s plasma related code, then the Array that will be returned will include the names of all the programs that can be found at that particular remote URL.
This then allows us to do various further checks, such as whether the RBT
project is tracking all these programs or not, and so forth.
The first input argument to this method is assumed to be a remote URL, as a String - so only pass an URL to the method here.
Specific invocation example in ruby:
pp RBT.return_program_from_this_url('https://download.kde.org/Attic/plasma/5.16.5/'); ''
Result will be an Array such as this one here:
["powerdevil", "sddmkcm", "systemsettings", "usermanager", "xdgdesktopportalkde"]
#¶ ↑
# File lib/rbt/toplevel_methods/url.rb, line 197 def self.return_programs_from_this_url(i) require 'open-uri' begin require 'program_information' unless Object.const_defined? :ProgramInformation rescue LoadError; end i = i.first if i.is_a? Array regex_to_use = /<tr><td valign="top"> <\/td><td><a href="(.+?)">/ # See: http://rubular.com/r/fIcvzXfPi1 dataset = URI.open(i).read scanned = dataset.scan(regex_to_use).flatten scanned.reject! {|entry| entry.end_with? '.sig' or entry.start_with? '/' } scanned.map! {|entry| entry.sub!(/\.xz$/,'') entry.sub!(/\.tar$/,'') program_name = ProgramInformation.return_program_name(entry) program_name } scanned.uniq! return scanned.sort end
#¶ ↑
RBT.return_programs_that_are_exlusively_registered_in_the_homebrew_programs
¶ ↑
Usage example:
x = RBT.return_programs_that_are_exlusively_registered_in_the_homebrew_programs
#¶ ↑
# File lib/rbt/homebrew/registered_programs_of_homebrew.rb, line 70 def self.return_programs_that_are_exlusively_registered_in_the_homebrew_programs require 'rbt/toplevel_methods/available_programs.rb' # ======================================================================= # # Obtain all available programs next. # ======================================================================= # available_programs = RBT.available_programs? # ======================================================================= # # Obtain all programs available in the homebrew "registry". We will # query this "registry" by parsing the homepage. # ======================================================================= # remote_registered_programs = RBT.return_all_registered_programs_of_homebrew.map {|entry| entry.delete('-_') } # On 25.08.2022 this Array had 4618 programs registered. remote_registered_programs.reject! {|entry| available_programs.include?(entry) } # On 25.08.2022, the unique entries at homebrew included # 3699 programs not registered in the RBT suite. return remote_registered_programs end
#¶ ↑
RBT.return_python_addons
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 70 def self.return_python_addons result = return_chained_programs['python_addons'] result = result.split(',') if result.is_a?(String) and result.include?(',') result.map!(&:strip) return result end
#¶ ↑
RBT.return_remote_url_from_this_input
¶ ↑
Give the below input, this method should return a String like:
https://ftp.gnu.org/gnu/glibc/glibc-2.28.tar.xz
In other words, you have to supply the arguments.
The method has to remain quite flexible. For instance, it must work correctly when the first argument is “github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1.tgz” and the second argument is a more complex variant such as “icu4c-68.2.tar.xz”.
#¶ ↑
# File lib/rbt/toplevel_methods/url.rb, line 31 def self.return_remote_url_from_this_input( remote_url = 'http://ftp.gnu.org/gnu/glibc/glibc-2.29.tar.xz', version = '2.28' ) # ======================================================================= # # First, get rid of any trailing archive parts for version, # such as "icu4c-68.2.tar.xz". Then we will have only # "icu4c-68.2" left, which is much better. # ======================================================================= # version = RBT.remove_archive_from_the_end(version) begin require 'program_information' if version.include? '-' # In this case assume something like "icu4c-68.2" version = ProgramInformation.return_version(version) end program_version = ProgramInformation.return_version(remote_url) result = remote_url.gsub( # Do a global sub since as of September 2022. program_version, version ) return result rescue LoadError; end end
#¶ ↑
RBT.return_string_containing_all_program_versions
¶ ↑
This method will return a string containing all programs versions of the registered programs that are part of the RBT
project. Do note that the yaml file at hand has to exist, in order for the code in this method to work properly.
#¶ ↑
# File lib/rbt/toplevel_methods/return_string_containing_all_program_versions.rb, line 21 def self.return_string_containing_all_program_versions file_location = RBT.file_programs_version if File.exist? file_location data = File.read(file_location) return data else no_file_exists_at(file_location) nil end end
#¶ ↑
RBT.return_string_containing_all_program_versions_the_last_update_and_the_remote_URL
¶ ↑
This method will return a much longer String, containing all program versions of the registered programs, as well as when the last update happened, and the remote URL.
This depends on the expanded cookbooks dataset.
The four entries should be:
(1) program name (2) program version (3) last update of this program (in regards to the cookbooks project) (4) remote URL
#¶ ↑
# File lib/rbt/toplevel_methods/return_string_containing_all_program_versions.rb, line 49 def self.return_string_containing_all_program_versions_the_last_update_and_the_remote_URL require 'yaml' return_this_string = ''.dup string = return_string_containing_all_program_versions if string string.split(N).sort.each {|line| # =================================================================== # # The line will be like this: # # zziplib: "0.13.66" # # =================================================================== # _ = line.split(':') program_name = _.first.delete('-') program_version = _.last.delete('"') this_file = "#{RBT.directory_expanded_cookbooks?}#{program_name}.yml" if File.exist? this_file dataset = YAML.load_file(this_file) last_update = dataset['last_update'] remote_URL = dataset['url1'] return_this_string << "#{program_name.ljust(28)} #{program_version.to_s.ljust(13)} #{last_update} #{remote_URL}\n" end } return return_this_string end end
#¶ ↑
RBT.return_string_showing_the_last_updated_programs
¶ ↑
This method will return a String showing the last updated programs.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 98 def self.return_string_showing_the_last_updated_programs _ = ''.dup into = "#{rbt_log_dir?}these_programs_were_updated_copy.yml" if is_on_roebe? and File.exist?("#{::RBT::RUBY_SRC_DIR}rbt/lib/rbt/yaml/these_programs_were_updated.yml") # ===================================================================== # # In this case prefer my file at home. # ===================================================================== # into = "#{::RBT::RUBY_SRC_DIR}rbt/lib/rbt/yaml/these_programs_were_updated_copy.yml" end if File.exist? into dataset = File.readlines(into) dataset.each {|line| # =================================================================== # # A line may look like this: # # - libhandy # program_version: 0.84.0 17.07.2020-12:08:21 # # =================================================================== # splitted = line.split('#').map(&:strip) name_of_the_program = splitted.first.delete('-').strip program_version = splitted.last.strip.sub(/program_version:/,''). strip.split(' ').first.to_s this_date = line.split(' ').last _ << "#{name_of_the_program} was updated "\ "to program version #{program_version} "\ "(on: #{this_date})\n" } return _ else no_file_exists_at(into) end end
#¶ ↑
RBT.return_the_associated_program_of_this_gir_file
¶ ↑
Invocation example:
RBT.return_the_associated_program_of_this_gir_file('xau.pc') # => "libxau"
#¶ ↑
# File lib/rbt/registered/registered_gir_files.rb, line 194 def self.return_the_associated_program_of_this_gir_file(i) YAML.load_file(file_registered_gir_files)[i] end
#¶ ↑
RBT.return_the_associated_program_of_this_m4_file
¶ ↑
Invocation example:
RBT.return_the_associated_program_of_this_m4_file('pkg.m4') # => "libxau"
#¶ ↑
# File lib/rbt/registered/registered_m4_files.rb, line 213 def self.return_the_associated_program_of_this_m4_file(i) YAML.load_file(file_registered_m4_files)[i] end
#¶ ↑
RBT.return_the_associated_program_of_this_pkgconfig_file
¶ ↑
Invocation example:
RBT.return_the_associated_program_of_this_pkgconfig_file('xau.pc') # => "libxau"
#¶ ↑
# File lib/rbt/registered/registered_pkgconfig_files.rb, line 218 def self.return_the_associated_program_of_this_pkgconfig_file(i) YAML.load_file(file_registered_pkgconfig_files)[i] end
#¶ ↑
RBT.return_the_program_belonging_to_this_header_file
¶ ↑
Usage examples:
RBT.return_the_program_belonging_to_this_header_file('ao.h') # => "libao" RBT.return_the_program_belonging_to_this_header_file('aoee.h') # => nil
#¶ ↑
# File lib/rbt/actions/individual_actions/headers/headers.rb, line 166 def self.return_the_program_belonging_to_this_header_file(i) RBT::Action::Headers.new(i).match? end
#¶ ↑
RBT.return_this_game_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --game1 ry --game4
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 24 def self.return_this_game_component(i) result = nil big_array = return_games_components big_array.flatten! if i.to_s.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end return result end
#¶ ↑
RBT.return_this_gnome_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --gnome1
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 797 def self.return_this_gnome_component( i = 1 ) result = nil big_array = return_gnome_components big_array.flatten! if i.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ======================================================================= # # Prevent too high numbers next: # ======================================================================= # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_this_kde_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation examples from the commandline:
ry --kde3 ry --kde1..kde250
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 678 def self.return_this_kde_component( i = 1 ) result = nil big_array = return_kde5_foundation # === KDE5 Foundation big_array << return_kde5_porting_aids # === KDE5 Porting Aids big_array << return_kde5_applications # === KDE5 Applications big_array << return_kde5_plasma # === KDE5 Plasma big_array.flatten! if i.include? '..' # ===================================================================== # # First we chop away 'kde' if this string exists. # ===================================================================== # i.sub!(/kde/,'') if i.include? 'kde' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # We need numbers past this point. We also have to prevent too # high numbers, which the following code will do for us. # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_this_lxqt_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --lxqt3
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 495 def self.return_this_lxqt_component(i) result = nil big_array = return_lxqt_components big_array.flatten! if i.to_s.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_this_mate_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --mate3
On my home system I can also use aliases such as these:
mate1 mate2 mate3
And so forth.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 160 def self.return_this_mate_component( i = 1 ) result = nil big_array = return_mate_desktop_components big_array.flatten! if i.to_s.include? '..' # ===================================================================== # # Handle pseudo-ranges here: # ===================================================================== # splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result, by deducting one. end return result end
#¶ ↑
RBT.return_this_plasma_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --plasma3
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 643 def self.return_this_plasma_component( i = 1 ) result = nil big_array = return_kde5_plasma # === KDE5 Plasma big_array.flatten! if i.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_this_xfce_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --xfce1
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 102 def self.return_this_xfce_component(i) result = nil big_array = return_xfce_components big_array.flatten! if i.to_s.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_this_xorg_component
¶ ↑
The input to this method should typically be a number, such as 1 (or its String-variant “1”).
Invocation example from the commandline:
ry --xorg1
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 540 def self.return_this_xorg_component(i) result = nil big_array = return_xorg_components big_array.flatten! if i.to_s.include? '..' splitted = i.split('..') first_number = splitted.first.to_i - 1 last_number = splitted.last.to_i - 1 last_number = (big_array.size - 1) if last_number > (big_array.size) result = big_array[first_number, last_number] else # ===================================================================== # # Prevent too high numbers next: # ===================================================================== # i = i.to_i # ← We need Integers past this point. i = (big_array.size - 1) if i > (big_array.size - 1) result = big_array[i - 1] # Find the proper result end result end
#¶ ↑
RBT.return_total_size_of_all_archives
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/archive_related_code.rb, line 37 def self.return_total_size_of_all_archives( use_this_key = :program_path ) total_size = 0 available_programs = available_programs? available_programs.each {|this_program| possible_target = "#{RBT.directory_expanded_cookbooks?}"\ "#{this_program}.yml" if File.exist? possible_target dataset = YAML.load_file(possible_target) program_path = dataset[use_this_key] else # =================================================================== # # The expanded-cookbooks file does not exist, so use # Cookbooks::Cookbook instead. # =================================================================== # require 'rbt/requires/require_the_cookbook_class.rb' program_path = ::RBT::Cookbooks::SanitizeCookbook.new(this_program).program_path? end if program_path and File.exist?(program_path) total_size += File.size(program_path) end } return total_size end
#¶ ↑
RBT.return_version_of_this_program
¶ ↑
Usage example:
RBT.return_version_of_this_program 'htop'
#¶ ↑
# File lib/rbt/toplevel_methods/return_version_of_this_program.rb, line 20 def self.return_version_of_this_program(i = 'htop') if i.is_a? Array i = i.first end i = i.to_s # We have to work on Strings. if RBT.does_include? i dataset = action(:SanitizeCookbook, i) { :fast } return dataset.program_version? else nil end end
#¶ ↑
RBT.return_xfce_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 83 def self.return_xfce_components(i = 'xfce') result = return_chained_programs[i] result = result.split(',') if result.is_a?(String) and result.include?(',') result.map!(&:strip) return result end
#¶ ↑
RBT.return_xfce_version_array
(array tag)¶ ↑
This variant will return a nested Array with the proper versions in use.
Invocation example:
puts RBT.return_xfce_version_array
#¶ ↑
# File lib/rbt/actions/individual_actions/information/report_xfce_version.rb, line 283 def self.return_xfce_version_array RBT::Action::ReportXfceVersion.new { :do_not_report_anything }.array? end
#¶ ↑
RBT.return_xfce_version_string
¶ ↑
This method will return the String that contains the information which mate-desktop components are available. That way we can then embed this String in other programs.
Usage example:
x = RBT.return_xfce_version_string
#¶ ↑
# File lib/rbt/actions/individual_actions/information/report_xfce_version.rb, line 299 def self.return_xfce_version_string RBT::Action::ReportXfceVersion.new { :do_not_report_anything }.string? end
#¶ ↑
RBT.return_xorg_components
¶ ↑
This method will conveniently return the Array holding all programs that belong to the KDE5 Application pool.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 203 def self.return_xorg_components array = [] array << return_xorg_data array << return_xorg_libraries array << return_xorg_utils array << return_xorg_apps array << return_xorg_fonts array << return_xorg_server_and_post_xorg_server array.flatten! return array end
#¶ ↑
RBT.return_xorg_server_and_post_xorg_server
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 605 def self.return_xorg_server_and_post_xorg_server result = return_chained_programs['xorg_server_and_post_xorg_server'] result = result.split(',') if result.include? ',' result.map!(&:strip) return result end
#¶ ↑
RBT.return_xorg_server_libraries
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 475 def self.return_xorg_server_libraries result = return_chained_programs[ try_to_find_shortcut_for_a_chain_compiled_program('xorg_server_libraries') ] result = result.split(',') if result.is_a? String result.map!(&:strip) return result end
#¶ ↑
RBT.returned_chained_programs_of_the_mate_desktop
¶ ↑
This will return the mate-desktop entry, in a sanitized manner, in Array form.
#¶ ↑
# File lib/rbt/constants/constants.rb, line 714 def self.returned_chained_programs_of_the_mate_desktop result = return_chained_programs['all_of_the_mate_desktop'] if result.is_a? String result = result.delete("\n").delete(' ') # ===================================================================== # # Turn it into an Array next. # ===================================================================== # result = result.split(',').flatten end return result end
#¶ ↑
RBT.run_make_then_make_install
¶ ↑
This method essentially runs “make”, followed by “make install”.
It was created not only in order to chain these two commands, but to also check for a directory called “BUILD_DIRECTORY” in the current working directory. If such a directory exists then we will cd into that directory before running “make” and “make install”.
#¶ ↑
# File lib/rbt/toplevel_methods/run_make_then_make_install.rb, line 25 def self.run_make_then_make_install _ = 'BUILD_DIRECTORY/' e; e; e e "#{Colours.rev}Starting with 'make', then 'make install'." e; e if File.directory? _ e e "#{rev}Changing directory into #{sdir(_)} #{rev}now." e cd _ end use_this_command = 'make' # ======================================================================= # # Normally we have to run 'make', but meson-systems require # ninja - thus we check for that next. # ======================================================================= # if File.exist? 'Makefile' # ===================================================================== # # In this case we will use the above 'make' command. # ===================================================================== # elsif File.exist? 'build.ninja' use_this_command = 'ninja' end esystem "#{use_this_command}" esystem "#{use_this_command} install" e; e; e end
#¶ ↑
RBT.run_makepkg_command
¶ ↑
This method will invoke the slackware “makepkg” command, in order to create a slackware package.
By default, this method will work from the current working directory, so it is recommended to have already extracted the target archive in question.
#¶ ↑
# File lib/rbt/toplevel_methods/run_makepkg_command.rb, line 22 def self.run_makepkg_command( i = :from_the_current_working_directory, optional_program_version = nil, use_this_architecture = RBT.determine_host_architecture # <= "x86_64" ) # ======================================================================= # # Determine which makepkg command variant to use next. # ======================================================================= # use_this_makepkg_command = 'makepkg --chown n --linkadd y' case i # ======================================================================= # # === :from_the_current_working_directory # ======================================================================= # when :from_the_current_working_directory, :default # This is the default. _ = File.basename(return_pwd) name_of_the_package, the_program_version = _.split('-') else # else depend on TWO input arguments: (a) name and (b) version. name_of_the_package = i the_program_version = optional_program_version end # ======================================================================= # # === Host Architecture # # The host architecture is currently "x86_64". This may change at # a later time, though; at the least it may be more flexible. # ======================================================================= # full_name_of_the_package = "#{name_of_the_package}-"\ "#{the_program_version}-"\ "#{use_this_architecture}"\ "-1.tgz" _ = use_this_makepkg_command+' ../'+full_name_of_the_package esystem(_) path_to_the_package = File.expand_path("../#{full_name_of_the_package}") return path_to_the_package end
#¶ ↑
RBT.run_meson_configure_step
¶ ↑
This will simply run “meson”.
#¶ ↑
# File lib/rbt/toplevel_methods/meson.rb, line 26 def self.run_meson_configure_step( use_this_prefix = '/usr/', use_this_build_directory = 'BUILD_DIRECTORY', &block ) configure_options = ''.dup is_padded = false use_colours = false meson_command = 'meson'.dup # ======================================================================= # # === Handle Hashes next # ======================================================================= # if use_this_prefix.is_a? Hash _ = use_this_prefix # ===================================================================== # # === :configure_options # ===================================================================== # if _.has_key?(:configure_options) and _[:configure_options] and !_[:configure_options].empty? configure_options << " #{_.delete(:configure_options)}" end # ===================================================================== # # === :use_this_as_build_directory # ===================================================================== # if _.has_key? :use_this_as_build_directory use_this_build_directory = _.delete(:use_this_as_build_directory) end # ===================================================================== # # The next entry point must come last. # ===================================================================== # if _.has_key? :prefix_to_use use_this_prefix = _.delete(:prefix_to_use).to_s end end # ======================================================================= # # Always use the absolute path here: # ======================================================================= # use_this_build_directory = File.absolute_path(use_this_build_directory) unless use_this_build_directory.end_with?('/') use_this_build_directory = use_this_build_directory.dup use_this_build_directory << '/' end # ======================================================================= # # === Handle blocks next # ======================================================================= # if block_given? yielded = yield case yielded # ===================================================================== # # === :colourized_and_padded # ===================================================================== # when :colourized_and_padded is_padded = true use_colours = true end end meson_command.prepend(' ') if is_padded meson_command << " --prefix=#{use_this_prefix.to_s}" meson_command << " --libdir=#{use_this_prefix.to_s}" meson_command << configure_options meson_command << " #{use_this_build_directory}" if use_colours require 'rbt/colours/html_colours.rb' if meson_command and meson_command.include?('--prefix=') and use_colours meson_command = meson_command.dup # =================================================================== # # === Colourize the prefix, in cornflowerblue(). # =================================================================== # colourized_command = meson_command.sub(/(--prefix=)(\/.+?)\s/, # See: https://rubular.com/r/Df8OzLqXGd olivedrab('\1')+ cornflowerblue('\2 ')+ ::Colours.remove_escape_sequences(teal('')) ) colourized_command.sub!(/meson/, mediumaquamarine('meson')) end end e if is_padded if use_colours e colourized_command e if is_padded system meson_command else esystem meson_command e if is_padded end end
#¶ ↑
RBT.sanitize_cookbook
¶ ↑
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/sanitize_cookbook/sanitize_cookbook.rb, line 6378 def self.sanitize_cookbook( i = ARGV, options_hash = {}, &block ) sanitize_cookbook = RBT::Action::Cookbooks::SanitizeCookbook.new( i, :do_not_run_yet, &block ) sanitize_cookbook.menu(options_hash) unless options_hash.empty? sanitize_cookbook.run return sanitize_cookbook end
#¶ ↑
RBT.sanitize_this_licence
¶ ↑
This method will take the given input and output a valid licence if possible. So, for instance, the input “gpl3” should be turned into “GPLv3”. The idea here is to have one unified method that will be able to consistently enforce valid licence names.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 177 def self.sanitize_this_licence(i) i = i.dup # Work on a copy, just in case. case i.downcase # ======================================================================= # # === GNU LGPL # ======================================================================= # when 'gnu lgpl' # This one should ideally be changed by the user. i = 'LGPL variant (should be specified clearly)' # ======================================================================= # # === LGPL # # Should have a version. # ======================================================================= # when 'lgpl' # This one should ideally be changed by the user. i = 'LGPL variant (should be specified clearly)' # ======================================================================= # # === gpl3 # ======================================================================= # when 'gpl3', 'gplv3' i = 'GPLv3' # ======================================================================= # # === gpl2 # ======================================================================= # when 'gpl2', 'gplv2' i = 'GPLv2' # ======================================================================= # # === GNU GPLv2 # ======================================================================= # when 'gnu gplv2' i = 'GPLv2 (should be GPLv2 only, not GNU GPLv2)' when '' # pass through # else # i = 'Unknown licence' end return i end
#¶ ↑
RBT.sanitize_url1_entry
¶ ↑
This method will sanitize a url1 entry from a cookbook .yml file.
Note that this code is currently (May 2020) a bit duplicated, because another file also handles this. In the long run we should unify both code parts, but for the time being I had to move on and just finish the variant here.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 843 def self.sanitize_url1_entry( i, hash = {} ) # ======================================================================= # # We must allow for symbols or strings as key. # ======================================================================= # use_this_as_the_key_for_url1 = :url1 if hash and hash.has_key?('url1') # Check whether we have a String here, nonetheless. use_this_as_the_key_for_url1 = 'url1' end url = hash[use_this_as_the_key_for_url1] i = i.first if i.is_a? Array case i # case tag # ======================================================================= # # === USE_URL_DOWNCASE # # Use the URL as program name but downcase it. # ======================================================================= # when 'USE_URL_DOWNCASE', 'USE_DOWNCASED' i = remove_archive_from_the_end(File.basename(url.downcase)) # ======================================================================= # # === FIRST_UNDERSCORE_IS_HYPHEN # ======================================================================= # when 'FIRST_UNDERSCORE_IS_HYPHEN', 'URL_REPLACE_UNDERSCORE' splitted = url.split('/') splitted[-1] = splitted[-1].tr('_','-') # Replace the '_' with a '-'. i = File.basename(splitted.join('/')) # ======================================================================= # # === PROGRAM_NAME_AND_PROGRAM_VERSION_WITHOUT_ALPHABET # ======================================================================= # when 'PROGRAM_NAME_AND_PROGRAM_VERSION_WITHOUT_ALPHABET' i = remove_archive_from_the_end( File.basename(url).dup ) # Example: brotli-v1.0.7.tar.gz splitted = i.split('-') splitted[1].gsub!(/[A-Za-z]/,'') i = splitted.join('-') # ======================================================================= # # === USE_URL_REPLACE_UNDERSCORE # # This variant is for entries such as "LMDB_0.9.23.tar.gz". # ======================================================================= # when 'USE_URL_REPLACE_UNDERSCORE', 'REPLACE_UNDERSCORES', 'URL_CONVERT_UNDERSCORE' i = remove_archive_from_the_end( File.basename(url).dup ). tr('_','-') # ======================================================================= # # === FIRST_UNDERSCORE_AS_HYPHEN_AND_OTHER_UNDERSCORES_AS_DOTS # ======================================================================= # when 'FIRST_UNDERSCORE_AS_HYPHEN_AND_OTHER_UNDERSCORES_AS_DOTS' i = remove_archive_from_the_end( File.basename(url).dup ). # Example: boost_1_72_0.tar.bz2 sub(/_/,'-'). tr('_','.') # ======================================================================= # # === USE_URL_LAST_HYPHEN_IS_DOT # ======================================================================= # when 'USE_URL_LAST_HYPHEN_IS_DOT' i = remove_archive_from_the_end(File.basename(url).dup) # Example: ImageMagick-7.0.9-25 i = i.reverse.sub('-','.').reverse # ======================================================================= # # === FIRST_DOT_AS_HYPHEN # ======================================================================= # when 'FIRST_DOT_AS_HYPHEN' i = remove_archive_from_the_end(File.basename(url).dup).sub(/\./,'-') # ======================================================================= # # === USE_URL_MIDDLE_HYPHENS # ======================================================================= # when 'USE_URL_MIDDLE_HYPHENS' i = remove_archive_from_the_end(File.basename(url).dup) i.sub!(/_/,'-') else if i.include? '-PROGRAM_VERSION' i.sub!(/PROGRAM_VERSION/, remove_archive_from_the_end( File.basename(url).dup). delete('v') ) end end return i end
#¶ ↑
RBT.set_array_these_ruby_gems_were_updated
¶ ↑
Setter method to modify the top-level instance variable called @array_these_ruby_gems_were_updated.
#¶ ↑
# File lib/rbt/toplevel_methods/rubygems.rb, line 30 def self.set_array_these_ruby_gems_were_updated(i) @array_these_ruby_gems_were_updated = i end
#¶ ↑
RBT.set_compile_these_programs
¶ ↑
Do note that whenever this method is called, the old value for @compile_these_programs will be overwritten.
#¶ ↑
# File lib/rbt/toplevel_methods/compile_these_programs.rb, line 42 def self.set_compile_these_programs( i, &block ) if i.is_a? Hash # ===================================================================== # # === :compile_these_programs # ===================================================================== # if i.has_key? :compile_these_programs i = i.delete(:compile_these_programs) end end # ======================================================================= # # We need an Array here: # ======================================================================= # i = [i].flatten.compact i.map! {|entry| # Will always be an Array. entry = entry.dup if entry.frozen? if block_given? yielded = yield case yielded # =================================================================== # # === :remove_underscore # =================================================================== # when :remove_underscore entry.delete!('_') end end if entry.is_a? String entry = action(:filter_for_valid_program_names, [entry, @dataset_containing_the_abbreviations] ) end # ===================================================================== # # The next line will remove '-' and '_' characters from the given # input. This, however had, may NOT be done when there is a # locally existing file with that name. On 23.11.2019 this was # disabled, because some binaries, such as "wx-config", may # include a '-' character. # ===================================================================== # entry # And return it here too. }.compact @compile_these_programs = i end
#¶ ↑
RBT.set_configuration
¶ ↑
This method will automatically invoke class RBT::Configuration::SimpleConfigurationLoader
.
It has to be manually called to some meaningful value in other code parts.
#¶ ↑
# File lib/rbt/configuration/configuration_instance_variable.rb, line 49 def self.set_configuration( i = RBT::Configuration::SimpleConfigurationLoader.new ) if i.is_a? String i = RBT::Configuration::SimpleConfigurationLoader.new(i) end @configuration = i end
#¶ ↑
RBT.set_cookbook_directory
¶ ↑
This setter-method can be used to determine where the individual cookbooks can be found normally.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 52 def self.set_cookbook_directory(i) if i # ← Assignment is only done if the user supplies a non-nil argument. unless i.end_with? '/' i = i.dup if i.frozen? i << '/' end @cookbook_directory = i end end
#¶ ↑
RBT.set_depot_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1160 def self.set_depot_directory( i = '/Depot/' ) i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/Depot/' if i.include? '$' # <- See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @depot_directory = i end
#¶ ↑
RBT.set_log_directory
¶ ↑
This defaults to “/Depot/Temp/rbt/” on my system.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 890 def self.set_log_directory( i = "#{RBT.temp_directory}rbt/" ) i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' i << '/' unless i.end_with? '/' # ======================================================================= # # Next, we must ensure that the required directories exist. # ======================================================================= # i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. # ======================================================================= # # In the past we did ensure that the required directories exist, # whenever RBT.set_log_directory() is called. But this does not # make that much sense, and can lead to other problems, so it # was disabled here at 24.01.2019. Do note that the functionality # of ensuring that the required directories exist will still be # handled by RBT, but in other code parts instead. # ======================================================================= # # require 'rbt/toplevel_methods/ensure_that_the_required_directories_exist.rb' # ^^^ this used to be on top # ======================================================================= # # ensure_that_the_required_directories_exist( # i # ) @log_directory = i end
#¶ ↑
RBT.set_packages_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 992 def self.set_packages_directory( i = '/Depot/Packages/' ) require 'rbt/toplevel_methods/convert_global_env.rb' i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/Depot/Packages/' if i.include? '$' # <- See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @packages_directory = i end
#¶ ↑
RBT.set_pkgconfig_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1235 def self.set_pkgconfig_directory( i = '/usr/lib/pkgconfig/' ) i = i.dup if i.frozen? require 'rbt/toplevel_methods/convert_global_env.rb' i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/usr/lib/pkgconfig/' if i.include? '$' # ← See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # ← Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @pkgconfig_directory = i end
#¶ ↑
RBT.set_programs_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 78 def self.set_programs_directory( i = :use_value_from_the_configuration_file # This is hardcoded default, but can be changed by the user through later calls. ) case i # ======================================================================= # # === :use_value_from_the_configuration_file # ======================================================================= # when :use_value_from_the_configuration_file use_this_file = RBT.file_programs_directory if File.exist? use_this_file i = YAML.load_file(use_this_file) else # else assume e. g. windows. i = '/home/Programs/' end end i = i.dup if i.frozen? # ======================================================================= # # Replace all $ with proper env-variables if they are included. # ======================================================================= # i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case we will use a hardcoded entry instead. It is # up to the user to resolve this problem, as it should not really # happen. # ======================================================================= # i = '/home/Programs/' if i.include? '$' # ← See above for the explanation. i = i.dup if i.frozen? # ← Need to do so again, e. g. in a .cgi environment context. i << '/' unless i.end_with? '/' i.squeeze!('/') @programs_directory = i end
#¶ ↑
RBT.set_source_base_directory
¶ ↑
Note that the environment variable called RBT_SOURCE_DIRECTORY can be used to use another default value.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 722 def self.set_source_base_directory( i = :default_but_consider_environment_variables # <- Preferred default. ) case i # ======================================================================= # # === :default_but_consider_environment_variables # ======================================================================= # when :default_but_consider_environment_variables # ===================================================================== # # Handle the environment-variable RBT_SOURCE_DIRECTORY first, as # it has a higher priority in this case. # ===================================================================== # if ENV.has_key? 'RBT_SOURCE_DIRECTORY' i = ENV['RBT_SOURCE_DIRECTORY'].to_s.dup else # =================================================================== # # else the user does not have this ENV-variable, so we use the # "regular" default. # =================================================================== # i = @source_base_directory end # ======================================================================= # # This is for the "regular" default. This one will always assign. # ======================================================================= # when :default, nil, '' i = @source_base_directory end i = i.dup if i.frozen? i = RBT.convert_global_env(i) if i.include? '$' i = @source_base_directory if i.include? '$' # <- Overrule missing environment variables. i << '/' unless i.end_with? '/' @source_base_directory = i end
#¶ ↑
RBT.set_sysbin_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 645 def self.set_sysbin_directory( i = '/System/Index/bin/' ) require 'rbt/toplevel_methods/convert_global_env.rb' i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/System/Index/bin/' if i.include? '$' # <- See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @sysbin_directory = i end
#¶ ↑
RBT.set_sysetc_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 826 def self.set_sysetc_directory( i = '/System/Index/etc/' ) require 'rbt/toplevel_methods/convert_global_env.rb' i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/System/Index/etc/' if i.include? '$' # <- See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @sysetc_directory = i end
#¶ ↑
RBT.set_sysinclude_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1197 def self.set_sysinclude_directory( i = '/System/Index/include/' ) require 'rbt/toplevel_methods/convert_global_env.rb' i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/System/Index/include/' if i.include? '$' # <- See above for the explanation. i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. i << '/' unless i.end_with? '/' i.squeeze!('/') @sysinclude_directory = i end
#¶ ↑
RBT.set_syslib_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1031 def self.set_syslib_directory( i = :infer_which_path_to_use_for_syslib ) require 'rbt/toplevel_methods/convert_global_env.rb' case i # ======================================================================= # # === :infer_which_path_to_use_for_syslib # # This here will automatically determine the target for the # syslib-directory. # ======================================================================= # when :infer_which_path_to_use_for_syslib if is_this_a_real_gobolinux_system? i = '/System/Index/lib/' # This is the path on a GoboLinux system. else i = '/usr/lib/' end end i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/System/Index/lib/' if i.include? '$' # ← See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # ← Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @syslib_directory = i end
#¶ ↑
RBT.set_system_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 616 def self.set_system_directory( i = '/System/' ) i = i.dup if i.frozen? i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/System/' if i.include? '$' # ← See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # ← Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @system_directory = i end
#¶ ↑
RBT.set_system_settings_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1122 def self.set_system_settings_directory( i = '/System/Settings/' ) i = i.dup if i.frozen? require 'rbt/toplevel_methods/convert_global_env.rb' i = convert_global_env(i) if i.include? '$' # ======================================================================= # # If there is still at the least one '$' entry then this variable does # not exist. In this case, use a hardcoded entry instead. # ======================================================================= # i = '/System/Settings/' if i.include? '$' # <- See above for the explanation. i << '/' unless i.end_with? '/' i = i.dup if i.frozen? # <- Need to do so again, e. g. in a .cgi environment context. i.squeeze!('/') @system_settings_directory = i end
#¶ ↑
RBT.set_temp_directory
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 546 def self.set_temp_directory( i = '/tmp/' ) i = convert_global_env(i) if i.include? '$' if i.include? '$' i = '/tmp/' # Use a default value in this case. end unless i.end_with? '/' # We must ensure that the last charcter is always a '/'. i = i.dup if i.frozen? i << '/' end @temp_directory = i end
#¶ ↑
RBT.set_xorg_buffer
¶ ↑
This method depends on the external gem called xorg_buffer.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 820 def self.set_xorg_buffer(i, notify_if_xsel_is_not_installed = true) begin require 'xorg_buffer' unless Object.const_defined? :XorgBuffer rescue LoadError; end if Object.const_defined? :XorgBuffer if is_xsel_available? XorgBuffer.set_xorg_buffer(i) { :be_quiet } elsif notify_if_xsel_is_not_installed e 'xsel is not installed - the xorg-buffer can not be used.' end end end
#¶ ↑
RBT.set_yaml_engine
¶ ↑
This method will assign (and thus keep track of) the yaml engine that the RBT
project will use. Since some time this is standard psych; in the past it used to be syck.
#¶ ↑
# File lib/rbt/requires/require_yaml.rb, line 24 def self.set_yaml_engine(i) case i # case tag # ======================================================================= # # === :psych # ======================================================================= # when :psych, :default # ← psych is the default since some time. # ===================================================================== # # pass through because psych is the default yaml engine that will # work without modification. # ===================================================================== # when :syck begin require 'syck' rescue LoadError; end begin YAML::ENGINE.yamler = 'syck' rescue NameError; end end @yaml_engine = i end
#¶ ↑
RBT.sfancy
¶ ↑
#¶ ↑
# File lib/rbt/colours/rev_simp_sdir_sfancy_sfile_and_swarn.rb, line 146 def self.sfancy( i = '', use_colours = use_colours? ) if use_colours if HASH_DESIGNATED_COLOURS.empty? return COLOURS.sfancy(i) else return COLOURS::HtmlColoursMethods.send(user_designated_colour(:sfancy), i) end end return i end
#¶ ↑
RBT.show_available_utility_scripts
¶ ↑
Simply show all available utility scripts.
Invocation example from the commandline:
cookbooks --show-available-scripts
#¶ ↑
# File lib/rbt/toplevel_methods/show_available_utility_scripts.rb, line 23 def self.show_available_utility_scripts files = Dir["#{utility_scripts?}*.rb"].sort.map {|file| File.basename(file) } files = files - ['utility_scripts.rb'] e; files.each_with_index {|file, index| index += 1 e "#{sfancy(index.to_s.rjust(4))}#{rev}) #{simp(file)}" }; e end
#¶ ↑
RBT.show_compile_chain
¶ ↑
Usage example:
RBT.show_compile_chain(:kde5_plasma)
#¶ ↑
# File lib/rbt/actions/individual_actions/show_compile_chain/show_compile_chain.rb, line 176 def self.show_compile_chain( i = ARGV, options_hash = {}, &block ) result = [] [i].flatten.compact.each {|this_program| result << RBT::Action::ShowCompileChain.new(this_program, &block) } return result.flatten # Return the Array here. end
#¶ ↑
RBT.show_configuration_options
¶ ↑
This variant must report the result onto the commandline.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/show_configuration_options/show_configuration_options.rb, line 808 def self.show_configuration_options( i = ARGV, &block ) RBT::Action::Cookbooks::ShowConfigurationOptions.new(i, &block) end
#¶ ↑
RBT.show_last_configure_option
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/show_last_configure_option.rb, line 15 def self.show_last_configure_option( _ = RBT.store_the_last_configuration_options_in_this_file ) if File.exist? _ # ===================================================================== # # The next two lines are mostly for debug-related output. # require 'rbt/colours/rev_simp_sdir_sfancy_sfile_and_swarn.rb' # e 'Obtaining the information from the file `'+sfile(_)+'`.' # ===================================================================== # e File.read(_) else e "No configure options have been stored yet "\ "(File checked: #{_})." end end
#¶ ↑
RBT.show_overview_over_available_utility_scripts
¶ ↑
This method will show all available utility scripts and provide an overview over them.
To trigger this method, do:
cookbooks OVERVIEW cookbooks --show-available-utility-scripts
#¶ ↑
# File lib/rbt/utility_scripts/show_overview_over_available_utility_scripts.rb, line 24 def self.show_overview_over_available_utility_scripts begin require 'class_docu_shower' rescue LoadError; end target = "#{utility_scripts?}*.rb" available_files = Dir[target] if Object.const_defined? :ClassDocuShower available_files.each {|file| cliner ClassDocuShower[file] # Delegate towards ClassDocuShower here. } else opn(namespace: RBT::NAMESPACE[:namespace]) e 'The class ClassDocuShower is not available.' e opn(namespace: RBT::NAMESPACE[:namespace]) e 'It can be installed via:' e opn(namespace: RBT::NAMESPACE[:namespace]) e ' gem install class_docu_shower' e end end
#¶ ↑
RBT.show_registered_binaries
¶ ↑
#¶ ↑
# File lib/rbt/registered/registered_binaries.rb, line 254 def self.show_registered_binaries _ = ::RBT.registered_binaries? RegisteredBinaries.opnn; e 'These '+_.size.to_s+' binaries are registered:' e _.reject {|entry| entry.to_s.empty? }.join(', ').strip.chop end
#¶ ↑
RBT.show_the_gnome_ftp_listing
¶ ↑
This method will simply show the remote FTP listing of gnome, on the commandline.
The reason for the existance of this method has been to allow the user to quickly scan for new gnome-specific updates.
The URL to gnome may look like this:
https://download.gnome.org/sources/?C=M&O=D
#¶ ↑
# File lib/rbt/toplevel_methods/ftp.rb, line 116 def self.show_the_gnome_ftp_listing( show_n_results = 50 # Determine how many results to show to the user. ) # ======================================================================= # # Notify the user which URL is used next: # ======================================================================= # e "#{rev}Trying to collect data from `#{GNOME_FTP_URL}` next." dataset = URI.open(GNOME_FTP_URL).read.split("\n") hash_programs = {} dataset.each {|line| # ===================================================================== # # === <td class="indexcolicon"><a href="easytag/"><img src="/icons2/folder.png" # # See the following URL: # # https://rubular.com/r/d9CvpYvkqhRZwU # # ===================================================================== # if line.include? '<td class="link"><a href="' use_this_regex = /<td class="link"><a href="([a-zA-Z0-9-]+)\// name_of_the_program = line.scan( use_this_regex ).flatten.first end hash_programs[name_of_the_program] # ===================================================================== # # === <td class="date"> # # Obtain the last time-modification next. # # See the following URL: # # https://rubular.com/r/qhpkYJS8SUoi6g # # ===================================================================== # if line.include? '<td class="date">' last_update = line.scan( /<td class="date">(\d{4}-[a-zA-Z]{3,5}-\d{2} \d{2}:\d{2})<\/td>/ ).flatten.first if name_of_the_program hash_programs[name_of_the_program] = Time.parse(last_update) end end } index = 0 e today_is = ::Time.now # Grab hold of today's date. if hash_programs.empty? e 'No program was found.' else hash_programs.each_pair {|key, value| index += 1 next if index > show_n_results padded_index = index.to_s.rjust(4)+') ' if (value.year == today_is.year) and (value.month == today_is.month) and (value.day == today_is.day) colourized_date = lightgreen(value.to_s) else colourized_date = forestgreen(value.to_s) end e royalblue(padded_index)+ steelblue(key.ljust(30))+ ' → '+ colourized_date } e end end
#¶ ↑
RBT.show_tutorial
¶ ↑
This will show a tutorial to the user, instructing them how to use the Cookbooks
project.
Usage example:
rbt --tutorial cookbooks --tutorial
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 679 def self.show_tutorial( try_to_use_colours = true ) require 'io/console' display_this_message = "\n[Press any key to continue; q to exit early]" # ========================================================================= # # The file for the short tutorial can be seen in # "tutorial/short_tutorial.md". # ========================================================================= # _ = RBT.file_short_tutorial? if File.exist? _ dataset = File.readlines(_) # Display the file next. chunks = dataset.each_slice(20).to_a counter = 0 e rev # And a newline to start with. loop { content_that_will_be_displayed = chunks[counter] if try_to_use_colours content_that_will_be_displayed.map! {|line| # ================================================================= # # Next colourize anything that is indented with 4 leading spaces. # ================================================================= # line.gsub(/^( .+)$/, lightgreen('\1')) } end e content_that_will_be_displayed # ===================================================================== # # Next, display the "press any key to continue" message. # ===================================================================== # if try_to_use_colours display_this_message = mediumseagreen(display_this_message) end e display_this_message case STDIN.getch when 'q' exit else counter += 1 exit if counter >= chunks.size end } else e "#{rev}No file exists at #{sfile(_)}" end end
#¶ ↑
RBT.simp
¶ ↑
#¶ ↑
# File lib/rbt/colours/rev_simp_sdir_sfancy_sfile_and_swarn.rb, line 66 def self.simp( i = '', use_colours = RBT.use_colours? ) if use_colours? if HASH_DESIGNATED_COLOURS.empty? return COLOURS.simp(i) else return COLOURS::HtmlColoursMethods.send(user_designated_colour(:simp), i) end end return i end
#¶ ↑
RBT.simple_appdir_configure
¶ ↑
This method can be used predominantly from a local directory, to invoke a “configure”, “make” and “make install” run.
Since as of 29.12.2019, the method also responds to –cmake as option.
Example for this latter use case, from the commandline:
appconf --cmake
If you use a build directory then you may wish to notify this method about it, via:
appconf --down
Since as of February 2023, a new class was added, and the option “–use-meson” was added, to force the use of meson. The latter was necessary as a few programs come with support for both “configure” as well as “meson”, so we need a commandline way to pick either one.
#¶ ↑
# File lib/rbt/actions/individual_actions/simple_appdir_configure/simple_appdir_configure.rb, line 360 def self.simple_appdir_configure(i = ARGV) RBT::Action::SimpleAppdirConfigure.new(i) end
#¶ ↑
RBT.software_manager
¶ ↑
This method must be guaranteed to always be a direct wrapper over class RBT::Action::SoftwareManager
.
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/software_manager.rb, line 97 def self.software_manager( i = ARGV, &block ) RBT::Action::SoftwareManager.new(i, &block) end
#¶ ↑
RBT.source_base_directory?
¶ ↑
This is a simple query-method for the source directory in use (called “source base directory”).
The default value to it is “/home/x/SRC/” on my system - which may be different on other computers, which is why this has to be settable and modifiable by the user via the setter method called RBT.set_source_base_directory()
.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 710 def self.source_base_directory? @source_base_directory end
#¶ ↑
RBT.static_overview_of_the_available_binaries_on_this_computer_system
¶ ↑
#¶ ↑
# File lib/rbt/utility_scripts/static_overview_of_the_available_binaries_on_this_computer_system.rb, line 161 def self.static_overview_of_the_available_binaries_on_this_computer_system RBT::StaticOverviewOfTheAvailableBinariesOnThisComputerSystem.new end
#¶ ↑
RBT.statistics?
¶ ↑
This method will return an Array, showcasing how many programs were registered at certain dates (time stamps).
This will be based on reading in the content of the file called ‘cookbook_statistics.md’. The extracted rbt gem will have this .md file, should you need it.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 227 def self.statistics?( this_file = '/home/x/programming/ruby/src/rbt/doc/statistics/cookbook_statistics.md' ) result = [] if File.exist? this_file _ = File.readlines(this_file).select {|line| line.include? '→' } _.map! {|entry| # ===================================================================== # # Sort first by date, then by n programs. # # See: https://rubular.com/r/5O9frs0hmuqI4Q # ===================================================================== # entry =~ /→\s*(\d{1,5})(.+)(\d{2}\.\d{2}\.\d{4})/ entry = [$3.to_s.dup, $1.to_s.dup.to_i] entry } result = _ end return result end
#¶ ↑
RBT.stderr
¶ ↑
By default, “puts” in ruby writes to STDOUT. We can use STDERR.puts to send to the error-stream specifically.
The best practice is to log debugging information, errors, warnings, status and so forth to STDERR; actual program output should go towards STDOUT.
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 643 def self.stderr( i = '', use_puts_or_print = :puts ) if i.is_a? Array i = i.join end case use_puts_or_print # ======================================================================= # # === :puts # ======================================================================= # when :puts $stderr.puts i # ======================================================================= # # === :print # ======================================================================= # when :print, :use_print $stderr.print i else e 'Unknown input at line 35 in the method RBT.stderr().' end end
#¶ ↑
RBT.store_abbreviations
¶ ↑
This method will store the abbreviations to the programs in a file.
To invoke this method on the commandline do:
rbt --generate-abbreviations
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 46 def self.store_abbreviations( into = RBT.file_abbreviations ) what = return_all_abbreviations_of_this_array what = YAML.dump(what) e "#{::Colours.rev}Storing into the file `#{::Colours.sfile(into)}#{::Colours.rev}`." write_what_into(what, into) if is_on_roebe? # ===================================================================== # # Also store this in my home directory, the respective yaml # directory. # ===================================================================== # into = RUBY_SRC_DIR_RBT_YAML+ File.basename(into.delete_suffix('.yml'))+'/'+ File.basename(into) e "#{::Colours.rev}Also storing into the file "\ "`#{::Colours.sfile(into)}#{::Colours.rev}`." write_what_into(what, into) end end
#¶ ↑
RBT.store_available_programs_into_a_yaml_file
¶ ↑
This method will, upon being invoked, store the available programs in a yaml file. This is only useful on my home system, though - regular users can just use the generated .yml file as-is.
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 26 def self.store_available_programs_into_a_yaml_file( array = ::RBT.array_available_programs ) require 'yaml' dataset = YAML.dump(array) file = "#{RUBY_SRC_DIR_RBT_YAML}available_programs/available_programs.yml" e "#{rev}Storing into `#{file}#{rev}`." write_what_into(dataset, file) end
#¶ ↑
RBT.store_the_last_configuration_options_in_this_file
¶ ↑
You can also use this alias-method for invoking the method:
RBT.store_the_last_configuration_options_into_which_file? # => "/Depot/Temp/rbt/last_configure_options_used.md"
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 927 def self.store_the_last_configuration_options_in_this_file "#{RBT.store_into_this_directory?}"\ "last_configure_options_used_through_class_show_configuration_options.md" end
#¶ ↑
RBT.store_the_string_into_a_md_file
¶ ↑
Note that this method will store into the log-directory.
#¶ ↑
# File lib/rbt/toplevel_methods/return_string_containing_all_program_versions.rb, line 82 def self.store_the_string_into_a_md_file RBT.initialize_configuration unless RBT.configuration_has_been_initialized_already? # e RBT.return_string_containing_all_program_versions string = RBT.return_string_containing_all_program_versions_the_last_update_and_the_remote_URL e string into = "#{RBT.log_dir?}programs_version_url.md" write_what_into(string, into) e "#{rev}Also stored into the file at `#{into}`." end
#¶ ↑
RBT.store_this_expanded_dataset_into_that_yaml_file
¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 756 def self.store_this_expanded_dataset_into_that_yaml_file( expanded_dataset, yaml_file ) write_what_into(expanded_dataset, yaml_file) # ===================================================================== # # Since as of May 2020, on roebe systems, we will also store this. # ===================================================================== # if is_on_roebe? yaml_file = "#{RUBY_SRC_DIR_RBT_YAML}expanded_cookbooks/#{File.basename(yaml_file)}" write_what_into(expanded_dataset, yaml_file) end end
#¶ ↑
RBT.suggest_cookbook_for
¶ ↑
This is a simpler toplevel-method for the functionality defined in this .rb file.
#¶ ↑
# File lib/rbt/actions/individual_actions/cookbooks/suggest_cookbook_for/suggest_cookbook_for.rb, line 827 def self.suggest_cookbook_for( this_program = ARGV, &block ) return RBT::Action::Cookbooks::SuggestCookbookFor.new(this_program, &block) end
#¶ ↑
RBT.swift_return_version_of_this_program
¶ ↑
This method here is different from RBT.return_version_of_this_program()
Rather than instantiate a new RBT::Cookbooks::SanitizeCookbook object, we just query the version from a yaml file directly. This is obviously much faster, as we don’t have to do any sanitize-operation and other method calls related to this.
The obvious drawback is that we may have to manually update that yaml file and keep it up-to-date - but the advantage by far outweighs this disadvantage. This method here will be much faster than RBT.return_version_of_this_program()
- and ideally, you should use it, rather than the other method.
If the program in question can not be found, this method will return nil.
Invocation examples:
RBT.swift_return_version_of_this_program(:ruby) # => "2.3.1" RBT.swift_return_version_of_this_program(:htop) # => "2.0.2" RBT.swift_return_version_of_this_program(:awk) # => "2.0.2"
#¶ ↑
# File lib/rbt/toplevel_methods/swift_return_version_of_this_program.rb, line 39 def self.swift_return_version_of_this_program( this_program = :htop ) require 'rbt/toplevel_methods/available_programs.rb' require 'rbt/toplevel_methods/does_include.rb' this_program = this_program.to_s # ======================================================================= # # Next, try to pass it against a list of aliases, if it has not # been yet "findable". # ======================================================================= # if !RBT.does_include?(this_program, :ignore_aliases) require 'rbt/aliases/aliases.rb' possible_alternative_name = RBT.find_cookbook_alias_for(this_program) if possible_alternative_name if possible_alternative_name != this_program this_program = possible_alternative_name end end end # ======================================================================= # # Load up the file that contains the programs-version information: # # This may reside at a location such as this one here: # # /Programs/Ruby/2.6.4/lib/ruby/site_ruby/2.6.0/rbt/yaml/programs_version.yml # # The old code until June 2020 was: # # _ = RBT.file_programs_version # # On 11.06.2020 this was changed, to use the "bigfile" instead. # # ======================================================================= # _ = RBT.file_programs_version _ = RBT.file_available_programs_versions if File.exist? _ # This is e. g. "rbt/yaml/programs_version/available_programs_versions.md" dataset = File.readlines(_) # Read in the file next. selection = dataset.select {|entry| entry.start_with? "#{this_program} " } if selection and !selection.empty? selection = selection.first splitted = selection.split(' ') program_version = splitted[1].sub(/.src$/,'') return program_version end else e "#{rev}No file called `#{sfile(_)}#{rev}` exists." raise FileDoesNotExist, "#{_} does not exist." end return nil # Default return value here. end
#¶ ↑
RBT.symlink
(symlink tag)¶ ↑
Wrapper to symlink something, by delegating towards class Symlink.
This could also be adapted to work on Windows.
Please use this and only this method consistently when wanting to create a symlink from within the RBT
project.
Here we have to be careful with the arguments, because File.symlink will fail if the file already exists. Right now we default to the behaviour that we will ALWAYS remove any file that exists at ‘new_location`.
#¶ ↑
# File lib/rbt/toplevel_methods/symlink.rb, line 27 def self.symlink( existing, new_location = nil, be_verbose = true, use_colours = RBT.use_colours? # Here we need colours/colours.rb ) case be_verbose # == :be_quiet when :be_quiet, :be_silent be_verbose = false # === :default when :default be_verbose = true end if existing.is_a? Hash # ===================================================================== # # === :to # ===================================================================== # if existing.has_key? :to new_location = existing.delete(:to) end # ===================================================================== # # === :from # ===================================================================== # if existing.has_key? :from existing = existing.delete(:from) end end # ======================================================================= # # === Delegate towards class Symlink next, after a check # ======================================================================= # unless Object.const_defined? :Symlink require 'rbt/toplevel_methods/roebe.rb' if is_on_roebe? e '(from rbt/toplevel_methods/symlink.rb): class Symlink '\ 'is not available - consider installing it.' end end _ = Symlink.new( existing, new_location, be_verbose, :do_not_run_yet ) unless _.namespace?.start_with? 'RBT→' _.prepend_this_to_namespace 'RBT→' end _.shall_we_use_colours?(use_colours) # ======================================================================= # # For understanding the next line look at USE_ABSOLUTE_SYMLINKING above. # ======================================================================= # _.use_absolute_symlinking if USE_ABSOLUTE_SYMLINKING _.disable_opn if RBT.do_not_show_names? _.run end
#¶ ↑
RBT.symlink_appdir_libraries_into_usr_lib_directory
¶ ↑
The following method is very specialized - it will symlink all entries under lib/* into the /usr/lib/ hierarchy.
This will be invoked as part of the postinstallation-steps, but only if we make use of an AppDir layout, and only if we are on a roebe-system (aka my home directory normally).
#¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 780 def self.symlink_appdir_libraries_into_usr_lib_directory( from_this_appdir_library_target ) e "#{rev}Now obtaining all entries from the directory `"\ "#{sdir(from_this_appdir_library_target)}#{rev}`:" entries = Dir["#{from_this_appdir_library_target}*"] entries.each {|this_library| symlink( this_library, "/usr/lib/#{File.basename(this_library)}" ) } end
#¶ ↑
RBT.test_this_alias
¶ ↑
This method here is mostly used by a .rb file under the rbt/bin/ hierarchy.
#¶ ↑
# File lib/rbt/toplevel_methods/available_programs.rb, line 73 def self.test_this_alias(i) require 'rbt/aliases/aliases.rb' e "#{rev}This program will test whether the given input is:" e e ' - a registered cookbook program (1)' e ' - a registered cookbook alias (2)' e ' - a registered cookbook abbreviation (3)' e e 'in precisely this order.' e i = [i].flatten.compact i.each {|entry| if RBT.is_a_registered_cookbook_program?(entry) e 'Yes, '+RBT.sfancy(entry)+rev+' is a registered cookbook program.' else e 'No, '+RBT.sfancy(entry)+rev+' is NOT a registered cookbook program.' end if RBT.is_an_alias?(entry) e 'Yes, '+RBT.sfancy(entry)+rev+' is an alias.' else e 'No, '+RBT.sfancy(entry)+rev+' is NOT an alias.' end if RBT.is_an_abbreviation?(entry) e 'Yes, '+RBT.sfancy(entry)+rev+' is an abbreviation.' else e 'No, '+RBT.sfancy(entry)+rev+' is NOT an abbreviation.' end } end
#¶ ↑
RBT.toplevel_methods?
¶ ↑
Simply return the constant here. This will tell us where the module_method .rb files are kept.
This will typically return a path such as:
/Programs/Ruby/2.6.0/lib/ruby/site_ruby/2.6.0/rbt/toplevel_methods/
#¶ ↑
# File lib/rbt/constants/constants.rb, line 574 def self.toplevel_methods? "#{RBT.project_base_directory?}toplevel_methods/" end
#¶ ↑
RBT.try_to_find_shortcut_for_a_chain_compiled_program
¶ ↑
Use this method if you wish to find a shortcut.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_find_shortcut_for_a_chain_compiled_program.rb, line 15 def self.try_to_find_shortcut_for_a_chain_compiled_program( i ) if i.is_a? Array i = i.first # Only care about the first member of a given Array. end i = i.to_s.delete('_') # Since as of Aug 2011, we will get rid of all '_' characters. i = case i # case tag # ======================================================================= # # === kde # ======================================================================= # when 'kde', 'kde3', 'kde4', 'kd', 'default' 'kde' # ======================================================================= # # === kde1 # # This entry point is used as a shortcut for the programs listed in # KDE5 foundation. # ======================================================================= # when 'kde1', /kde5(_|-| )?foundation/ 'kde5_foundation' # ======================================================================= # # === xorg_libraries # ======================================================================= # when 'libs', 'libraries', 'xorg3', 'xorglibraries', 'x3', '3', /^-?-?compile(-|_)?xorg(-|_)?base$/i, /^-?-?xorg(-|_)?server(-|_)?libraries$/i 'xorg_libraries' # ======================================================================= # # === games # ======================================================================= # when 'games', 'gam' 'games' # ======================================================================= # # === protos # ======================================================================= # when 'protos', 'proto', 'xorgprotos', 'xorg1', 'x1', '1' 'xorg_protos' # ======================================================================= # # === utils # ======================================================================= # when 'utils', 'xorgutils', 'xorg2', 'x2', '2' 'xorg_utils' # ======================================================================= # # === data # ======================================================================= # when 'data', 'xorg4', 'xorgdata', 'x4', '4' 'xorg_data' # ======================================================================= # # === xorg_apps # ======================================================================= # when /xorg(_|-)?apps/, 'apps', 'xorg5', 'x5', '5' 'xorg_apps' # ======================================================================= # # === fonts # ======================================================================= # when 'fonts', 'xorg6', 'xorgfonts', 'x6', '6' 'xorg_fonts' # ======================================================================= # # === server # ======================================================================= # when 'server', 'xorg7', 'xorgserver', 'x7', '7' 'xorg_server' # ======================================================================= # # === addons # ======================================================================= # when 'addons', 'ruby_addons', 'rubyaddons', 'raddons', 'raddon', 'rub', 'r', 'rand', 'all', '8' 'ruby_addons' # ======================================================================= # # === python # ======================================================================= # when 'python', 'mypython', 'pp', 'pyt', 'pyth', '9' 'my_python' # ======================================================================= # # === gnome # ======================================================================= # when 'gnome', 'xorg10', '10' 'gnome5' # ======================================================================= # # === e # ======================================================================= # when 'e','11','xorg11','e17' 'e17' # ======================================================================= # # === audio_suite # ======================================================================= # when 'audio_suite','audsuite' 'aud_suite' when 'video_base','vidbase','vid_base', /video(_|-)?subsection/ 'vid_base' else i # Else return the input unaltered. end return i end
#¶ ↑
RBT.try_to_return_a_special_compile_component
¶ ↑
This method will take an input, such as “–kde1”, and return an associated program, if possible.
The reason why this method exists is so that we can use input such as “compile kde1” and just compile the first kde component that is registered. It is thus a convenient shortcut - we don’t have to remember any names if we don’t want to.
#¶ ↑
# File lib/rbt/toplevel_methods/try_to_return_a_special_compile_component.rb, line 226 def self.try_to_return_a_special_compile_component(i) case i # case tag, menu tag # ======================================================================= # # === Compile a specific GNOME component # # This entry point allows us to use numbers in order to return # a particular gnome component, and then proceed to compile it. # So for example, "gnome1" will compile the first gnome component, # "gnome2" will refer to the second gnome component and so forth. # # Invocation examples: # # ry gnome1 # ry --gnome2 # ry gnome1..20 # # ======================================================================= # when /^-?-?gnome(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: http://rubular.com/r/n2r8DwcTnU i = return_this_gnome_component($1.to_s.dup) # ======================================================================= # # === Compile a specific mate-desktop component # # This entry point allows us to use numbers in order to compile # a particular mate-desktop component. So for example, "mate1" # will be a shortcut for "matedesktop" whereas "mate2" will # be a shortcut for "libmatemixer", and so forth. # # Invocation examples: # # ry mate1 # ry mate2 # ry mate3 # ry --mate1 # ry --mate2 # ry --mate3 # ry mate11 # ry mate1..100 # # ======================================================================= # when /^-?-?mate(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: https://rubular.com/r/n2r8DwcTnU match = $1.to_s.dup i = return_this_mate_component(match) # ======================================================================= # # === Compile a specific KDE5 plasma component # # This entry point allows us to use numbers in order to compile # a particular KDE5 Plasma component. # # Invocation examples: # # ry plasma1 # ry --plasma3 # # ======================================================================= # when /^-?-?plasma(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: https://rubular.com/r/YQtQZjKtBsmKuj match = $1.to_s.dup i = return_this_plasma_component(match) # ======================================================================= # # === Compile a specific KDE5 application # # Invocation examples: # # ry --kde_apps1 # ry --kde_apps4 # ry kde_apps4 # # ======================================================================= # when /^-?-?kde(-|_| )?apps(\d+)$/i index = $2.to_s.to_i - 1 i = return_kde5_applications[index] # ======================================================================= # # === Compile a specific LXQT-desktop component # # This entry point allows us to use numbers in order to compile # a particular lx-qt-desktop component. So for example, "lxqt1" # will be a shortcut for "libqtxdg" whereas "lxqt2" will # be a shortcut for "lxqtbuildtools", and so forth. # # Invocation examples: # # ry lxqt1 # ry lxqt2 # ry lxqt3 # ry --lxqt1 # ry --lxqt2 # ry --lxqt3 # ry lxqt11 # ry lxqt..100 # # ======================================================================= # when /^-?-?lxqt(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: http://rubular.com/r/n2r8DwcTnU match = $1.to_s.dup i = return_this_lxqt_component(match) # ======================================================================= # # === Compile a KDE5 porting aids component # # Invocation examples: # # ry portingaids1 # ry portingaids2 # ry portingaids3 # ry portingaids4 # ry portingaids5 # ry portingaids6 # # ======================================================================= # when /^-?-?portingaids(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: http://rubular.com/r/n2r8DwcTnU match = $1.to_s.dup i = return_this_portingaids_component(match) # ======================================================================= # # === Compile a specific XORG component # # This entry point allows us to use numbers in order to compile # a particular xorg component. So for example, "xorg1" will compile # the first xorg component, "xorg2" will refer to the second # xorg component and so forth. # # Invocation examples: # # ry xorg1 # ry --xorg2 # ry --xorg15 # ry xorg1..20 # # ======================================================================= # when /^-?-?xorg(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: http://rubular.com/r/n2r8DwcTnU match = $1.to_s.dup i = return_this_xorg_component(match) # ======================================================================= # # === Compile a specific XFCE component # # This entry point allows us to use numbers in order to compile # a particular xfce component. So for example, "xfce1" will compile # the first xfce component, "xfce2" will refer to the second # xfce component and so forth. # # Invocation examples: # # ry xfce1 # ry --xfce2 # ry xfce1..20 # # ======================================================================= # when /^-?-?xfce(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: http://rubular.com/r/n2r8DwcTnU match = $1.to_s.dup i = return_this_xfce_component(match) # ======================================================================= # # === Compile a specific game # # This entry point allows us to use numbers in order to compile # a particular mate-desktop component. So for example, "game1" # will compile the first game, "game2" will refer to the second # game and so forth. # # Invocation examples: # # ry game1 # ry --game2 # ry game1..20 # # ======================================================================= # when /^-?-?game(\d{1,3}\.{0,2}\d{0,3})$/ # ← See: http://rubular.com/r/n2r8DwcTnU match = $1.to_s.dup i = return_this_game_component(match) # ======================================================================= # # === Compile a specific kde component # # This entry point allows us to use numbers in order to compile a # particular KDE component. So for example, "kde1" will be a # shortcut for "extracmakemodules". # # Invocation examples: # # ry kde1 # ry kde2 # ry kde3 # ry --kde1 # ry --kde2 # ry --kde3 # ry --kde4 # ry --kde5 # ry --kde10 # ry kde11 # ry kde15 # ry kde1..100 # ry --kde1..kde250 # # ======================================================================= # when /^-?-?kde(\d{1,3}\.{0,2}[a-z]{0,3}\d{0,3})/ # ← See: http://rubular.com/r/PzADEmm1Jc match = $1.to_s.dup i = return_this_kde_component(match) end i # Return it here. end
#¶ ↑
RBT.unicode_cliner
¶ ↑
This is like RBT.cliner()
, but it will make use of unicode horizontal building block.
#¶ ↑
# File lib/rbt/toplevel_methods/cliner.rb, line 17 def self.unicode_cliner( use_this_token = '=', use_this_colour = nil, &block ) yielded = :unicode if block_given? yielded = yield end RBT.cliner(use_this_token, use_this_colour) { yielded } end
#¶ ↑
RBT.update_all_ruby_gems
¶ ↑
This method can be used to update all local ruby gems (.gem files).
#¶ ↑
# File lib/rbt/check_for_updates/check_for_new_release_on_rubygems.rb, line 214 def self.update_all_ruby_gems # ========================================================================= # # Instantiate the main class defined in this .rb file here: # ========================================================================= # _ = RBT::Cookbooks::CheckForNewReleaseOnRubygems.new(:dont_run_yet) base_dir = RBT.individual_cookbooks_directory? # ========================================================================= # # First, we must obtain all entries thave have the strings "url1" # and ".gem". We will ask ruby to perform a grep-operation. We will # store these in an array. # ========================================================================= # array_ruby_gems = [] available_programs = available_programs? available_programs.each {|this_program| target_yaml_file = "#{base_dir}#{this_program}.yml" if File.exist? target_yaml_file dataset = File.read(target_yaml_file) if dataset.include?('url1') line_holding_url1 = dataset.scan(/^ url1: (.+)$/).flatten.first if line_holding_url1.nil? e 'No result has been found on the dataset at hand, from the file' e sfile(target_yaml_file) end if line_holding_url1 if line_holding_url1.end_with? '.gem' # Found ruby gems. array_ruby_gems << [this_program, line_holding_url1] end end end end } # ========================================================================= # # Ok - now that we have obtained the files that are .gem files, # we can proceed them and check for an updated. This taps into # a specialized class that will do so for us. # ========================================================================= # array_ruby_gems.each {|this_ruby_gem, remote_url| _.check_this_remote_url(remote_url) } end
#¶ ↑
RBT.update_entry
¶ ↑
This is a simpler toplevel API to tap into class RBT::UpdateEntry
.
#¶ ↑
# File lib/rbt/utility_scripts/update_entry/update_entry.rb, line 853 def self.update_entry(i = ARGV) RBT::UpdateEntry.new(i) end
#¶ ↑
RBT.update_these_rubygems
¶ ↑
Usage example:
array = %w( thor prawn ); RBT.update_these_rubygems(array)
#¶ ↑
# File lib/rbt/actions/individual_actions/software_manager/misc.rb, line 14857 def self.update_these_rubygems( array_to_use = RBT.array_all_rubygems ) unless array_to_use.empty? array_to_use.each {|this_gem| RBT.install_this_rubygem(this_gem) } end end
#¶ ↑
RBT.upload_list_of_all_programs_version
¶ ↑
This will use my FTP wrapper to upload this file.
The local .txt file is usually kept or autogenerated here:
/Depot/Temp/CookbookDirectory/programs_version.txt
#¶ ↑
# File lib/rbt/toplevel_methods/ftp.rb, line 60 def self.upload_list_of_all_programs_version( this_file = RBT.store_into_this_directory+'programs_version.txt', type = :txt # type can be :txt or :html ) if File.exist? this_file case type when :html begin require 'rbt/toplevel_methods/create_programs_version_html_file.rb' rescue LoadError; end RBT.create_programs_version_html_file(this_file) this_file.sub!(/\.txt$/,'') end opn; e 'Uploading the file '+sfile(this_file)+' next.' begin require 'ftp_paradise' rescue LoadError rescue SyntaxError end if Object.const_defined? :FtpParadise begin _ = FtpParadise::Connection.new(:dont_run_yet) _.set_be_verbose _.set_mode :ascii _.set_data(:shevy) _.do_login(:shevy) _.upload(this_file, :be_silent) # ===================================================================== # # We have to rescue the following error because FtpParadise may be # unavailable - but we may still want to upload the RBT project. # ===================================================================== # rescue NameError => error pp error pp error.class e 'Continuing nonetheless despite the above ^^^ error.' end end else opn; e "No file exists at `#{sfile(this_file)}`." end end
#¶ ↑
RBT.user_designated_colour
¶ ↑
Note that “error” and “information” is currently (January 2023) not handled here.
#¶ ↑
# File lib/rbt/colours/rev_simp_sdir_sfancy_sfile_and_swarn.rb, line 32 def self.user_designated_colour(i = 'information') case i # ======================================================================= # # === :sfancy # ======================================================================= # when :sfancy i = 'fancy' # ======================================================================= # # === :sdir # ======================================================================= # when :sdir i = 'directory' # ======================================================================= # # === :sfile # ======================================================================= # when :sfile i = 'file' # ======================================================================= # # === :swarn # ======================================================================= # when :swarn i = 'warn' # ======================================================================= # # === :simp # ======================================================================= # when :simp i = 'important' end return HASH_DESIGNATED_COLOURS[i] end
#¶ ↑
RBT.verbose_truth
¶ ↑
This “converts” the given appropriate input to a “Yes.” or “No.” String.
If you need a boolean variant, you can use the method RBT.to_bool()
.
By default a trailing ‘.’ will be used by this method.
#¶ ↑
# File lib/rbt/toplevel_methods/verbose_truth.rb, line 19 def self.verbose_truth( i = 'true', optional_arguments = nil ) i = i.first if i.is_a? Array case i.to_s # ======================================================================= # # === Handle true cases # ======================================================================= # when 'true', 't', 'j', 'ja', 'yes', 'y' i = 'Yes.' # ======================================================================= # # === Handle false cases # ======================================================================= # when 'false', 'f', 'no', 'n' i = 'No.' end i = i.dup if i.frozen? if optional_arguments # ===================================================================== # # Handle cases such as this one here: # # verbose_truth(is_on_windows?, :do_not_capitalize) # # ===================================================================== # if optional_arguments.is_a? Symbol case optional_arguments # =================================================================== # # === :do_not_capitalize # =================================================================== # when :do_not_capitalize i.downcase! end end end i end
#¶ ↑
RBT.will_install_which_binaries?
¶ ↑
This method will simply return an Array of binaries that belong to the rbt project. These all reside under the bin/ directory.
#¶ ↑
# File lib/rbt/toplevel_methods/install_which_binaries.rb, line 20 def self.will_install_which_binaries? results = [] if is_on_roebe? results = Dir["#{RUBY_SRC_DIR_AT_HOME}rbt/bin/*"] else # Else we handle the case for regular users. # This depends on information stored in the file called # rbt_installs_these_executables.yml, which has to be # upgraded every now and then. results = YAML.load_file( "#{RBT.project_yaml_directory?}"\ "rbt_installs_these_executables/rbt_installs_these_executables.yml" ) end # ======================================================================= # # Use only the basename of any results: # ======================================================================= # results.map! {|entry| File.basename(entry) } results.sort # ← Keep the entries alphabetically sorted. end
#¶ ↑
RBT.wrap_at
(Begrenzung tag, limit tag, boundary tag)¶ ↑
Wraps at a specified position. The second argument denotes this limit.
Specific examples:
puts "abc abc abdc abc abc abc abc abc abc abc abcdef abc abc abc abc abc abc abc abc abc ".wrap_at(20) puts RBT.wrap_at(("x"*200), 30) puts RBT.word_wrap(("x"*200), 50) ("x"*200).wrap_at(30,true,5)
# ¶ ↑
# File lib/rbt/toplevel_methods/toplevel_methods.rb, line 418 def self.wrap_at( this_string, # ← This must be the input-String. my_limit = N_CHARACTERS_PER_LINE, add_newline = true, add_padding = nil ) case my_limit # ======================================================================= # # === :default # ======================================================================= # when :default my_limit = N_CHARACTERS_PER_LINE end begin add_padding = add_padding.to_i unless add_padding.nil? if add_newline _ = "\\1\\3\n" # newline at end unless add_padding.nil? _ = _.linsert(' ' * add_padding) end return this_string.gsub( /(.{1,#{my_limit}})( +|$)\n?|(.{#{my_limit}})/,_ ) else _ = "\\1\\3" unless add_padding.nil? _ = _.linsert(' ' * add_padding) end return this_string.gsub( /(.{1,#{my_limit}})( +|$)\n?|(.{#{my_limit}})/, _ ) # No newline at the end. end rescue Exception => error puts error end end
Public Instance Methods
#¶ ↑
all_binaries
?¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/all_binaries.rb, line 54 def all_binaries? RBT.all_binaries? end
#¶ ↑
all_libraries
?¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/all_libraries.rb, line 70 def all_libraries? RBT.all_libraries? end
#¶ ↑
get_file_listing
¶ ↑
Get the file listing of a specific directory. Input will always become a string. Use this method consistently when you want to get files from a directory, for use in the RBT
Project.
Since September 2014 we will ONLY return real files.
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1300 def get_file_listing( a = return_pwd, b = true, c = false ) RBT.get_all_files_from(a, b, c) end
#¶ ↑
home_dir?¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/home_directory.rb, line 26 def home_dir? self.home_dir? end
#¶ ↑
individual_cookbooks_directory?¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/files_and_directories_related_methods.rb, line 1269 def individual_cookbooks_directory? ::RBT.cookbook_directory? end
#¶ ↑
is_on_roebe?¶ ↑
#¶ ↑
# File lib/rbt/toplevel_methods/roebe.rb, line 23 def is_roebe? RBT.is_roebe? end
#¶ ↑
rbt_yaml_directory?¶ ↑
#¶ ↑
# File lib/rbt/project/project.rb, line 76 def rbt_yaml_directory? self.project_yaml_directory? end
#¶ ↑
registered_cookbook_entries
?¶ ↑
Just a pointer to the module-method with the same name.
#¶ ↑
# File lib/rbt/constants/constants.rb, line 932 def registered_cookbook_entries? RBT.registered_cookbook_entries? end
#¶ ↑
toplevel_methods?¶ ↑
#¶ ↑
# File lib/rbt/constants/constants.rb, line 581 def toplevel_methods? RBT.toplevel_methods? end
#¶ ↑
utility_scripts¶ ↑
#¶ ↑
# File lib/rbt/constants/constants.rb, line 971 def utility_scripts? RBT.utility_scripts? end