Class: RBT::Base
- Inherits:
-
Object
show all
- Defined in:
- lib/rbt/base/ee.rb,
lib/rbt/base/ftp.rb,
lib/rbt/base/opn.rb,
lib/rbt/base/run.rb,
lib/rbt/base/base.rb,
lib/rbt/base/misc.rb,
lib/rbt/base/stub.rb,
lib/rbt/base/time.rb,
lib/rbt/base/xorg.rb,
lib/rbt/base/debug.rb,
lib/rbt/base/email.rb,
lib/rbt/base/reset.rb,
lib/rbt/base/cliner.rb,
lib/rbt/base/editor.rb,
lib/rbt/base/colours.rb,
lib/rbt/base/esystem.rb,
lib/rbt/base/symlink.rb,
lib/rbt/base/constants.rb,
lib/rbt/base/load_yaml.rb,
lib/rbt/base/prototype.rb,
lib/rbt/base/readlines.rb,
lib/rbt/base/save_file.rb,
lib/rbt/base/word_wrap.rb,
lib/rbt/base/be_verbose.rb,
lib/rbt/base/copy_files.rb,
lib/rbt/base/initialize.rb,
lib/rbt/base/return_pwd.rb,
lib/rbt/base/remove_file.rb,
lib/rbt/base/exit_program.rb,
lib/rbt/base/programs_dir.rb,
lib/rbt/base/copy_directory.rb,
lib/rbt/base/change_directory.rb,
lib/rbt/base/create_directory.rb,
lib/rbt/base/remove_directory.rb,
lib/rbt/base/available_programs.rb,
lib/rbt/base/expanded_cookbooks.rb,
lib/rbt/base/is_a_64_bit_system.rb,
lib/rbt/base/program_information.rb,
lib/rbt/base/commandline_arguments.rb,
lib/rbt/base/source_base_directory.rb
Overview
Direct Known Subclasses
AggregateInformationFromTheExpandedCookbooks, ApplySedOperations, Autosymlink, AutoupdateThisProgram, BackupProgram, BeautifyConfigureHelpOutput, BeautifySystem, BinaryNameBelongsToWhichProgram, Blfs, BuildDetector, BuildDirectory, ChainCompile, Chainer, ChangePrefix, CheckForDuplicateBinaries, CheckForInvalidCurrentSymlinks, ClassesForIndividualPrograms::Gcc::ChangeLib64ToLib, CleanupSystemTags, Cmake, ColourMakeInstall, ColourizeParser, Commandline, Compile::Shell, CompileBase, CompileBaseSystem, CompileIntoHomeDir, CompileIntoHomeDirWithoutSymlinking, CompileStrategies, CompileViaEnvironmentVariableAsPrefix, ConfigLogParser, ConfigureString, Controller, ConvertToNonTraditional, ConvertToTraditional, Cookbooks::Aliases, Cookbooks::AllUrls, Cookbooks::AllowedCookbookEntries, Cookbooks::BatchValidateTheCookbookRecipes, Cookbooks::CheckForAvailableVersions, Cookbooks::CheckForCorrectDependencies, Cookbooks::CheckForInclusion, Cookbooks::CheckForInvalidEntriesInThisCookbook, Cookbooks::CheckForRemoteWebpages, Cookbooks::CheckIfSourceDirectoriesExist, Cookbooks::CheckValidityOfCookbooks, Cookbooks::Convert_PKGBUILD, Cookbooks::Cookbook, Cookbooks::CreateBigYamlCookbook, Cookbooks::CreateCookbookYamlFile, Cookbooks::CreateDatabase, Cookbooks::CreateEbuild, Cookbooks::CreateGlobalYamlDatabase, Cookbooks::CreateSnapcraftFile, Cookbooks::CreateSqlFromThisCookbook, Cookbooks::DisplayCookbookDataset, Cookbooks::DownloadAllSourceArchives, Cookbooks::ExpandCookbooks, Cookbooks::ExpandedCookbook, Cookbooks::FeedbackDescriptionOf, Cookbooks::FeedbackLicenses, Cookbooks::FindAllArchiveTypes, Cookbooks::FindDirectoryEntriesWithoutCorrespondingYamlFile, Cookbooks::FindDuplicateBinaries, Cookbooks::FindHeaders, Cookbooks::FindMultipleVersions, Cookbooks::GenerateHomepage, Cookbooks::GobolinuxRecipesComparer, Cookbooks::Highest, Cookbooks::Homepage, Cookbooks::IncrementProgramVersion, Cookbooks::LocalCheckForLatest, Cookbooks::MergeCookbooks, Cookbooks::MultiUrlDisplayer, Cookbooks::RawCookbook, Cookbooks::Registered, Cookbooks::ReportMissingLicenceEntries, Cookbooks::ReportTheRegisteredPrograms, Cookbooks::ReportUselessDescriptions, Cookbooks::ScanForBlfsPrograms, Cookbooks::ScanForMissingLastUpdateEntries, Cookbooks::ScanSourceArchive, Cookbooks::SearchForTags, Cookbooks::ShowConfigurationOptions, Cookbooks::ShowDependenciesOf, Cookbooks::ShowDependenciesOn, Cookbooks::ShowLastUpdated, Cookbooks::ToggleKeepExtractedValue, Cookbooks::Url, Cookbooks::ValidateAllCookbookEntries, Cookbooks::ValidateCookbookAliases, CopyTheseArchives, CreateAndPopulatePkgconfigDirectory, CreateAppDirSkeleton, CreateBashScripts, CreateLogFile, CreatePackage, CreatePkgconfigFile, CreatePkgconfigFileForLua, CreateProgramVersionUrlFile, CreateRpmSpecFile, CreateShellScriptContainingTheseProgramsVersions, ExclusiveLogic, ExtraInformation, FeedbackBinariesOf, FeedbackInformation, FetchAllM4Macros, FindAlternativeArchive, FixPkgconfigFile, FlatpakUrlScanner, GatherInformation, GenerateFlatpakManifestFile, GenerateMachomebrewFormula, GenerateMakefile, GeneratePdfTutorial, GenerateRbtConfiguration, GenerateShellCompletion, GenerateShellscript, GenerateSqlTable, Gobolinux::NamingConvention, Headers, InstallGlibSchema, InstalledPrograms, Libtool, Libtool::RemoveLibtoolFiles, Linux::Debian::CreateControlFile, Linux::Debian::CreateDebianPackage, Linux::Fedora, Linux::Gobolinux::CreateDependenciesFile, Linux::Gobolinux::CreateRecipe, Linux::LFS, Linux::ParseBlfsWebpage, Linux::RenameSystemMap, Linux::Slackware::CreateSlackwarePackage, Linux::Slackware::FilelistParser, Linux::Slackware::GenerateSlackDescFile, Linux::Slackware::InstallThisSlackwarePackage, MissingHomepages, NotFoundLibraries, Ntrad, PackageRbtScripts, ParseConfigureHelp, PostInstall, Prefix, ProblemsAndErrors, ProfileInstall, PurgeBinariesOfThisProgram, PurgeHeadersOfThisProgram, PurgeIncorrectYamlDirectoriesInTheProgramsHierarchy, PurgeLibrariesOfThisProgram, QueryBinaryToPackage, QueryFileAssociation, QueryHeaderToPackage, RegisterProgramFilesIntoGlobalDatabase, RegisterProgramFilesIntoYamlDatabase, RegisteredTags, RemoveAllSymlinks, RemoveEmptyDirectories, RemoveOutdatedArchives, RemoveProgram, RemovePrograms, RemoveSymlinks, ReplaceSymlinks, ReportMateDesktopVersion, ReportXfceVersion, RequiredDependenciesOn, ReverseDependencies, SaveTheAvailableProgramsVersions, Scons, SedWrapper, ShowAllAbout, ShowCompileChain, ShowDescriptionAndExtraInformation, ShowHowManyFilesAreTracked, ShowVersionsOfThesePrograms, SimpleVersionComparer, SimplifyRootEntries, StaticOverviewOfTheAvailableBinariesOnThisComputerSystem, SuggestCookbookFor, SymlinkAllPrograms, SymlinkAllUpcasedProgramsToDowncasedVariants, SymlinkGlibSchema, SymlinkHeaders, SymlinkIntoUsrLibDirectory, SymlinkPkgconfigFiles, SymlinkThisProgram, SystemCompilePossibilities, ToCurrent, Toolchain, UpdateEntry, UpdateSlackpkg, UrlAction, UseFlags, Users, VersionSwitcher
Constant Summary
collapse
- KONSOLE =
Colours
- ALL_COLOUR_METHODS =
::Colours::AllColourMethods
- ARRAY_KDE_KONSOLE_COLOURS_IN_USE =
#
ARRAY_KDE_KONSOLE_COLOURS_IN_USE
Next, we will define the KONSOLE Colours that can be used.
#
%w(
aliceblue
aquamarine
blueviolet
cadetblue
cornflowerblue
crimson
cyan
darkcyan
darkgoldenrod
darkgreen
darkorchid
darkseagreen
darkslateblue
darkturquoise
deepskyblue
dodgerblue
firebrick
forestgreen
gold
gray
grey
green
hotpink
khaki
lightblue
lightseagreen
lightgoldenrodyellow
lightgreen
lightsalmon
lightskyblue
lightslategray
lightsteelblue
limegreen
mediumaquamarine
mediumorchid
mediumpurple
mediumseagreen
mediumslateblue
mediumspringgreen
mediumturquoise
mediumvioletred
navajowhite
olive
olivedrab
orange
orangebrown
orangered
orchid
palevioletred
paleturquoise
peru
plum
powderblue
royalblue
salmon
saddlebrown
sandybrown
seagreen
silver
skyblue
slateblue
slategray
springgreen
steelblue
rosybrown
teal
tomato
turquoise
violet
yellow
yellowgreen
)
- NAMESPACE =
inspect
Class Method Summary
collapse
Instance Method Summary
collapse
-
#abbreviations? ⇒ Boolean
# === abbreviations?.
-
#add_to_the_commandline_arguments(i) ⇒ Object
# === add_to_the_commandline_arguments ========================================================================= #.
-
#all_binaries? ⇒ Boolean
# === all_binaries? ========================================================================= #.
-
#all_libraries? ⇒ Boolean
# === all_libraries? ========================================================================= #.
-
#always_show_dependencies? ⇒ Boolean
# === always_show_dependencies?.
-
#appdir_location_of?(i) ⇒ Boolean
# === appdir_location_of?.
-
#append_what_into(what, into) ⇒ Object
# === append_what_into ========================================================================= #.
-
#archive_type_of?(i) ⇒ Boolean
(also: #return_archive_type, #archive_type?, #archive_type_of)
# === archive_type_of?.
-
#available_programs? ⇒ Boolean
(also: #all_programs?, #all_programs, #all_available_programs?, #available_programs, #available_cookbooks?, #available_cookbooks, #return_available_programs, #get_cookbooks)
# === available_programs? ========================================================================= #.
-
#be_quiet? ⇒ Boolean
# === be_quiet? ========================================================================= #.
-
#be_verbose? ⇒ Boolean
# === be_verbose? ========================================================================= #.
-
#begins_with_a_comment?(i) ⇒ Boolean
-
#capitalize_first_alphabetical_character(i = "/programs") ⇒ Object
# === capitalize_first_alphabetical_character.
-
#capitalize_program_names? ⇒ Boolean
(also: #do_capitalize?)
# === capitalize_program_names? ========================================================================= #.
-
#cat(i) ⇒ Object
# === cat (cat tag) ========================================================================= #.
-
#cd_to_the_log_directory ⇒ Object
# === cd_to_the_log_directory ========================================================================= #.
-
#cd_to_the_temp_directory(be_verbose = :be_quiet) ⇒ Object
# === cd_to_the_temp_directory.
-
#change_directory(i, optional_arguments = nil) ⇒ Object
(also: #chdir, #change_dir, #cd)
# === change_directory (cd tag).
-
#change_permission(file = 'test', use_this_uid_number = '1000') ⇒ Object
(also: #chown)
# === change_permission (chown tag).
-
#cheering_person? ⇒ Boolean
(also: #return_cheering_person, #cheering_person)
# === cheering_person? ========================================================================= #.
-
#chmod(i) ⇒ Object
# === chmod ========================================================================= #.
-
#chop_off_archive(i) ⇒ Object
# === chop_off_archive.
-
#cliner(optional_arguments = nil, use_this_colour = nil) ⇒ Object
# === cliner ========================================================================= #.
-
#colourize_directory_for_system_results(i) ⇒ Object
# === colourize_directory_for_system_results.
-
#colourize_this_error(i) ⇒ Object
# === colourize_this_error.
-
#colourize_this_file_path(i, colour1 = :slateblue, colour2 = :royalblue) ⇒ Object
# === colourize_this_file_path.
-
#colourize_this_warning(i) ⇒ Object
(also: #colourize_for_warnings)
# === colourize_this_warning ========================================================================= #.
-
#commandline_arguments? ⇒ Boolean
(also: #input?, #arguments?, #all_arguments?)
# === commandline_arguments? ========================================================================= #.
-
#commandline_arguments_without_hyphens? ⇒ Boolean
# === commandline_arguments_without_hyphens?.
-
#config? ⇒ Boolean
# === config? ========================================================================= #.
-
#convert_env_variable(i) ⇒ Object
(also: #convert_global_env, #sanitize_for_environment_variable)
# === convert_env_variable.
-
#cookbook_files?(show_how = :show_only_name) ⇒ Boolean
(also: #available_cookbook_files?)
# === cookbook_files?.
-
#cookbooks_include_this_program? ⇒ Boolean
# === is_this_program_included?.
-
#copy_directory(from, to = return_pwd, be_verbose = false) ⇒ Object
# === copy_directory.
-
#copy_files(from, to = return_pwd, be_verbose = false) ⇒ Object
(also: #copy_file, #copy, #cp)
# === copy_files (copy tag, cp tag, copy file tag).
-
#copy_recursively(what, where_to = '/usr/', be_verbose = false) ⇒ Object
# === copy_recursively ========================================================================= #.
-
#cpr(from, to = return_pwd) ⇒ Object
# === cpr.
-
#create_directory(i = '/Users/Packages/', be_verbose = true, permissions = :default) ⇒ Object
(also: #mkdir, #ensure_that_this_directory_exists, #create_directory_if_it_does_not_yet_exist)
# === create_directory (mkdir tag).
-
#current_hour? ⇒ Boolean
(also: #return_time)
# === current_hour?.
-
#dd_mmm_yyy ⇒ Object
# === dd_mmm_yyy.
-
#debug(i) ⇒ Object
# === debug.
-
#debug? ⇒ Boolean
# === debug? ========================================================================= #.
-
#determine_appdir_prefix_from_this_input(i = nil, program_version = nil) ⇒ Object
(also: #static_appdir_prefix_of?)
-
#determine_archive_type(i) ⇒ Object
# === determine_archive_type.
-
#directory_expanded_cookbooks? ⇒ Boolean
(also: #directory_expanded_cookbooks, #base_dir_to_store_expanded_cookbooks?)
# === directory_expanded_cookbooks? ========================================================================= #.
-
#directory_validation? ⇒ Boolean
# === directory_validation? ========================================================================= #.
-
#disable_colours ⇒ Object
(also: #do_not_use_colours, #disable_colors)
# === disable_colours.
-
#display_md5sum? ⇒ Boolean
(also: #show_md5sum?)
# === display_md5sum? ========================================================================= #.
-
#do_not_debug ⇒ Object
# === do_not_debug ========================================================================= #.
-
#do_not_show_names ⇒ Object
# === do_not_show_names ========================================================================= #.
-
#does_the_cookbook_include_this_program?(i) ⇒ Boolean
# === does_the_cookbook_include_this_program? ========================================================================= #.
-
#does_this_expanded_cookbook_file_exist_for_this_program?(i) ⇒ Boolean
(also: #does_the_expanded_cookbook_file_exist_for_this_program?, #expanded_cookbook_file_exists_for?)
# === does_this_expanded_cookbook_file_exist_for_this_program?.
-
#does_this_file_exist?(i, prepend_this = nil) ⇒ Boolean
# === does_this_file_exist? ========================================================================= #.
-
#does_this_file_exist_and_is_it_a_file?(i) ⇒ Boolean
# === does_this_file_exist_and_is_it_a_file? ========================================================================= #.
-
#e(i = '') ⇒ Object
# === e ========================================================================= #.
-
#eblue(i = '') ⇒ Object
# === eblue ========================================================================= #.
-
#ecomment(i = '') ⇒ Object
-
#ecrimson(i = '') ⇒ Object
# === ecrimson.
-
#edir(i = '') ⇒ Object
# === edir ========================================================================= #.
-
#editor? ⇒ Boolean
# === editor? ========================================================================= #.
-
#efancy(i = '') ⇒ Object
# === efancy ========================================================================= #.
-
#eimp(i) ⇒ Object
# === simp ========================================================================= #.
-
#email? ⇒ Boolean
# === email? ========================================================================= #.
-
#enable_colours ⇒ Object
# === enable_colours ========================================================================= #.
-
#enable_debug ⇒ Object
# === enable_debug ========================================================================= #.
-
#ensure_main_encoding_for(i, use_this_encoding = USE_MAIN_ENCODING) ⇒ Object
# === ensure_main_encoding_for.
-
#eparse(i) ⇒ Object
# === eparse ========================================================================= #.
-
#esystem(i) ⇒ Object
# === esystem.
-
#esystem_gold(i) ⇒ Object
# === esystem_gold ========================================================================= #.
-
#etomato(i) ⇒ Object
# === etomato ========================================================================= #.
-
#ewarn(i = '') ⇒ Object
# === ewarn ========================================================================= #.
-
#exit_on_unregistered_cookbook_entries? ⇒ Boolean
# === exit_on_unregistered_cookbook_entries? ========================================================================= #.
-
#exit_program(symbol_exit = :standalone, optional_message = nil, use_this_as_exit_value = 0) ⇒ Object
# === exit_program (exit tag).
-
#expanded_cookbooks_directory_exists? ⇒ Boolean
(also: #expanded_directory_exists?, #directory_expanded_cookbooks_exists?)
# === expanded_cookbooks_directory_exists?.
-
#fast_return_file_size_of_this_program(i) ⇒ Object
# === fast_return_file_size_of_this_program ========================================================================= #.
-
#file_compiled_programs? ⇒ Boolean
# === file_compiled_programs? ========================================================================= #.
-
#file_last_symlinked_program? ⇒ Boolean
# === file_last_symlinked_program? ========================================================================= #.
-
#file_predefined_installation_instructions? ⇒ Boolean
(also: #file_predefined_installation_instructions)
# === file_predefined_installation_instructions? ========================================================================= #.
-
#file_programs_version_url ⇒ Object
# === file_programs_version_url ========================================================================= #.
-
#file_specification_of_registered_cookbook_entries ⇒ Object
# === file_specification_of_registered_cookbook_entries ========================================================================= #.
-
#find_cookbook_alias_for(i) ⇒ Object
# === find_cookbook_alias_for.
-
#find_this_yaml_file(i = :poppler) ⇒ Object
(also: #return_yaml_file_for)
# === find_this_yaml_file.
-
#first_argument? ⇒ Boolean
(also: #first?)
# === first_argument? ========================================================================= #.
-
#gem_version(i) ⇒ Object
# === gem_version.
-
#get_all_directories_from(here = return_pwd, return_full_path = false) ⇒ Object
(also: #get_dir_listing, #get_directory_listing, #get_directories_from)
# === get_all_directories_from.
-
#get_all_files_from(i) ⇒ Object
# === get_all_files_from ========================================================================= #.
-
#get_all_programs(from = "#{RBT.programs_directory?}*") ⇒ Object
# === get_all_programs (all programs tag).
-
#get_date ⇒ Object
# === get_date.
-
#get_files_and_directories_from(i = return_pwd) ⇒ Object
# === get_files_and_directories_from ========================================================================= #.
-
#go_to_base_dir(be_verbose = true) ⇒ Object
# === go_to_base_dir.
-
#home_dir? ⇒ Boolean
# === home_dir? ========================================================================= #.
-
#host_system? ⇒ Boolean
(also: #host_architecture?, #host_achiteture_in_use?)
# === host_system? ========================================================================= #.
-
#initialize(i = ARGV, run_already = true) ⇒ Base
constructor
# === initialize ========================================================================= #.
-
#is_a_64bit_system? ⇒ Boolean
(also: #is_on_64_bit?)
# === is_a_64bit_system?.
-
#is_an_archive?(i) ⇒ Boolean
(also: #is_archive?)
# === is_an_archive? ========================================================================= #.
-
#is_ccache_available? ⇒ Boolean
(also: #ccache_is_available?)
# === is_ccache_available?.
-
#is_file?(i) ⇒ Boolean
# === is_file? ========================================================================= #.
-
#is_on_gobolinux? ⇒ Boolean
(also: #are_we_on_gobolinux?)
# === is_on_gobolinux?.
-
#is_on_windows? ⇒ Boolean
# === is_on_windows? ========================================================================= #.
-
#is_porg_available? ⇒ Boolean
(also: #porg_is_available?)
# === is_porg_available?.
-
#is_roebe? ⇒ Boolean
(also: #is_on_roebe?, #on_roebe?)
# === is_roebe?.
-
#is_this_a_header?(i) ⇒ Boolean
-
#is_this_a_library?(i) ⇒ Boolean
# === is_this_a_library?.
-
#is_this_program_included?(i) ⇒ Boolean
(also: #included?, #includes?, #program_was_found?, #include?, #is_included?, #includes_this_program?, #is_this_program_registered?, #is_the_program_included?)
# === is_this_program_included?.
-
#load_dataset_from_this_expanded_cookbook(i, &block) ⇒ Object
(also: #return_dataset_from_expanded_cookbook, #return_dataset_from_this_expanded_cookbook, #quickly_obtain_expanded_cookbook_dataset_from)
# === load_dataset_from_this_expanded_cookbook.
-
#load_yaml(i) ⇒ Object
# === load_yaml.
-
#load_yaml_file_from_the_cookbook_directory_for_this_program(i) ⇒ Object
# === load_yaml_file_from_the_cookbook_directory_for_this_program.
-
#log_directory? ⇒ Boolean
(also: #rbt_temp_directory?, #log_dir?, #rbt_log_dir?, #rbt_log_directory?, #rbt_temp_dir?)
# === log_directory?.
-
#main_encoding? ⇒ Boolean
# === main_encoding? ========================================================================= #.
-
#make_command? ⇒ Boolean
# === make_command? ========================================================================= #.
-
#make_install_command? ⇒ Boolean
# === make_install_command?.
-
#move_file(this_file, where_to, be_verbose = true) ⇒ Object
(also: #mv, #rename_file)
# === move_file (move tag, mv tag).
-
#n_programs_available? ⇒ Boolean
(also: #n_programs_available)
# === n_programs_available? ========================================================================= #.
-
#new_cookbook_instance_for(name_of_the_program) ⇒ Object
# === new_cookbook_instance_for.
-
#no_directory_exists_at(i) ⇒ Object
# === no_directory_exists_at ========================================================================= #.
-
#no_opn ⇒ Object
(also: #disable_opn)
# === no_opn ========================================================================= #.
-
#no_such_file_exists(i, be_verbose = true, &block) ⇒ Object
(also: #no_file_exists_at)
# === no_such_file_exists ========================================================================= #.
-
#open_in_browser(i) ⇒ Object
# === open_in_browser ========================================================================= #.
-
#open_in_editor(i) ⇒ Object
(also: #open_this_file)
# === open_in_editor.
-
#opne(i) ⇒ Object
# === opne (opne tag) ========================================================================= #.
-
#opnef(i) ⇒ Object
# === opnef (opnef tag) ========================================================================= #.
-
#opnerror(i, use_this_as_namespace = @namespace) ⇒ Object
# === opnerror (opnerror tag) ========================================================================= #.
-
#opnewarn(i) ⇒ Object
# === opnewarn ========================================================================= #.
-
#opnn(i = @namespace, &block) ⇒ Object
(also: #output_namespace?)
# === opnn (opnn tag).
-
#path_to_this_expanded_cookbooks_dataset(i) ⇒ Object
(also: #return_file_to_the_expanded_cookbooks_dataset)
# === path_to_this_expanded_cookbooks_dataset.
-
#play_song? ⇒ Boolean
# === play_song?.
-
#predefined_installation_instructions? ⇒ Boolean
# === predefined_installation_instructions? ========================================================================= #.
-
#program_dir? ⇒ Boolean
# === programs_dir? ========================================================================= # === program_dir?.
-
#program_exists?(this_program) ⇒ Boolean
# === program_exists?.
-
#programs_dir? ⇒ Boolean
(also: #programs_directory?)
# === programs_dir? ========================================================================= #.
-
#project_base_dir? ⇒ Boolean
# === project_base_dir? ========================================================================= #.
-
#project_yaml_directory? ⇒ Boolean
(also: #rbt_path?)
# === project_yaml_directory?.
-
#publish_list_of_all_programs_version ⇒ Object
# === publish_list_of_all_programs_version ========================================================================= #.
-
#rarrow? ⇒ Boolean
(also: #rarrow)
# === rarrow? ========================================================================= #.
-
#rbt_logs? ⇒ Boolean
# === rbt_logs?.
-
#read_file(i) ⇒ Object
# === read_file (read tag).
-
#read_file_in_default_encoding(i, use_this_encoding = ::RBT.encoding?) ⇒ Object
# === read_file_in_default_encoding ========================================================================= #.
-
#readlines(i) ⇒ Object
# === readlines.
-
#readlines_with_proper_encoding(i, use_this_encoding = main_encoding? ) ⇒ Object
(also: #default_readlines)
# === readlines_with_proper_encoding.
-
#recipes_dir? ⇒ Boolean
# === recipes_dir? ========================================================================= #.
-
#register_sigint(optional_message = nil, use_this_as_exit_code = 0) ⇒ Object
# === register_sigint ========================================================================= #.
-
#remove(this_target, be_verbose = false) ⇒ Object
# === remove (remove tag).
-
#remove_archive_from_the_end(i) ⇒ Object
(also: #remove_file_archive_at_the_end)
-
#remove_comments_from_each_line(i) ⇒ Object
-
#remove_directory(this_directory, be_verbose = false) ⇒ Object
(also: #remove_dir, #remove_these_directories, #remove_directories, #remove_this_directory)
# === remove_directory.
-
#remove_double_slashes(i) ⇒ Object
(also: #rds)
# === remove_double_slashes (rds tag).
-
#remove_file(i, report_the_action = false) ⇒ Object
(also: #delete, #delete_file, #remove_files, #remove_these_files)
# === remove_file (remove tag).
-
#remove_file_extension(i, also_remove_the_basename = true) ⇒ Object
(also: #remove_archive_at_the_end, #remove_extension, #remove_file_suffix, #remove_archive_stuff_at_the_end, #sanitized_without_extension)
# === remove_file_extension.
-
#remove_newlines(i) ⇒ Object
# === remove_newlines.
-
#remove_parens(i) ⇒ Object
# === remove_parens.
-
#remove_symlink(i, be_verbose = false) ⇒ Object
(also: #delete_symlink, #delete_this_symlink, #remove_this_symlink)
# === remove_symlink.
-
#remove_this_commandline_argument(i) ⇒ Object
# === remove_this_commandline_argument.
-
#remove_trailing_ANSII_escape_code(i) ⇒ Object
# === remove_trailing_ANSII_escape_code.
-
#remove_unnecessary_data_from_url(i) ⇒ Object
(also: #return_program_full_name_from_url)
# === remove_unnecessary_data_from_url.
-
#rename(old_name, new_name) ⇒ Object
# === rename ========================================================================= #.
-
#rename_kde_konsole_tab(use_this_as_the_new_title = '') ⇒ Object
# === rename_kde_konsole_tab ========================================================================= #.
-
#repackage(i, use_this_for_the_opnn_namespace = 'RBT::Repackage') ⇒ Object
(also: #repackage_this)
# === repackage (repackage tag).
-
#report_n_programs ⇒ Object
# === report_n_programs.
-
#report_pwd ⇒ Object
# === report_pwd ========================================================================= #.
-
#report_to_developers(this_email = RBT.configuration?.email) ⇒ Object
# === report_to_developers.
-
#report_working_directory ⇒ Object
# === report_working_directory.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#return_all_archives_from_this_directory(i) ⇒ Object
# === return_all_archives_from_this_directory ========================================================================= #.
-
#return_commandline_arguments_with_leading_hyphens(i = @commandline_arguments) ⇒ Object
(also: #commandline_arguments_containing_leading_hyphens?, #return_arguments_with_leading_hyphens, #return_commandline_arguments_with_hyphens)
# === return_commandline_arguments_with_leading_hyphens.
-
#return_current_hour_minutes_second ⇒ Object
(also: #ss_mm_hh)
# === return_current_hour_minutes_second.
-
#return_date ⇒ Object
(also: #return_current_date, #return_current_time, #dd_mm_yyyy)
# === return_date.
-
#return_day_of_the_month_based_on_utc ⇒ Object
# === return_day_of_the_month_based_on_utc ========================================================================= #.
-
#return_full_time ⇒ Object
# === return_full_time.
-
#return_hours_minutes_seconds_based_on_utc ⇒ Object
# === return_hours_minutes_seconds_based_on_utc ========================================================================= #.
-
#return_location_to_this_programs_yaml_file(i) ⇒ Object
# === return_location_to_this_programs_yaml_file.
-
#return_month_based_on_this_number(i) ⇒ Object
# === return_month_based_on_this_number.
-
#return_month_based_on_utc ⇒ Object
# === return_month_based_on_utc ========================================================================= #.
-
#return_n_random_characters(i = 10) ⇒ Object
# === return_n_random_characters.
-
#return_opnn(i = nil) ⇒ Object
# === return_opnn ========================================================================= #.
-
#return_program_information(i) ⇒ Object
-
#return_program_name(i, optional_padding = ' ') ⇒ Object
(also: #rpn)
# === return_program_name.
-
#return_program_name_for_gobolinux_systems(i) ⇒ Object
# === return_program_name_for_gobolinux_systems.
-
#return_pwd ⇒ Object
(also: #return_current_pwd, #pwd?, #get_pwd)
# === return_pwd ========================================================================= #.
-
#return_unicode_warning_symbol_or_empty_string ⇒ Object
# === return_unicode_warning_symbol_or_empty_string ========================================================================= #.
-
#return_utc ⇒ Object
# === return_utc.
-
#return_utc_time_in_a_format_similar_to_slackware ⇒ Object
-
#return_version_of_this_program(i) ⇒ Object
# === return_version_of_this_program ========================================================================= #.
-
#return_weekday_based_on_utc ⇒ Object
# === return_weekday_based_on_utc.
-
#return_year_based_on_utc ⇒ Object
# === return_year_based_on_utc ========================================================================= #.
-
#rev ⇒ Object
# === rev ========================================================================= #.
-
#run ⇒ Object
# === run (run tag) ========================================================================= #.
-
#run_ldconfig? ⇒ Boolean
(also: #use_ldconfig?)
# === run_ldconfig? ========================================================================= #.
-
#run_make_then_make_install ⇒ Object
# === run_make_then_make_install ========================================================================= #.
-
#run_simulation=(i = false) ⇒ Object
# === run_simulation.
-
#run_simulation? ⇒ Boolean
(also: #run_simulation, #in_simulation?)
# === run_simulation?.
-
#sanitize_url1_entry(i, optional_hash = {}) ⇒ Object
# === sanitize_url1_entry ========================================================================= #.
-
#sdir(i = '') ⇒ Object
# === sdir ========================================================================= #.
-
#sdir_return_pwd ⇒ Object
# === sdir_return_pwd.
-
#set_be_silent(i = false) ⇒ Object
(also: #be_silent, #be_quiet, #set_be_quiet)
# === set_be_silent.
-
#set_be_verbose(i = true) ⇒ Object
(also: #be_verbose, #be_verbose=)
# === set_be_verbose.
-
#set_commandline_arguments(i = '') ⇒ Object
(also: #set_input)
# === set_commandline_arguments ========================================================================= #.
-
#set_source_directory(i = return_pwd, be_verbose = false) ⇒ Object
(also: #set_source_dir)
# === set_source_directory.
-
#set_use_opn(i) ⇒ Object
# === set_use_opn ========================================================================= #.
-
#set_xorg_buffer(i) ⇒ Object
# === set_xorg_buffer ========================================================================= #.
-
#sfancy(i = '') ⇒ Object
# === sfancy ========================================================================= #.
-
#sfile(i = '') ⇒ Object
# === sfile ========================================================================= #.
-
#show_overview_over_available_utility_scripts ⇒ Object
# === show_overview_over_available_utility_scripts ========================================================================= #.
-
#silently_create_this_directory_if_it_does_not_yet_exist(i) ⇒ Object
# === silently_create_this_directory_if_it_does_not_yet_exist ========================================================================= #.
-
#simp(i = '') ⇒ Object
(also: #simportant)
# === simp ========================================================================= #.
-
#source_base_directory? ⇒ Boolean
(also: #source_directory?, #source_directory, #source_dir?, #archive_dir?, #src_dir?)
# === source_base_directory? ========================================================================= #.
-
#ssym(i) ⇒ Object
# === ssym ========================================================================= #.
-
#stderr(i = '', use_puts_or_print = :puts) ⇒ Object
# === stderr.
-
#store_into_this_directory? ⇒ Boolean
(also: #store_where?)
# === store_into_this_directory? ========================================================================= #.
-
#swarn(i = '') ⇒ Object
# === swarn ========================================================================= #.
-
#symlink(existing, new_location = nil, be_verbose = true, use_colours = RBT.use_colours?) ⇒ Object
(also: #do_symlink, #symlink_file)
# === symlink (symlink tag).
-
#symlink_all_files_from_this_directory_to_that_directory(this_dir, that_dir) ⇒ Object
# === symlink_all_files_from_this_directory_to_that_directory ========================================================================= #.
-
#sysbin_directory? ⇒ Boolean
# === sysbin_directory? ========================================================================= #.
-
#sysetc_directory? ⇒ Boolean
# === sysetc_directory? ========================================================================= #.
-
#sysinclude_directory? ⇒ Boolean
# === sysinclude_directory? ========================================================================= #.
-
#syslib_directory? ⇒ Boolean
# === syslib_directory? ========================================================================= #.
-
#sysshare_directory? ⇒ Boolean
# === sysshare_directory? ========================================================================= #.
-
#system_directory? ⇒ Boolean
# === system_directory? ========================================================================= #.
-
#system_tags? ⇒ Boolean
-
#temp_directory? ⇒ Boolean
(also: #temp_dir?, #base_dir?)
# === temp_directory? ========================================================================= #.
-
#to_bool(i) ⇒ Object
(also: #to_boolean)
# === to_bool ========================================================================= #.
-
#to_camelcase(i) ⇒ Object
# === to_camelcase ========================================================================= #.
-
#to_unicode(i) ⇒ Object
# === to_unicode.
-
#today?(display_in_long_format = true) ⇒ Boolean
# === today?.
-
#touch(i, be_verbose = false) ⇒ Object
(also: #create_file, #touch_file)
# === touch (touch tag).
-
#unicode_cliner(a = :default, b = :default, &block) ⇒ Object
# === unicode_cliner ========================================================================= #.
-
#unicode_middle_cliner(a = :default, b = :default) ⇒ Object
# === unicode_middle_cliner ========================================================================= #.
-
#upload_list_of_all_programs_version ⇒ Object
# === upload_list_of_all_programs_version ========================================================================= #.
-
#use_ccache? ⇒ Boolean
# === use_ccache?.
-
#use_colours=(i = true) ⇒ Object
# === use_colours= ========================================================================= #.
-
#use_colours? ⇒ Boolean
(also: #we_may_use_colours?)
# === use_colours?.
-
#use_mrxvt? ⇒ Boolean
# === use_mrxvt? ========================================================================= #.
-
#use_opn=(i = true) ⇒ Object
# === use_opn= ========================================================================= #.
-
#use_opn? ⇒ Boolean
(also: #show_opnn?)
# === use_opn? ========================================================================= #.
-
#use_porg? ⇒ Boolean
# === use_porg?.
-
#use_stow? ⇒ Boolean
# === use_stow? ========================================================================= #.
-
#use_tags? ⇒ Boolean
-
#use_yaml_database_for_tags? ⇒ Boolean
-
#verbose_truth(i, optional_arguments = nil) ⇒ Object
(also: #vt, #verbose_truth?)
# === verbose_truth.
-
#warn_and_exit(input, exit_mode = true) ⇒ Object
(also: #warn_then_exit)
# === warn_and_exit.
-
#wget(i) ⇒ Object
# === wget ========================================================================= #.
-
#word_wrap(this_text, n_characters_limit = 78) ⇒ Object
(also: #wrap_at)
# === word_wrap.
-
#write_what_into(what, into, permissions_to_use = '755') ⇒ Object
(also: #save_file, #save_what_into, #store_what_into, #save_what_to)
# === write_what_into.
-
#write_what_into_via_unicode(what, into, permissions_to_use = '755') ⇒ Object
# === write_what_into_via_unicode.
-
#yes_or_no(i) ⇒ Object
# === yes_or_no.
Constructor Details
#initialize(i = ARGV, run_already = true) ⇒ Base
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'lib/rbt/base/initialize.rb', line 16
def initialize(
i = ARGV,
run_already = true
)
reset
set_commandline_arguments(i)
if block_given?
yielded = yield
case yielded
when :no_colours
disable_colours
else
if yielded.is_a? Hash
if yielded.has_key? :use_colours
_ = yielded.delete :use_colours
if _ == false
disable_colours
end
end
end
end
end
run if run_already
end
|
Class Method Details
.make_command? ⇒ Boolean
#
RBT::Base.make_command?
#
180
181
182
|
# File 'lib/rbt/base/base.rb', line 180
def self.make_command?
RBT.configuration?.make_command end
|
.registered_binaries? ⇒ Boolean
#
RBT::Base.registered_binaries?
Tell us where our binaries are registered.
#
108
109
110
|
# File 'lib/rbt/base/base.rb', line 108
def self.registered_binaries?
RBT.all_binaries?
end
|
Instance Method Details
#abbreviations? ⇒ Boolean
#
abbreviations?
Easier getter-method over the available abbreviations.
#
#add_to_the_commandline_arguments(i) ⇒ Object
#
add_to_the_commandline_arguments
#
29
30
31
32
|
# File 'lib/rbt/base/commandline_arguments.rb', line 29
def add_to_the_commandline_arguments(i)
@commandline_arguments << i
@commandline_arguments.flatten!
end
|
#all_binaries? ⇒ Boolean
202
203
204
205
|
# File 'lib/rbt/base/prototype.rb', line 202
def all_binaries?
require 'rbt/toplevel_methods/all_binaries.rb'
RBT.all_binaries?
end
|
#all_libraries? ⇒ Boolean
210
211
212
213
|
# File 'lib/rbt/base/prototype.rb', line 210
def all_libraries?
require 'rbt/toplevel_methods/all_libraries.rb'
RBT.all_libraries?
end
|
#always_show_dependencies? ⇒ Boolean
#
always_show_dependencies?
If this setting is true then we will always show the dependencies on the commandline.
#
566
567
568
|
# File 'lib/rbt/base/base.rb', line 566
def always_show_dependencies?
RBT.configuration?.always_show_dependencies
end
|
#appdir_location_of?(i) ⇒ Boolean
#
appdir_location_of?
Give an input of something like 'foo', this method will return a path such as '/Programs/Foo/Current'.
#
329
330
331
|
# File 'lib/rbt/base/base.rb', line 329
def appdir_location_of?(i)
"#{programs_dir?}#{i.capitalize}/Current"
end
|
#append_what_into(what, into) ⇒ Object
41
42
43
|
# File 'lib/rbt/base/save_file.rb', line 41
def append_what_into(what, into)
RBT.append_what_into(what, into)
end
|
#archive_type_of?(i) ⇒ Boolean
Also known as:
return_archive_type, archive_type?, archive_type_of
#
archive_type_of?
Determine the archive type of the given input, such as '.tar.xz' and so forth.
#
666
667
668
|
# File 'lib/rbt/base/prototype.rb', line 666
def archive_type_of?(i)
RBT.return_archive_type(i)
end
|
#available_programs? ⇒ Boolean
Also known as:
all_programs?, all_programs, all_available_programs?, available_programs, available_cookbooks?, available_cookbooks, return_available_programs, get_cookbooks
15
16
17
|
# File 'lib/rbt/base/available_programs.rb', line 15
def available_programs?
RBT.available_programs?
end
|
#be_quiet? ⇒ Boolean
21
22
23
|
# File 'lib/rbt/base/be_verbose.rb', line 21
def be_quiet?
!@be_verbose
end
|
#be_verbose? ⇒ Boolean
14
15
16
|
# File 'lib/rbt/base/be_verbose.rb', line 14
def be_verbose?
@be_verbose
end
|
84
85
86
|
# File 'lib/rbt/base/prototype.rb', line 84
def (i)
i.start_with? '#'
end
|
#capitalize_first_alphabetical_character(i = "/programs") ⇒ Object
#
capitalize_first_alphabetical_character
This method will capitalize on the given input, but it will act on the first alphabetical character. So for example, if we input a string such as “/programs” then this method will return “/Programs”.
#
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
# File 'lib/rbt/base/prototype.rb', line 96
def capitalize_first_alphabetical_character(i = "/programs")
new_string = ''.dup
capitalized_already = false
i.chars.each {|char|
if capitalized_already
else
if char =~ /[a-zA-Z]/
char.upcase!
capitalized_already = true
end
end
new_string << char
}
new_string
end
|
#capitalize_program_names? ⇒ Boolean
Also known as:
do_capitalize?
#
capitalize_program_names?
#
160
161
162
|
# File 'lib/rbt/base/base.rb', line 160
def capitalize_program_names?
RBT.configuration?.capitalize_program_names
end
|
#cat(i) ⇒ Object
208
209
210
211
212
|
# File 'lib/rbt/base/base.rb', line 208
def cat(i)
if File.exist? i
return File.readlines(i).join
end
end
|
#cd_to_the_log_directory ⇒ Object
#
cd_to_the_log_directory
#
343
344
345
|
# File 'lib/rbt/base/base.rb', line 343
def cd_to_the_log_directory
cd log_directory?
end
|
#cd_to_the_temp_directory(be_verbose = :be_quiet) ⇒ Object
#
cd_to_the_temp_directory
This will cd to the temp directory, while being quiet.
#
294
295
296
297
298
|
# File 'lib/rbt/base/prototype.rb', line 294
def cd_to_the_temp_directory(
be_verbose = :be_quiet
)
cd temp_directory?, be_verbose
end
|
#change_directory(i, optional_arguments = nil) ⇒ Object
Also known as:
chdir, change_dir, cd
#
change_directory (cd tag)
Change into the given directory.
The second argument to this method can be used to do additional tasks, such as creating the directory if it does not yet exist.
#
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# File 'lib/rbt/base/change_directory.rb', line 19
def change_directory(
i, optional_arguments = nil
)
be_verbose = false
case i
when :log_directory
i = log_directory?
end
if block_given?
yielded = yield
case yielded
when :be_verbose
be_verbose = true
end
end
i = i.to_s unless i.is_a? String
case optional_arguments
when :be_quiet,
:quiet,
:silent,
:be_silent,
:do_not_report_anything
be_verbose = false
when true,
:be_verbose
be_verbose = true
when :create_the_directory_if_it_does_not_exist
FileUtils.mkdir_p(i) unless File.directory? i
when :verbose_create_the_directory_if_it_does_not_exist,
:ensure_that_the_directory_exists
unless File.directory? i
if be_verbose
opnn; e "The directory at `#{sdir(i)}` does not exist."
opnn; e 'We will create it now.'
end
FileUtils.mkdir_p(i)
end
end
i = i.dup if i.frozen?
i << '/' unless i.end_with? '/'
i = rds(i) if File.directory? i
if be_verbose
e "Changing into the directory `#{sdir(i.to_s)}` now."
end
Dir.chdir(i) if File.directory? i end
end
|
#change_permission(file = 'test', use_this_uid_number = '1000') ⇒ Object
Also known as:
chown
#
change_permission (chown tag)
This simple method can be used to change permissions, by making use of FileUtils.chown().
#
448
449
450
451
452
453
|
# File 'lib/rbt/base/prototype.rb', line 448
def change_permission(
file = 'test',
use_this_uid_number = '1000'
)
FileUtils.chown(use_this_uid_number, use_this_uid_number, file) end
|
#cheering_person? ⇒ Boolean
Also known as:
return_cheering_person, cheering_person
708
709
710
|
# File 'lib/rbt/base/prototype.rb', line 708
def cheering_person?
'\o/'
end
|
#chmod(i) ⇒ Object
647
648
649
|
# File 'lib/rbt/base/prototype.rb', line 647
def chmod(i)
RBT.chmod(i)
end
|
#chop_off_archive(i) ⇒ Object
#
chop_off_archive
Remove the trailing part of an archive, for the most part. This isn't very sophisticated but it “just works” for most cases (TM).
#
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
|
# File 'lib/rbt/base/base.rb', line 306
def chop_off_archive(i)
if i.include? '#' i = i[0..(i.index('#')-1)]
end
i.sub!(/\.source$/,'') if i.include? 'source'
i.sub!(/-stable$/,'') if i.end_with? '-stable'
i = i.sub(/&type=zip$/,'').
sub(/\.lz$/,'').
sub(/\.gz$/,'').
sub(/\.xz$/,'').
sub(/\.bz2$/,'').
sub(/\.tar$/,'').
sub(/\.zip$/,'').
sub(/\.js$/,'')
return i
end
|
#cliner(optional_arguments = nil, use_this_colour = nil) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/rbt/base/cliner.rb', line 15
def cliner(
optional_arguments = nil,
use_this_colour = nil
)
if block_given?
RBT.cliner(optional_arguments, use_this_colour) { yield }
else
RBT.cliner(optional_arguments, use_this_colour)
end
end
|
#colourize_directory_for_system_results(i) ⇒ Object
#
colourize_directory_for_system_results
This method is to colourize directories that are given via system() or similar calls. In theory, we could use sdir(), but I wanted to have another colour.
#
200
201
202
|
# File 'lib/rbt/base/colours.rb', line 200
def colourize_directory_for_system_results(i)
lightslategray(i)
end
|
#colourize_this_error(i) ⇒ Object
#
colourize_this_error
This method in particular attempts to colourize some errors.
#
281
282
283
284
|
# File 'lib/rbt/base/colours.rb', line 281
def colourize_this_error(i)
return darkgoldenrod(i) if use_colours?
i
end
|
#colourize_this_file_path(i, colour1 = :slateblue, colour2 = :royalblue) ⇒ Object
#
colourize_this_file_path
This method will colourize a “file path”. So for example, if you have a file path such as “/opt/foo/bar.rb”, then this method will colourize the directory in one colour, and the file itself (bar.rb) in another colour.
The whole idea behind this is to be easily able to separate which part is the directory and which part is the file.
If no '/' has been given then the input will be returned unmodified.
The colour for this can be controlled by the input-arguments.
#
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
|
# File 'lib/rbt/base/colours.rb', line 242
def colourize_this_file_path(
i,
colour1 = :slateblue, colour2 = :royalblue )
if i.include? '/'
if use_colours?
dirname = File.dirname(i)
basename = File.basename(i)
dirname = send(colour1, dirname+'/')
basename = send(colour2, basename)
i = "#{dirname}#{basename}"
end
end
i
end
|
#colourize_this_warning(i) ⇒ Object
Also known as:
colourize_for_warnings
#
colourize_this_warning
#
289
290
291
292
|
# File 'lib/rbt/base/colours.rb', line 289
def colourize_this_warning(i)
return firebrick(i) if use_colours?
i
end
|
#commandline_arguments? ⇒ Boolean
Also known as:
input?, arguments?, all_arguments?
#
commandline_arguments?
#
37
38
39
|
# File 'lib/rbt/base/commandline_arguments.rb', line 37
def commandline_arguments?
@commandline_arguments
end
|
#commandline_arguments_without_hyphens? ⇒ Boolean
#
commandline_arguments_without_hyphens?
As above, but reversed.
#
64
65
66
67
68
|
# File 'lib/rbt/base/commandline_arguments.rb', line 64
def commandline_arguments_without_hyphens?
@commandline_arguments.select {|entry|
entry and !entry.start_with?('--')
}
end
|
#config? ⇒ Boolean
201
202
203
|
# File 'lib/rbt/base/base.rb', line 201
def config?
RBT.configuration?
end
|
#convert_env_variable(i) ⇒ Object
Also known as:
convert_global_env, sanitize_for_environment_variable
#
convert_env_variable
This method can be used to convert a ENV variable, such as $BLA, into its corresponding “real” value.
#
638
639
640
|
# File 'lib/rbt/base/prototype.rb', line 638
def convert_env_variable(i)
RBT.convert_global_env(i)
end
|
#cookbook_files?(show_how = :show_only_name) ⇒ Boolean
Also known as:
available_cookbook_files?
#
cookbook_files?
This method will return all available cookbook files in an Array.
Usage example:
cookbook_files?(:show_full_path)
#
91
92
93
94
95
96
97
98
99
100
101
|
# File 'lib/rbt/base/base.rb', line 91
def cookbook_files?(show_how = :show_only_name)
result = Dir["#{individual_cookbooks_directory?}*yml"].sort
case show_how
when :show_only_name result.map! {|entry|
File.basename(entry).gsub( File.extname(entry), '' )
}
when :show_full_path end
return result
end
|
#cookbooks_include_this_program? ⇒ Boolean
#
is_this_program_included?
Use this method to query whether a program is included or whether it is not.
The second argument is, by default, nil. It can be a symbol such as :include_abbreviations, in which case we will include abbreviations.
#
cookbooks_include_this_program?
228
229
230
231
232
|
# File 'lib/rbt/base/misc.rb', line 228
def is_this_program_included?(
i, optional_arguments = nil
)
RBT.is_this_program_included?(i, optional_arguments) end
|
#copy_directory(from, to = return_pwd, be_verbose = false) ⇒ Object
#
copy_directory
This method can be used to copy a directory from a certain location to the specified (second argument) target directory.
#
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/rbt/base/copy_directory.rb', line 19
def copy_directory(
from,
to = return_pwd,
be_verbose = false
)
case to
when :be_verbose
to = return_pwd
be_verbose = true
end
case be_verbose
when :be_verbose
be_verbose = true
end
if be_verbose
e "Now copying the directory `#{sdir(from)}` to `#{sdir(to)}`."
end
FileUtils.cp_r(from, to)
end
|
#copy_files(from, to = return_pwd, be_verbose = false) ⇒ Object
Also known as:
copy_file, copy, cp
#
copy_files (copy tag, cp tag, copy file tag)
Use this if you need to copy a file.
#
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
# File 'lib/rbt/base/copy_files.rb', line 31
def copy_files(
from,
to = return_pwd,
be_verbose = false
)
if block_given?
yielded = yield
case yielded
when :be_verbose
be_verbose = true
end
end
case be_verbose when :be_verbose
be_verbose = true
end
case to
when '.'
to = return_pwd
end
from = sanitize_for_environment_variable(from) if from.include? '$'
to = sanitize_for_environment_variable(to) if to.include? '$'
unless File.exist? File.dirname(to)
create_directory(File.dirname(to))
end
if File.exist? from
if be_verbose
e "#{rev}Now copying the file `#{sfile(from)}` to `#{sfile(to)}`."
end
FileUtils.cp(from, to)
else
e "Can not copy the file `#{sfile(from)}` as it "\
"does not appear to exist."
end
end
|
#copy_recursively(what, where_to = '/usr/', be_verbose = false) ⇒ Object
102
103
104
105
106
107
108
|
# File 'lib/rbt/base/misc.rb', line 102
def copy_recursively(
what,
where_to = '/usr/',
be_verbose = false
)
::RBT.copy_recursively(what, where_to, be_verbose)
end
|
#cpr(from, to = return_pwd) ⇒ Object
#
cpr
This method can be used to recursively copy to a target directory.
#
18
19
20
21
22
23
|
# File 'lib/rbt/base/copy_files.rb', line 18
def cpr(
from,
to = return_pwd
)
FileUtils.cp_r(from, to)
end
|
#create_directory(i = '/Users/Packages/', be_verbose = true, permissions = :default) ⇒ Object
Also known as:
mkdir, ensure_that_this_directory_exists, create_directory_if_it_does_not_yet_exist
#
create_directory (mkdir tag)
Consistently use this when you want to create a directory for the RBT-Project.
#
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/rbt/base/create_directory.rb', line 20
def create_directory(
i = '/Users/Packages/',
be_verbose = true,
permissions = :default
)
unless i.end_with? '/'
i = i.dup if i.frozen?
i << '/'
end
if block_given?
yielded = yield
case yielded
when :be_quiet
be_verbose = false
when :be_verbose
be_verbose = true
end
end
unless File.directory? i
if be_verbose.is_a? Hash
if be_verbose.has_key? :permissions
permissions = be_verbose.delete(:permissions)
end
if be_verbose.has_key? :be_quiet
be_verbose = be_verbose.delete(:be_quiet)
elsif be_verbose.has_key? :verbosity
be_verbose = be_verbose.delete(:verbosity)
end
end
case be_verbose
when :be_quiet,
:be_silent
be_verbose = false
end
unless File.directory? i
if be_verbose
opnn; e "Creating the directory `#{sdir(i)}` now."
end
RBT.create_directory(
i, permissions, :be_quiet, :do_not_use_opn
) end
end
end
|
#current_hour? ⇒ Boolean
Also known as:
return_time
#
current_hour?
Consistently use this method whenever you wish to return the current hour.
#
135
136
137
|
# File 'lib/rbt/base/time.rb', line 135
def current_hour?
Time.now.strftime('%H:%M:%S') end
|
#dd_mmm_yyy ⇒ Object
#
dd_mmm_yyy
This method-format is specifically the default for cookbook-files.
#
159
160
161
162
163
164
165
166
|
# File 'lib/rbt/base/time.rb', line 159
def dd_mmm_yyy
current_day = Time.now.strftime('%d') current_day+
' '+
Date::MONTHNAMES[Date.today.month][0,3].capitalize+
' '+
Time.now.strftime('%Y')
end
|
#debug(i) ⇒ Object
#
debug
Debug functionality here.
#
318
319
320
|
# File 'lib/rbt/base/prototype.rb', line 318
def debug(i)
cliner { ewarn(i) }
end
|
#debug? ⇒ Boolean
14
15
16
|
# File 'lib/rbt/base/debug.rb', line 14
def debug?
@debug
end
|
#
This method has to return a String, which constitutes the AppDir prefix of the target program at hand.
#
145
146
147
148
149
150
151
152
|
# File 'lib/rbt/base/misc.rb', line 145
def determine_appdir_prefix_from_this_input(
i = nil,
program_version = nil
)
return RBT.determine_appdir_prefix_from_this_input(
i, program_version
)
end
|
#determine_archive_type(i) ⇒ Object
#
determine_archive_type
We determine the archive type with this method, which really is a simplification.
#
167
168
169
|
# File 'lib/rbt/base/misc.rb', line 167
def determine_archive_type(i)
RBT.return_archive_type(i)
end
|
#directory_expanded_cookbooks? ⇒ Boolean
Also known as:
directory_expanded_cookbooks, base_dir_to_store_expanded_cookbooks?
#
directory_expanded_cookbooks?
#
#directory_validation? ⇒ Boolean
#
directory_validation?
#
336
337
338
|
# File 'lib/rbt/base/base.rb', line 336
def directory_validation?
RBT.directory_validation?
end
|
#disable_colours ⇒ Object
Also known as:
do_not_use_colours, disable_colors
#
disable_colours
Use this method if you wish to disable colours. Invoke it only when you really do wish to disable the colours.
#
222
223
224
|
# File 'lib/rbt/base/colours.rb', line 222
def disable_colours
@use_colours = false
end
|
#display_md5sum? ⇒ Boolean
Also known as:
show_md5sum?
94
95
96
|
# File 'lib/rbt/base/misc.rb', line 94
def display_md5sum?
RBT.display_md5sum?
end
|
#do_not_debug ⇒ Object
28
29
30
|
# File 'lib/rbt/base/debug.rb', line 28
def do_not_debug
@debug = false
end
|
#do_not_show_names ⇒ Object
#does_the_cookbook_include_this_program?(i) ⇒ Boolean
#
does_the_cookbook_include_this_program?
#
157
158
159
|
# File 'lib/rbt/base/misc.rb', line 157
def does_the_cookbook_include_this_program?(i)
RBT.does_include?(i)
end
|
#does_this_expanded_cookbook_file_exist_for_this_program?(i) ⇒ Boolean
Also known as:
does_the_expanded_cookbook_file_exist_for_this_program?, expanded_cookbook_file_exists_for?
#
does_this_expanded_cookbook_file_exist_for_this_program?
This method can be used to determine whether an expanded cookbook dataset exists for a given program at hand.
#
73
74
75
|
# File 'lib/rbt/base/expanded_cookbooks.rb', line 73
def does_this_expanded_cookbook_file_exist_for_this_program?(i)
File.exist? path_to_this_expanded_cookbooks_dataset(i)
end
|
#does_this_file_exist?(i, prepend_this = nil) ⇒ Boolean
#
does_this_file_exist?
#
114
115
116
117
118
|
# File 'lib/rbt/base/misc.rb', line 114
def does_this_file_exist?(
i, prepend_this = nil
)
::RBT.does_this_file_exist?(i, prepend_this)
end
|
#does_this_file_exist_and_is_it_a_file?(i) ⇒ Boolean
#
does_this_file_exist_and_is_it_a_file?
#
#e(i = '') ⇒ Object
77
78
79
|
# File 'lib/rbt/base/prototype.rb', line 77
def e(i = '')
puts i
end
|
#eblue(i = '') ⇒ Object
272
273
274
|
# File 'lib/rbt/base/colours.rb', line 272
def eblue(i = '')
e steelblue(i)
end
|
135
136
137
|
# File 'lib/rbt/base/colours.rb', line 135
def (i = '')
::Colours.(i)
end
|
#ecrimson(i = '') ⇒ Object
#
ecrimson
This is mostly for debug-related output, e. g. colourize something via the colour red (or rather, crimson) quickly.
#
265
266
267
|
# File 'lib/rbt/base/colours.rb', line 265
def ecrimson(i = '')
e crimson(i)
end
|
#edir(i = '') ⇒ Object
128
129
130
|
# File 'lib/rbt/base/colours.rb', line 128
def edir(i = '')
e sdir(i)
end
|
#editor? ⇒ Boolean
47
48
49
|
# File 'lib/rbt/base/editor.rb', line 47
def editor?
RBT.editor?
end
|
#efancy(i = '') ⇒ Object
166
167
168
|
# File 'lib/rbt/base/colours.rb', line 166
def efancy(i = '')
e sfancy(i)
end
|
#eimp(i) ⇒ Object
189
190
191
|
# File 'lib/rbt/base/colours.rb', line 189
def eimp(i)
e simp(i)
end
|
#email? ⇒ Boolean
16
17
18
|
# File 'lib/rbt/base/email.rb', line 16
def email?
RBT.configuration?.email.to_s
end
|
#enable_colours ⇒ Object
114
115
116
|
# File 'lib/rbt/base/colours.rb', line 114
def enable_colours
@use_colours = true
end
|
#enable_debug ⇒ Object
21
22
23
|
# File 'lib/rbt/base/debug.rb', line 21
def enable_debug
@debug = true
end
|
#ensure_main_encoding_for(i, use_this_encoding = USE_MAIN_ENCODING) ⇒ Object
#
ensure_main_encoding_for
The input to this method should be a String object.
#
405
406
407
408
409
410
411
412
|
# File 'lib/rbt/base/prototype.rb', line 405
def ensure_main_encoding_for(
i, use_this_encoding = USE_MAIN_ENCODING
)
unless i.encoding.to_s.include? use_this_encoding
i = i.force_encoding(use_this_encoding)
end
return i
end
|
#eparse(i) ⇒ Object
332
333
334
335
336
337
338
|
# File 'lib/rbt/base/colours.rb', line 332
def eparse(i)
if @use_colours
Colours.eparse(i)
else
e i
end
end
|
#esystem(i) ⇒ Object
#
esystem
Combine system() with output of the command.at hand.
#
17
18
19
|
# File 'lib/rbt/base/esystem.rb', line 17
def esystem(i)
RBT.esystem(i)
end
|
#esystem_gold(i) ⇒ Object
276
277
278
279
|
# File 'lib/rbt/base/base.rb', line 276
def esystem_gold(i)
e gold(i)
system i
end
|
#etomato(i) ⇒ Object
343
344
345
|
# File 'lib/rbt/base/colours.rb', line 343
def etomato(i)
e tomato(i)
end
|
#ewarn(i = '') ⇒ Object
305
306
307
|
# File 'lib/rbt/base/colours.rb', line 305
def ewarn(i = '')
e swarn(i) end
|
#exit_on_unregistered_cookbook_entries? ⇒ Boolean
#
exit_on_unregistered_cookbook_entries?
#
146
147
148
|
# File 'lib/rbt/base/base.rb', line 146
def exit_on_unregistered_cookbook_entries?
RBT.configuration?.exit_on_unregistered_cookbook_entries
end
|
#exit_program(symbol_exit = :standalone, optional_message = nil, use_this_as_exit_value = 0) ⇒ Object
#
exit_program (exit tag)
This is a wrapper to exit, that is, to exit a program. Either we just exit; or we return the special symbol :break
#
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/rbt/base/exit_program.rb', line 17
def exit_program(
symbol_exit = :standalone,
optional_message = nil,
use_this_as_exit_value = 0
)
e optional_message if optional_message
if symbol_exit.to_s =~ /\d+/
use_this_as_exit_value = symbol_exit.to_i
end
case symbol_exit
when :connected,
:chained,
:continue
return :break when :standalone, :may_we_exit,
:default,
'default',
'def',
true
exit(use_this_as_exit_value)
else exit(use_this_as_exit_value)
end
end
|
#expanded_cookbooks_directory_exists? ⇒ Boolean
Also known as:
expanded_directory_exists?, directory_expanded_cookbooks_exists?
#
expanded_cookbooks_directory_exists?
This method will try and check to see if the expanded-cookbooks directory exists. If this directory exists then this method will return true; otherwise this method will return false.
#
61
62
63
64
|
# File 'lib/rbt/base/expanded_cookbooks.rb', line 61
def expanded_cookbooks_directory_exists?
target = directory_expanded_cookbooks?
File.directory? target
end
|
#fast_return_file_size_of_this_program(i) ⇒ Object
#
fast_return_file_size_of_this_program
#
#file_compiled_programs? ⇒ Boolean
#
file_compiled_programs?
#
#file_last_symlinked_program? ⇒ Boolean
#
file_last_symlinked_program?
#
#file_predefined_installation_instructions? ⇒ Boolean
Also known as:
file_predefined_installation_instructions
#
file_predefined_installation_instructions?
#
#file_programs_version_url ⇒ Object
#
file_programs_version_url
#
432
433
434
|
# File 'lib/rbt/base/base.rb', line 432
def file_programs_version_url
RBT.send(__method__)
end
|
#file_specification_of_registered_cookbook_entries ⇒ Object
#
file_specification_of_registered_cookbook_entries
#
#find_cookbook_alias_for(i) ⇒ Object
#
find_cookbook_alias_for
This method depends on the Cookbooks gem.
It allows us to find the registered alias for a given program, and thus acts as an “input-sanitizer”.
#
#find_this_yaml_file(i = :poppler) ⇒ Object
Also known as:
return_yaml_file_for
#
find_this_yaml_file
This method can be used to find a proper yaml file.
We will delegate to Cookbooks for this though.
We will return the absolute path to the .yml file in question.
Usage example:
find_this_yaml_file(:poppler)
#
816
817
818
819
820
821
822
823
824
825
826
827
828
|
# File 'lib/rbt/base/prototype.rb', line 816
def find_this_yaml_file(i = :poppler)
i = i.to_s
if File.exist?(i) and File.file?(i)
i
else
RBT.return_location_of_this_yaml_file(i)
end
end
|
#first_argument? ⇒ Boolean
Also known as:
first?
14
15
16
|
# File 'lib/rbt/base/commandline_arguments.rb', line 14
def first_argument?
@commandline_arguments.first
end
|
#gem_version(i) ⇒ Object
#
gem_version
This method is a wrapper over Gem::Version.new()
The reason as to why this resides in a method is so that we can do some input-sanitizing, and easier rescue, if this is necessary one day.
#
186
187
188
189
190
191
192
193
194
195
196
197
|
# File 'lib/rbt/base/prototype.rb', line 186
def gem_version(i)
i = i.to_s.delete('vr')
begin
if i =~ /\d+/ return Gem::Version.new(i)
end
rescue ArgumentError => error
opnn; e 'An error occurred in gem_version()'
pp error
end
nil end
|
#get_all_directories_from(here = return_pwd, return_full_path = false) ⇒ Object
Also known as:
get_dir_listing, get_directory_listing, get_directories_from
#
get_all_directories_from
This method can be used to obtain all directories from the given (first) input argument.
#
859
860
861
862
863
864
|
# File 'lib/rbt/base/prototype.rb', line 859
def get_all_directories_from(
here = return_pwd,
return_full_path = false
)
RBT.get_all_directories_from(here, return_full_path)
end
|
#get_all_files_from(i) ⇒ Object
683
684
685
|
# File 'lib/rbt/base/prototype.rb', line 683
def get_all_files_from(i)
RBT.get_all_files_from(i)
end
|
#get_all_programs(from = "#{RBT.programs_directory?}*") ⇒ Object
#
get_all_programs (all programs tag)
Simply returns all programs from the $PROGRAMS directory.
#
370
371
372
373
374
|
# File 'lib/rbt/base/prototype.rb', line 370
def get_all_programs(
from = "#{RBT.programs_directory?}*"
)
Dir[from] end
|
#get_date ⇒ Object
#
get_date
This method will return a String such as “21 Sep 2017”.
#
31
32
33
|
# File 'lib/rbt/base/time.rb', line 31
def get_date
::RBT.get_date
end
|
#get_files_and_directories_from(i = return_pwd) ⇒ Object
#
get_files_and_directories_from
#
#go_to_base_dir(be_verbose = true) ⇒ Object
#
go_to_base_dir
Simply go to the temp-directory.
#
281
282
283
284
285
286
287
|
# File 'lib/rbt/base/prototype.rb', line 281
def go_to_base_dir(be_verbose = true)
_ = temp_dir?
if be_verbose
opnn; e 'Changing to '+sdir(_)
end
cd(_)
end
|
#home_dir? ⇒ Boolean
796
797
798
799
800
|
# File 'lib/rbt/base/prototype.rb', line 796
def home_dir?
rds(
"#{ENV['HOME']}/"
)
end
|
#host_system? ⇒ Boolean
Also known as:
host_architecture?, host_achiteture_in_use?
#is_a_64bit_system? ⇒ Boolean
Also known as:
is_on_64_bit?
#
is_a_64bit_system?
This method will return true if the underlying system is a 64-bit system.
#
17
18
19
|
# File 'lib/rbt/base/is_a_64_bit_system.rb', line 17
def is_a_64bit_system?
RUBY_PLATFORM.include? '_64' end
|
#is_an_archive?(i) ⇒ Boolean
Also known as:
is_archive?
675
676
677
|
# File 'lib/rbt/base/prototype.rb', line 675
def is_an_archive?(i)
RBT.is_an_archive?(i)
end
|
#is_ccache_available? ⇒ Boolean
Also known as:
ccache_is_available?
#
is_ccache_available?
This method queries as to whether ccache is available or whether it is not.
#
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
|
# File 'lib/rbt/base/base.rb', line 375
def is_ccache_available?
result = true
begin
check_for_ccache = `ccache 2>&1`
if check_for_ccache.include? 'command not found'
result = false
end
rescue Errno::ENOENT
check_for_ccache = false
end
result
end
|
#is_file?(i) ⇒ Boolean
354
355
356
|
# File 'lib/rbt/base/prototype.rb', line 354
def is_file?(i)
File.file? i
end
|
#is_on_gobolinux? ⇒ Boolean
Also known as:
are_we_on_gobolinux?
#
is_on_gobolinux?
The method is_on_gobolinux? can be used to query whether the host system is using GoboLinux (a linux distribution) or whether it is not.
#
600
601
602
|
# File 'lib/rbt/base/prototype.rb', line 600
def is_on_gobolinux?
RBT.is_on_gobolinux?
end
|
#is_on_windows? ⇒ Boolean
244
245
246
|
# File 'lib/rbt/base/misc.rb', line 244
def is_on_windows?
RBT.is_on_windows?
end
|
#is_porg_available? ⇒ Boolean
Also known as:
porg_is_available?
#
is_porg_available?
This method is required to determine whether porg is available or not.
#
468
469
470
471
|
# File 'lib/rbt/base/base.rb', line 468
def is_porg_available?
result = `porg 2>&1`.include? 'porg: command not found'
return !result
end
|
#is_roebe? ⇒ Boolean
Also known as:
is_on_roebe?, on_roebe?
#
is_roebe?
If we are on our local computer, or on another computer.
#
564
565
566
|
# File 'lib/rbt/base/prototype.rb', line 564
def is_roebe?
RBT.is_roebe?
end
|
#
This method determines whether the given input argument could be considered to be a header-file.
#
60
61
62
|
# File 'lib/rbt/base/misc.rb', line 60
def (i)
i.strip.end_with?('.h')
end
|
#is_this_a_library?(i) ⇒ Boolean
#
is_this_a_library?
This method will check whether the given input is assumed to be a library or whether it is not. If the input ends with .so or .a then this is considered to be a library, by this method.
The check inside of the method body will ensure this.
#
73
74
75
76
77
78
79
80
|
# File 'lib/rbt/base/misc.rb', line 73
def is_this_a_library?(i)
(
i.strip.end_with?('.so') or
i.strip.end_with?('.a') or
i.strip.end_with?('.o') or
i.strip.include?('.so.') )
end
|
#is_this_program_included?(i) ⇒ Boolean
Also known as:
included?, includes?, program_was_found?, include?, is_included?, includes_this_program?, is_this_program_registered?, is_the_program_included?
#
is_this_program_included?
This method will return a Boolean value (true or false).
#
224
225
226
227
228
|
# File 'lib/rbt/base/misc.rb', line 224
def is_this_program_included?(
i, optional_arguments = nil
)
RBT.is_this_program_included?(i, optional_arguments) end
|
#load_dataset_from_this_expanded_cookbook(i, &block) ⇒ Object
Also known as:
return_dataset_from_expanded_cookbook, return_dataset_from_this_expanded_cookbook, quickly_obtain_expanded_cookbook_dataset_from
#
load_dataset_from_this_expanded_cookbook
This method will attempt to load the dataset from an expanded cookbook dataset. In order for this to work, the file must exist locally.
#
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
# File 'lib/rbt/base/expanded_cookbooks.rb', line 85
def load_dataset_from_this_expanded_cookbook(i, &block)
i = i.to_s unless i.is_a? String if File.file?(i)
use_this_file = i.dup
else
use_this_file = path_to_this_expanded_cookbooks_dataset(i)
end
if File.exist? use_this_file
load_yaml(use_this_file)
else
no_file_exists_at(use_this_file, &block)
return nil
end
end
|
#load_yaml(i) ⇒ Object
#
load_yaml
This is a slightly slimpler alternative to load .yml files for the RBT project.
#
17
18
19
|
# File 'lib/rbt/base/load_yaml.rb', line 17
def load_yaml(i)
YAML.load_file(i)
end
|
#load_yaml_file_from_the_cookbook_directory_for_this_program(i) ⇒ Object
#
load_yaml_file_from_the_cookbook_directory_for_this_program
This method can be used to load the specific .yml file from the cookbook directory.
#
27
28
29
30
|
# File 'lib/rbt/base/load_yaml.rb', line 27
def load_yaml_file_from_the_cookbook_directory_for_this_program(i)
target_file = "#{RBT.cookbook_directory?}#{i}.yml"
load_yaml(target_file)
end
|
#log_directory? ⇒ Boolean
Also known as:
rbt_temp_directory?, log_dir?, rbt_log_dir?, rbt_log_directory?, rbt_temp_dir?
#
log_directory?
This will return a String such as “/Depot/Temp/rbt/”.
Several aliases exist to this method, such as the commonly used variant called log_dir?.
#
543
544
545
|
# File 'lib/rbt/base/prototype.rb', line 543
def log_directory?
RBT.log_directory?
end
|
#main_encoding? ⇒ Boolean
554
555
556
|
# File 'lib/rbt/base/prototype.rb', line 554
def main_encoding?
USE_THIS_ENCODING
end
|
#make_command? ⇒ Boolean
187
188
189
|
# File 'lib/rbt/base/base.rb', line 187
def make_command?
Base.make_command?
end
|
#make_install_command? ⇒ Boolean
#
make_install_command?
This is the default “make install” command for now.
#
219
220
221
|
# File 'lib/rbt/base/base.rb', line 219
def make_install_command?
'make install'
end
|
#move_file(this_file, where_to, be_verbose = true) ⇒ Object
Also known as:
mv, rename_file
#
move_file (move tag, mv tag)
Move a file via this method here. Use this consistently whenever you move a file. Could also be done via File.mv().
#
783
784
785
786
787
788
789
790
|
# File 'lib/rbt/base/prototype.rb', line 783
def move_file(
this_file, where_to, be_verbose = true
)
if be_verbose
e "#{rev}Moving from #{sfile(this_file)} to #{sfile(where_to)}."
end
FileUtils.mv(this_file, where_to)
end
|
#n_programs_available? ⇒ Boolean
Also known as:
n_programs_available
#
n_programs_available?
#
#new_cookbook_instance_for(name_of_the_program) ⇒ Object
#
new_cookbook_instance_for
Use a slightly shorter wrapper to access class Cookbook.
Note that you still have to require class Cookbook on your own, prior to calling this method.
The argument to this method should be the name of the program whose cookbook-dataset you wish to access/manipulate.
#
496
497
498
|
# File 'lib/rbt/base/base.rb', line 496
def new_cookbook_instance_for(name_of_the_program)
RBT::Cookbooks::Cookbook.new(name_of_the_program)
end
|
#no_directory_exists_at(i) ⇒ Object
#
no_directory_exists_at
#
431
432
433
|
# File 'lib/rbt/base/prototype.rb', line 431
def no_directory_exists_at(i)
e "No directory exists at `#{sdir(i)}`."
end
|
#no_opn ⇒ Object
Also known as:
disable_opn
61
62
63
|
# File 'lib/rbt/base/opn.rb', line 61
def no_opn
@use_opn = false
end
|
#no_such_file_exists(i, be_verbose = true, &block) ⇒ Object
Also known as:
no_file_exists_at
881
882
883
884
885
886
887
888
889
890
891
892
893
894
|
# File 'lib/rbt/base/prototype.rb', line 881
def no_such_file_exists(
i, be_verbose = true, &block
)
if block_given?
yielded = yield
case yielded
when :be_quiet
be_verbose = false
end
end
if be_verbose
e "No file called `#{sfile(i)}` appears to exist."
end
end
|
#open_in_browser(i) ⇒ Object
364
365
366
367
|
# File 'lib/rbt/base/base.rb', line 364
def open_in_browser(i)
require 'open_in_browser'
OpenInBrowser[i]
end
|
#open_in_editor(i) ⇒ Object
Also known as:
open_this_file
#
open_in_editor
This will open a cookbook .yml file in the editor.
#
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# File 'lib/rbt/base/editor.rb', line 19
def open_in_editor(i)
if i.is_a? Array
i.each {|entry| open_in_editor(entry) }
else
i = i.to_s.dup
unless i.end_with? '.yml'
i << '.yml'
end
if is_on_roebe?
unless i.start_with?(RUBY_SRC_RBT_COOKBOOKS) or
i.include?('/')
i.prepend RUBY_SRC_RBT_COOKBOOKS
end
else
unless i.include? individual_cookbooks_dir?
i.prepend individual_cookbooks_dir?
end
end
esystem "#{editor?} #{i}"
end
end
|
#opne(i) ⇒ Object
84
85
86
87
|
# File 'lib/rbt/base/opn.rb', line 84
def opne(i)
opn(namespace: @namespace) if use_opn?
e i
end
|
#opnef(i) ⇒ Object
350
351
352
|
# File 'lib/rbt/base/base.rb', line 350
def opnef(i)
opn(namespace: @namespace) if use_opn?; ee i
end
|
#opnerror(i, use_this_as_namespace = @namespace) ⇒ Object
#
opnerror (opnerror tag)
#
422
423
424
425
426
427
|
# File 'lib/rbt/base/base.rb', line 422
def opnerror(
i, use_this_as_namespace = @namespace
)
opn(namespace: use_this_as_namespace) if use_opn?
stderr i
end
|
#opnewarn(i) ⇒ Object
92
93
94
|
# File 'lib/rbt/base/opn.rb', line 92
def opnewarn(i)
opne swarn(i)
end
|
#opnn(i = @namespace, &block) ⇒ Object
Also known as:
output_namespace?
#
opnn (opnn tag)
The abbreviation “opn” stands for “output program name”. This also describes the major functionality of this method - we will try to display the name of the program that generates a particular output, so that the user can understand which component may have went wrong.
#
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/rbt/base/opn.rb', line 22
def opnn(
i = @namespace,
&block
)
if @use_opn
if i.is_a? String
i = {
namespace: i,
use_colours: use_colours?
}
end
RBT.opnn(i, &block) end
end
|
#path_to_this_expanded_cookbooks_dataset(i) ⇒ Object
Also known as:
return_file_to_the_expanded_cookbooks_dataset
#
path_to_this_expanded_cookbooks_dataset
This method shall attempt to return the full path to the expanded cookbooks directory dataset of a given program.
For example, if the input is 'htop' then this method should return 'htop.yml', or rather, '/home/Temp/rbt/expanded_cookbooks/htop.yml'.
#
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/rbt/base/expanded_cookbooks.rb', line 33
def path_to_this_expanded_cookbooks_dataset(i)
i = i.dup
i = remove_archive_at_the_end(
File.basename(i)
)
i << '.yml' unless i.end_with? '.yml'
"#{directory_expanded_cookbooks?}#{i}"
end
|
#play_song? ⇒ Boolean
#
play_song?
Query over as to whether we will play a song or not, after compilation has finished.
#
269
270
271
|
# File 'lib/rbt/base/base.rb', line 269
def play_song?
RBT.configuration?.play_song
end
|
#predefined_installation_instructions? ⇒ Boolean
#
predefined_installation_instructions?
#
#program_dir? ⇒ Boolean
#
programs_dir?
#
program_dir?
#program_exists?(this_program) ⇒ Boolean
#
program_exists?
Use this method to find out whether the given program, as input to this method, exists.
Usage example:
if program_exists? :htop
#
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
|
# File 'lib/rbt/base/base.rb', line 541
def program_exists?(this_program)
does_program_exist = false this_program = this_program.to_s.dup if this_program.include? ' ' this_program = this_program.split(' ').first
end
path_variable_file = "#{RUBY_SRC_DIR}rcfiles/lib/rcfiles/yaml/path_variable.yml"
if File.exist? path_variable_filelib
array_available_paths = load_yaml(path_variable_file)['path'].strip.split(' ')
array_available_paths.each {|path|
_ = "#{path}/#{this_program}"
does_program_exist = true if File.exist?(_)
}
end
does_program_exist = true if this_program.include? '/configure'
return does_program_exist
end
|
#programs_dir? ⇒ Boolean
Also known as:
programs_directory?
#project_base_dir? ⇒ Boolean
#project_yaml_directory? ⇒ Boolean
Also known as:
rbt_path?
#
project_yaml_directory?
This will return the path to the yaml directory.
#
460
461
462
|
# File 'lib/rbt/base/prototype.rb', line 460
def project_yaml_directory?
RBT.yaml_directory?
end
|
#publish_list_of_all_programs_version ⇒ Object
#
publish_list_of_all_programs_version
#
#rarrow? ⇒ Boolean
Also known as:
rarrow
50
51
52
|
# File 'lib/rbt/base/misc.rb', line 50
def rarrow?
cadetblue('→')
end
|
#rbt_logs? ⇒ Boolean
#
rbt_logs?
This method will return the path of where we store RBT-related log files.
#
238
239
240
|
# File 'lib/rbt/base/base.rb', line 238
def rbt_logs?
RBT.log_directory?
end
|
#read_file(i) ⇒ Object
#
read_file (read tag)
Use this method whenever you want to read in a file.
#
381
382
383
|
# File 'lib/rbt/base/prototype.rb', line 381
def read_file(i)
File.read(i) if File.exist? i
end
|
#read_file_in_default_encoding(i, use_this_encoding = ::RBT.encoding?) ⇒ Object
#
read_file_in_default_encoding
#
388
389
390
391
392
393
394
395
396
397
398
|
# File 'lib/rbt/base/prototype.rb', line 388
def read_file_in_default_encoding(
i, use_this_encoding = ::RBT.encoding?
)
if File.exist? i
File.read(
i, encoding: use_this_encoding
)
else
e "Can not read file `#{i}` as it does not exist."
end
end
|
#readlines(i) ⇒ Object
#
readlines
This is added in the event that we may wish to use a special encoding, by default, one day.
#
17
18
19
|
# File 'lib/rbt/base/readlines.rb', line 17
def readlines(i)
File.readlines(i)
end
|
#readlines_with_proper_encoding(i, use_this_encoding = main_encoding?
) ⇒ Object
Also known as:
default_readlines
#
readlines_with_proper_encoding
File.readlines() variant with proper encoding.
#
26
27
28
29
30
31
32
|
# File 'lib/rbt/base/readlines.rb', line 26
def readlines_with_proper_encoding(
i, use_this_encoding = main_encoding?
)
File.readlines(
i, encoding: use_this_encoding
)
end
|
#recipes_dir? ⇒ Boolean
139
140
141
|
# File 'lib/rbt/base/base.rb', line 139
def recipes_dir?
RBT.configuration?.recipes_dir
end
|
#register_sigint(optional_message = nil, use_this_as_exit_code = 0) ⇒ Object
149
150
151
152
153
154
155
156
157
158
159
|
# File 'lib/rbt/base/prototype.rb', line 149
def register_sigint(
optional_message = nil,
use_this_as_exit_code = 0
)
Signal.trap('SIGINT') {
if optional_message
e optional_message
end
exit(use_this_as_exit_code)
}
end
|
#remove(this_target, be_verbose = false) ⇒ Object
#
remove (remove tag)
General remove entry-method. If you wish to delete a file or a directory or a symlink, use this method.
#
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
|
# File 'lib/rbt/base/prototype.rb', line 230
def remove(
this_target,
be_verbose = false
)
if this_target.is_a? Array
this_target.each {|entry| remove(entry, be_verbose) }
else
begin
type = File.ftype(this_target)
rescue Errno::ENOENT
type = 'missing_entry'
end
if File.exist? this_target
case type when 'link','missing_entry' remove_symlink(this_target)
when 'file'
remove_file(this_target, be_verbose)
when 'directory'
remove_directory(this_target)
else ewarn "Not removing `#{simp(this)}` as \"#{simp(type)}\" is "\
"not registered."
end
else
if be_verbose
opnn; e swarn('WARNING: file ')+this_target.to_s+swarn(' does not exist.')
opnn; e swarn('Thus, it can not be removed.')
end
end
end
end
|
#remove_archive_from_the_end(i) ⇒ Object
Also known as:
remove_file_archive_at_the_end
#
remove_archive_from_the_end
This method will remove the “archive part” of the given input, such as by removing “.tar.xz” from the given input argument (which ought to be a String).
#
#
This method will remove each comment from a given line. Assume multiline input that will have trailing “ # foobar” comments which will be removed.
#
406
407
408
409
410
411
412
413
414
415
416
417
|
# File 'lib/rbt/base/base.rb', line 406
def (i)
if i.include? ' # '
i = i.split(N).map {|line|
if line.include? ' # '
line = line[0 .. (line.index('#') - 1)]
line.strip!
end
line
}.join(N)
end
i
end
|
#remove_directory(this_directory, be_verbose = false) ⇒ Object
Also known as:
remove_dir, remove_these_directories, remove_directories, remove_this_directory
#
remove_directory
Consistently use this method in order to remove one or more directories.
#
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/rbt/base/remove_directory.rb', line 18
def remove_directory(
this_directory,
be_verbose = false
)
if block_given?
yielded = yield
case yielded
when :be_verbose
be_verbose = true
end
end
if this_directory.is_a? Array
this_directory.each {|entry| remove_directory(entry, be_verbose)
}
elsif this_directory.is_a? String
case be_verbose
when :be_verbose
be_verbose = true
end
this_directory = rds(this_directory).strip if File.directory? this_directory
case this_directory when '/' e "The #{sdir('/')} directory can not be removed "\
"via this method." when RBT.temp_directory?
e "Will not remove directory `#{sdir(this_directory)}`." else
if File.exist?(this_directory) and (this_directory.size > 1)
if be_verbose
e "Removing the directory `#{sdir(this_directory)}'` next."
end
FileUtils.rm_rf(this_directory) end
end
end
else
e "Unknown input: #{this_directory.class}"
end
end
|
#remove_double_slashes(i) ⇒ Object
Also known as:
rds
#
remove_double_slashes (rds tag)
Replace // with / in a given string.
#
117
118
119
120
121
122
123
|
# File 'lib/rbt/base/prototype.rb', line 117
def remove_double_slashes(i)
if i.is_a? Array
i.map {|entry| remove_double_slashes(entry) }
else
i.squeeze '/'
end
end
|
#remove_file(i, report_the_action = false) ⇒ Object
Also known as:
delete, delete_file, remove_files, remove_these_files
#
remove_file (remove tag)
Use this method whenever you wish to remove a file.
The first input argument to this method shall be the file that we wish to remove. This means the “file path”, so the path to the file has to be provided, such as “/opt/foobar.md”. An Array can also be given, which will lead to batch-removal of the given files at hand.
The second input argument to this method, called `report_the_action`, determines whether we will be verbose or whether we will not be verbose. Verbose here means that we will notify the user what we are doing or about to do; not verbose means that we will be silent when we remove the target file.
#
28
29
30
31
32
33
34
35
36
|
# File 'lib/rbt/base/remove_file.rb', line 28
def remove_file(
i, report_the_action = false
)
if i.is_a? Array
i.each {|entry| remove_file(entry, report_the_action) }
else
RBT.remove_file(i, report_the_action)
end
end
|
#remove_file_extension(i, also_remove_the_basename = true) ⇒ Object
Also known as:
remove_archive_at_the_end, remove_extension, remove_file_suffix, remove_archive_stuff_at_the_end, sanitized_without_extension
#
remove_file_extension
This method will try to remove anything we declare to be an improper file extension. We do this by delegating towards class RemoveFileSuffix, an external dependency.
#
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
|
# File 'lib/rbt/base/prototype.rb', line 903
def remove_file_extension(
i, also_remove_the_basename = true
)
case also_remove_the_basename
when :do_not_strip_anything
also_remove_the_basename = false
end
if also_remove_the_basename
i = File.basename(i)
end
if i.end_with? '.src'
i[-4,4] = ''
elsif i.end_with? '-src'
i[-4,4] = ''
end
i = remove_unnecessary_data_from_url(i.to_s.dup)
remove_archive_from_the_end(i)
end
|
#remove_newlines(i) ⇒ Object
#
remove_newlines
Get rid of the newlines.
#
835
836
837
|
# File 'lib/rbt/base/prototype.rb', line 835
def remove_newlines(i)
i.delete("\n")
end
|
#remove_parens(i) ⇒ Object
#
remove_parens
This method will turn something like ('FOO') into 'FOO'
#
728
729
730
|
# File 'lib/rbt/base/prototype.rb', line 728
def remove_parens(i)
i.delete('()')
end
|
#remove_symlink(i, be_verbose = false) ⇒ Object
Also known as:
delete_symlink, delete_this_symlink, remove_this_symlink
#
remove_symlink
Simply remove a symlink. Use this method consistently when you wish to remove any symlink.
#
88
89
90
91
92
93
94
95
96
|
# File 'lib/rbt/base/symlink.rb', line 88
def remove_symlink(i)
if i.is_a? Array
i.each {|entry| remove_symlink(entry) }
else
if File.symlink? i
File.delete(i)
end
end
end
|
#remove_this_commandline_argument(i) ⇒ Object
#
remove_this_commandline_argument
This method can be used to remove a specific argument from the commandline arguments.
#
76
77
78
79
80
|
# File 'lib/rbt/base/commandline_arguments.rb', line 76
def remove_this_commandline_argument(i)
@commandline_arguments.reject! {|line|
line =~ /#{Regexp.quote(i)}/
}
end
|
#remove_trailing_ANSII_escape_code(i) ⇒ Object
#
remove_trailing_ANSII_escape_code
This method can be used if you need to get rid of trailing ANSII escape sequences from a given String.
#
322
323
324
325
326
327
|
# File 'lib/rbt/base/colours.rb', line 322
def remove_trailing_ANSII_escape_code(i)
if use_colours?
i = ::Colours.remove_trailing_ANSII_escape_code(i)
end
i
end
|
#remove_unnecessary_data_from_url(i) ⇒ Object
Also known as:
return_program_full_name_from_url
#
remove_unnecessary_data_from_url
This method removes some meaningless information that can be found in some URLs.
#
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/rbt/base/base.rb', line 57
def remove_unnecessary_data_from_url(i)
i = i.first if i.is_a? Array
i = i.to_s.dup
i = File.basename(i)
i.gsub(/download\?file=/,'').
sub(/\/download$/,'').
sub(/\?download$/,'').
gsub(/-fullsrc/,'').
gsub(/-source/,'').
gsub(/\?use_mirror=dfn/,'').
gsub(/\.src/,'').
gsub(/-src/,'')
end
|
#rename(old_name, new_name) ⇒ Object
171
172
173
174
175
|
# File 'lib/rbt/base/prototype.rb', line 171
def rename(old_name, new_name)
if File.exist? old_name
File.rename(old_name, new_name)
end
end
|
#rename_kde_konsole_tab(use_this_as_the_new_title = '') ⇒ Object
#
rename_kde_konsole_tab
#
22
23
24
25
26
27
28
29
|
# File 'lib/rbt/base/misc.rb', line 22
def rename_kde_konsole_tab(
use_this_as_the_new_title = ''
)
if Object.const_defined?(:Roebe) and
Roebe.respond_to?(:rename_tab)
Roebe.rename_tab(use_this_as_the_new_title)
end
end
|
#repackage(i, use_this_for_the_opnn_namespace = 'RBT::Repackage') ⇒ Object
Also known as:
repackage_this
#
repackage (repackage tag)
This method will repackage an archive format such as .tar.gz into .tar.xz.
#
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
|
# File 'lib/rbt/base/base.rb', line 442
def repackage(
i,
use_this_for_the_opnn_namespace = 'RBT::Repackage'
)
begin
require 'repackage'
if File.exist? i
opnn(
namespace_to_use: use_this_for_the_opnn_namespace
)
e "Trying to repackage `#{sfile(i)}` next:"
Repackage.new(i) { :run_already }
else
end
rescue LoadError
e 'The gem called "repackage" is not available - please install it'
e "in order to repackage the archive at hand here (`#{sfile(i)}`)."
end
end
|
#report_n_programs ⇒ Object
#
report_n_programs
Usage example for the report functionality of this method:
report_n_programs
#
125
126
127
|
# File 'lib/rbt/base/base.rb', line 125
def report_n_programs
consider_reporting_how_many_programs_are_registered
end
|
#report_pwd ⇒ Object
34
35
36
|
# File 'lib/rbt/base/return_pwd.rb', line 34
def report_pwd
e "The current directory is at `#{sdir_return_pwd}`."
end
|
#report_to_developers(this_email = RBT.configuration?.email) ⇒ Object
#
report_to_developers
Feedback information to the user so that he can report useful information to the project lead.
#
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
|
# File 'lib/rbt/base/base.rb', line 513
def report_to_developers(
this_email = RBT.configuration?.email
)
opnn; ewarn 'To report to the developer(s) of RBT, use this '\
'email address:'
opnn; e
opnn; efancy ' '+this_email
opnn; e
opnn; ewarn 'You can also use this URL:'
opnn; e
opnn; efancy " #{RBT_HOMEPAGE_URL}"
if RBT_HOMEPAGE_URL.include? 'rbt'
opnn; efancy ' https://rubygems.org/profiles/58718/'
end
opnn; e
end
|
#report_working_directory ⇒ Object
#
report_working_directory
This method will simply report the current working directory (pwd), without making use of opnn().
#
236
237
238
|
# File 'lib/rbt/base/misc.rb', line 236
def report_working_directory
e "The current working directory is #{sdir(return_pwd)}."
end
|
#reset ⇒ Object
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/rbt/base/reset.rb', line 18
def reset
@commandline_arguments = []
@namespace = { namespace: NAMESPACE }
@be_verbose = true
@use_colours = RBT.use_colours? @run_simulation = RBT.configuration?.run_simulation @use_opn = true
@debug = RBT.shall_we_debug?
end
|
#return_all_archives_from_this_directory(i) ⇒ Object
#
return_all_archives_from_this_directory
#
#return_commandline_arguments_with_leading_hyphens(i = @commandline_arguments) ⇒ Object
Also known as:
commandline_arguments_containing_leading_hyphens?, return_arguments_with_leading_hyphens, return_commandline_arguments_with_hyphens
#
return_commandline_arguments_with_leading_hyphens
This will select all commandline-arguments with leading '–' characters.
#
49
50
51
52
53
54
55
|
# File 'lib/rbt/base/commandline_arguments.rb', line 49
def return_commandline_arguments_with_leading_hyphens(
i = @commandline_arguments
)
i.select {|entry|
entry and entry.start_with?('--')
}
end
|
#return_current_hour_minutes_second ⇒ Object
Also known as:
ss_mm_hh
#
return_current_hour_minutes_second
This method will return the current time, in HH::MM::SS format.
#
40
41
42
|
# File 'lib/rbt/base/time.rb', line 40
def return_current_hour_minutes_second
Time.now.strftime '%H:%M:%S' end
|
#return_date ⇒ Object
Also known as:
return_current_date, return_current_time, dd_mm_yyyy
#
return_date
This method wil return a date (a day), such as “21.09.2017” or “03.06.2018” - in other words, the dd.mm.yyyy format.
#
20
21
22
|
# File 'lib/rbt/base/time.rb', line 20
def return_date
::RBT.return_date
end
|
#return_day_of_the_month_based_on_utc ⇒ Object
#
return_day_of_the_month_based_on_utc
#
77
78
79
|
# File 'lib/rbt/base/time.rb', line 77
def return_day_of_the_month_based_on_utc
return_utc.day.to_s
end
|
#return_full_time ⇒ Object
#
return_full_time
This method will return a String such as '21.09.2017, 03:03:09'.
#
59
60
61
|
# File 'lib/rbt/base/time.rb', line 59
def return_full_time
"#{return_date}, #{return_current_hour_minutes_second}"
end
|
#return_hours_minutes_seconds_based_on_utc ⇒ Object
#
return_hours_minutes_seconds_based_on_utc
#
91
92
93
94
|
# File 'lib/rbt/base/time.rb', line 91
def return_hours_minutes_seconds_based_on_utc
_ = return_utc
_.strftime('%H:%M:%S')
end
|
#return_location_to_this_programs_yaml_file(i) ⇒ Object
#
return_location_to_this_programs_yaml_file
Easier access-method to determine where the yaml file may be.
#
#return_month_based_on_this_number(i) ⇒ Object
#
return_month_based_on_this_number
The input to this method should be an Integer, for the month, such as 1,2,3 and so forth.
#
125
126
127
|
# File 'lib/rbt/base/time.rb', line 125
def return_month_based_on_this_number(i)
Date::MONTHNAMES[i.to_i]
end
|
#return_month_based_on_utc ⇒ Object
#
return_month_based_on_utc
#
115
116
117
|
# File 'lib/rbt/base/time.rb', line 115
def return_month_based_on_utc
Date::MONTHNAMES[return_utc.month]
end
|
#return_n_random_characters(i = 10) ⇒ Object
#
return_n_random_characters
This method will return n random characters, as Strings. It is used specifically to “create” a random temporary directory, into which archives can be extracted into.
#
38
39
40
41
42
43
44
45
|
# File 'lib/rbt/base/misc.rb', line 38
def return_n_random_characters(
i = 10
)
array = ('a'..'z').to_a
_ = ''.dup
i.times { _ << array.sample }
_
end
|
#return_opnn(i = nil) ⇒ Object
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/rbt/base/opn.rb', line 68
def return_opnn(
i = nil
)
hash = { namespace: @namespace, be_verbose: false }
if i
if i.is_a? String
i = { namespace: i }
end
hash.update(i)
end
opnn(hash)
end
|
18
19
20
21
22
23
24
25
|
# File 'lib/rbt/base/program_information.rb', line 18
def return_program_information(i)
if Object.const_defined? :ProgramInformation
if i.include?('-')
i = ProgramInformation.return_real_short_name(i)
end
end
i
end
|
#return_program_name(i, optional_padding = ' ') ⇒ Object
Also known as:
rpn
#
return_program_name
This will always return the proper program name. If you need to modify that name, you must do so on your own.
#
760
761
762
763
764
765
766
|
# File 'lib/rbt/base/prototype.rb', line 760
def return_program_name(i, optional_padding = ' ')
_ = ''.dup
if REPORT_SPECIFIC_PROGRAM_NAME
_ << "#{File.basename(i)}:#{optional_padding}"
end
return _
end
|
#return_program_name_for_gobolinux_systems(i) ⇒ Object
#
return_program_name_for_gobolinux_systems
This method should ideally return the program name for GoboLinux systems.
#
610
611
612
|
# File 'lib/rbt/base/prototype.rb', line 610
def return_program_name_for_gobolinux_systems(i)
return i
end
|
#return_pwd ⇒ Object
Also known as:
return_current_pwd, pwd?, get_pwd
15
16
17
|
# File 'lib/rbt/base/return_pwd.rb', line 15
def return_pwd
RBT.return_pwd
end
|
#return_unicode_warning_symbol_or_empty_string ⇒ Object
#
return_unicode_warning_symbol_or_empty_string
#
527
528
529
530
531
532
533
|
# File 'lib/rbt/base/prototype.rb', line 527
def return_unicode_warning_symbol_or_empty_string
if Object.const_defined?(:Roebe) and Roebe.respond_to?(:unicode_warning_symbol)
Roebe.unicode_warning_symbol
else
''
end
end
|
#return_utc ⇒ Object
#
return_utc
This method will return a Time object that is in UTC format, such as “2018-12-28 14:09:26 UTC”.
#
50
51
52
|
# File 'lib/rbt/base/time.rb', line 50
def return_utc
Time.now.getutc
end
|
#
Slackware changelog uses a format such as this one here, in a UTC format:
Thu Sep 21 01:23:24 UTC 2017
#
103
104
105
106
107
108
109
110
|
# File 'lib/rbt/base/time.rb', line 103
def return_utc_time_in_a_format_similar_to_slackware
return_weekday_based_on_utc.to_s+' '+
return_month_based_on_utc.to_s+' '+
return_day_of_the_month_based_on_utc+' '+
return_hours_minutes_seconds_based_on_utc+
' UTC '+
return_year_based_on_utc
end
|
#return_version_of_this_program(i) ⇒ Object
#
return_version_of_this_program
#
#return_weekday_based_on_utc ⇒ Object
#
return_weekday_based_on_utc
This will return e. g. 'Mon' or 'Fri' or something like that.
#
68
69
70
71
72
|
# File 'lib/rbt/base/time.rb', line 68
def return_weekday_based_on_utc
_ = return_utc
wday = _.wday
Time::RFC2822_DAY_NAME[wday]
end
|
#return_year_based_on_utc ⇒ Object
#
return_year_based_on_utc
#
84
85
86
|
# File 'lib/rbt/base/time.rb', line 84
def return_year_based_on_utc
return_utc.year.to_s
end
|
#rev ⇒ Object
312
313
314
|
# File 'lib/rbt/base/colours.rb', line 312
def rev
::RBT.rev(@use_colours)
end
|
#run ⇒ Object
14
15
|
# File 'lib/rbt/base/run.rb', line 14
def run
end
|
#run_ldconfig? ⇒ Boolean
Also known as:
use_ldconfig?
153
154
155
|
# File 'lib/rbt/base/base.rb', line 153
def run_ldconfig?
RBT.configuration?.run_ldconfig
end
|
#run_make_then_make_install ⇒ Object
#
run_make_then_make_install
#
#run_simulation=(i = false) ⇒ Object
#
run_simulation
Setter method for the ivar @run_simulation.
This way we can run in simulation mode. That way, we won't do any modifications, we will only assume that certain things be done.
#
347
348
349
|
# File 'lib/rbt/base/prototype.rb', line 347
def run_simulation=(i = false)
@run_simulation = i
end
|
#run_simulation? ⇒ Boolean
Also known as:
run_simulation, in_simulation?
#
run_simulation?
This method will tell us whether we shall we run in simulation mode or whether we shall not. The default is false, as in, we will not run in simulation mode.
The simulation mode is required to tell the user what we would do, without actually doing any of these changes. It is a “dry run”, a test run.
#
334
335
336
|
# File 'lib/rbt/base/prototype.rb', line 334
def run_simulation?
@run_simulation
end
|
#sanitize_url1_entry(i, optional_hash = {}) ⇒ Object
175
176
177
|
# File 'lib/rbt/base/misc.rb', line 175
def sanitize_url1_entry(i, optional_hash = {})
RBT.sanitize_url1_entry(i, optional_hash)
end
|
#sdir(i = '') ⇒ Object
150
151
152
153
|
# File 'lib/rbt/base/colours.rb', line 150
def sdir(i = '')
return ::Colours.sdir(i) if use_colours?
i
end
|
#sdir_return_pwd ⇒ Object
#
sdir_return_pwd
This method will simply colourize the returned String from the method return_pwd().
#
27
28
29
|
# File 'lib/rbt/base/return_pwd.rb', line 27
def sdir_return_pwd
sdir(return_pwd)
end
|
#set_be_silent(i = false) ⇒ Object
Also known as:
be_silent, be_quiet, set_be_quiet
#
set_be_silent
Set whether we will be verbose or whether we will not.
#
47
48
49
|
# File 'lib/rbt/base/be_verbose.rb', line 47
def set_be_silent(i = false) @be_verbose = i
end
|
#set_be_verbose(i = true) ⇒ Object
Also known as:
be_verbose, be_verbose=
#
set_be_verbose
By default we will be verbose.
#
30
31
32
|
# File 'lib/rbt/base/be_verbose.rb', line 30
def set_be_verbose(i = true)
@be_verbose = i
end
|
#set_commandline_arguments(i = '') ⇒ Object
Also known as:
set_input
#
set_commandline_arguments
#
21
22
23
24
|
# File 'lib/rbt/base/commandline_arguments.rb', line 21
def set_commandline_arguments(i = '')
i = [i].flatten.compact
@commandline_arguments = i
end
|
#set_source_directory(i = return_pwd, be_verbose = false) ⇒ Object
Also known as:
set_source_dir
#
set_source_directory
Set the source dir to ANY new location. Defaults to Dir.pwd.
Example to test it this method:
ry mantis --source_dir=/Depot/j
#
289
290
291
292
293
294
295
296
297
298
|
# File 'lib/rbt/base/base.rb', line 289
def set_source_directory(
i = return_pwd,
be_verbose = false
)
i << '/' unless i.end_with? '/'
RBT.set_source_directory(i)
if be_verbose?
e "Setting source directory to `#{sdir(i)}` next."
end
end
|
#set_use_opn(i) ⇒ Object
47
48
49
|
# File 'lib/rbt/base/opn.rb', line 47
def set_use_opn(i)
@use_opn = i
end
|
#set_xorg_buffer(i) ⇒ Object
15
16
17
|
# File 'lib/rbt/base/xorg.rb', line 15
def set_xorg_buffer(i)
::RBT.set_xorg_buffer(i)
end
|
#sfancy(i = '') ⇒ Object
173
174
175
176
|
# File 'lib/rbt/base/colours.rb', line 173
def sfancy(i = '')
return ::Colours.sfancy(i) if use_colours?
i
end
|
#sfile(i = '') ⇒ Object
158
159
160
161
|
# File 'lib/rbt/base/colours.rb', line 158
def sfile(i = '')
return ::Colours.sfile(i) if use_colours?
i
end
|
#show_overview_over_available_utility_scripts ⇒ Object
#
show_overview_over_available_utility_scripts
#
#silently_create_this_directory_if_it_does_not_yet_exist(i) ⇒ Object
#
silently_create_this_directory_if_it_does_not_yet_exist
#
75
76
77
|
# File 'lib/rbt/base/create_directory.rb', line 75
def silently_create_this_directory_if_it_does_not_yet_exist(i)
create_directory(i, :be_quiet)
end
|
#simp(i = '') ⇒ Object
Also known as:
simportant
142
143
144
145
|
# File 'lib/rbt/base/colours.rb', line 142
def simp(i = '')
return ::Colours.simp(i) if use_colours?
i
end
|
#source_base_directory? ⇒ Boolean
Also known as:
source_directory?, source_directory, source_dir?, archive_dir?, src_dir?
#
source_base_directory?
#
#ssym(i) ⇒ Object
181
182
183
184
|
# File 'lib/rbt/base/colours.rb', line 181
def ssym(i)
return Colours.ssym(i) if use_colours?
i
end
|
#stderr(i = '', use_puts_or_print = :puts) ⇒ Object
#
stderr
This method is used specifically to indicate errors.
#
575
576
577
578
579
580
581
582
|
# File 'lib/rbt/base/prototype.rb', line 575
def stderr(
i = '', use_puts_or_print = :puts
)
if use_colours?
i = orangered(i)
end
RBT.stderr(i, use_puts_or_print)
end
|
#store_into_this_directory? ⇒ Boolean
Also known as:
store_where?
#
store_into_this_directory?
#
245
246
247
|
# File 'lib/rbt/base/base.rb', line 245
def store_into_this_directory?
RBT.store_into_this_directory?
end
|
#swarn(i = '') ⇒ Object
297
298
299
300
|
# File 'lib/rbt/base/colours.rb', line 297
def swarn(i = '')
return Colours.swarn(i) if use_colours?
i
end
|
#symlink(existing, new_location = nil, be_verbose = true, use_colours = RBT.use_colours?) ⇒ Object
Also known as:
do_symlink, symlink_file
#
symlink (symlink tag)
Wrapper to symlinking something.
The first argument should be the existing target.
The second argument shall be the name of the new location.
Since as of November 2019, the following syntax is supported as well:
symlink(
from: @target_directory+'lib64',
to: @target_directory+'lib'
)
#
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/rbt/base/symlink.rb', line 31
def symlink(
existing,
new_location = nil,
be_verbose = true,
use_colours = RBT.use_colours? )
if block_given?
yielded = yield
case yielded
when :be_quiet
be_verbose = false
end
end
if existing.is_a? Hash
if existing.has_key?(:to) and new_location.nil?
new_location = existing.delete(:to)
end
if existing.has_key?(:from)
existing = existing.delete(:from)
end
end
::RBT.symlink(existing, new_location, be_verbose, use_colours)
end
|
#symlink_all_files_from_this_directory_to_that_directory(this_dir, that_dir) ⇒ Object
#
symlink_all_files_from_this_directory_to_that_directory
#
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/rbt/base/symlink.rb', line 59
def symlink_all_files_from_this_directory_to_that_directory(
this_dir,
that_dir
)
delete_target_file = false
if block_given?
yielded = yield
case yielded
when :delete_target_file_if_it_exists
delete_target_file = true
end
end
all_files = Dir[this_dir+'*'].select {|entry| is_file?(entry) }
all_files.each {|entry|
if delete_target_file
_ = that_dir+File.basename(entry)
if File.exist? _
remove_file(_)
end
end
symlink(entry, that_dir)
}
end
|
#sysbin_directory? ⇒ Boolean
482
483
484
|
# File 'lib/rbt/base/prototype.rb', line 482
def sysbin_directory?
RBT.sysbin_directory?
end
|
#sysetc_directory? ⇒ Boolean
618
619
620
|
# File 'lib/rbt/base/prototype.rb', line 618
def sysetc_directory?
RBT.sysetc_directory?
end
|
#sysinclude_directory? ⇒ Boolean
#
sysinclude_directory?
#
#syslib_directory? ⇒ Boolean
736
737
738
|
# File 'lib/rbt/base/prototype.rb', line 736
def syslib_directory?
RBT.syslib_directory?
end
|
#sysshare_directory? ⇒ Boolean
496
497
498
|
# File 'lib/rbt/base/prototype.rb', line 496
def sysshare_directory?
RBT.sysshare_directory?
end
|
#system_directory? ⇒ Boolean
467
468
469
|
# File 'lib/rbt/base/prototype.rb', line 467
def system_directory?
RBT.system_directory?
end
|
357
358
359
|
# File 'lib/rbt/base/base.rb', line 357
def system_tags?
RBT.system_tags?
end
|
#temp_directory? ⇒ Boolean
Also known as:
temp_dir?, base_dir?
503
504
505
|
# File 'lib/rbt/base/prototype.rb', line 503
def temp_directory?
RBT.temp_directory?
end
|
#to_bool(i) ⇒ Object
Also known as:
to_boolean
86
87
88
|
# File 'lib/rbt/base/misc.rb', line 86
def to_bool(i)
RBT.to_bool(i)
end
|
#to_camelcase(i) ⇒ Object
164
165
166
|
# File 'lib/rbt/base/prototype.rb', line 164
def to_camelcase(i)
i.split('_').map { |_| _.capitalize }.join
end
|
#to_unicode(i) ⇒ Object
#
to_unicode
This method will “convert” into the Unicode-encoding.
#
513
514
515
|
# File 'lib/rbt/base/prototype.rb', line 513
def to_unicode(i)
i.force_encoding(ENCODING_UTF)
end
|
#today?(display_in_long_format = true) ⇒ Boolean
#
today?
This method will return a String such as “21 September 2017”.
#
144
145
146
147
148
149
150
151
152
|
# File 'lib/rbt/base/time.rb', line 144
def today?(
display_in_long_format = true
)
if display_in_long_format Time.now.strftime('%d %B %Y') else
Time.now.strftime('%d.%m.%Y') end
end
|
#touch(i, be_verbose = false) ⇒ Object
Also known as:
create_file, touch_file
#
touch (touch tag)
Use this unified method whenever you wish to create a new file, like the UNIX “touch” command.
#
131
132
133
134
135
136
137
138
139
140
141
142
143
|
# File 'lib/rbt/base/prototype.rb', line 131
def touch(
i,
be_verbose = false
)
case be_verbose
when :be_verbose
be_verbose = true
end
if be_verbose
e "Next creating the file `#{sfile(i)}`."
end
FileUtils.touch(i)
end
|
#unicode_cliner(a = :default, b = :default, &block) ⇒ Object
29
30
31
|
# File 'lib/rbt/base/cliner.rb', line 29
def unicode_cliner(a = :default, b = :default, &block)
::RBT.unicode_cliner(a, b, &block)
end
|
#unicode_middle_cliner(a = :default, b = :default) ⇒ Object
#
unicode_middle_cliner
#
36
37
38
|
# File 'lib/rbt/base/cliner.rb', line 36
def unicode_middle_cliner(a = :default, b = :default)
::RBT.unicode_cliner(a, b) { :unicode_middle_horizontal_bar }
end
|
#upload_list_of_all_programs_version ⇒ Object
#
upload_list_of_all_programs_version
#
#use_ccache? ⇒ Boolean
#
use_ccache?
Whether we will make use of ccache or whether we don't, by default.
#
228
229
230
|
# File 'lib/rbt/base/base.rb', line 228
def use_ccache?
RBT.configuration?.use_ccache
end
|
#use_colours=(i = true) ⇒ Object
121
122
123
|
# File 'lib/rbt/base/colours.rb', line 121
def use_colours=(i = true)
@use_colours = i
end
|
#use_colours? ⇒ Boolean
Also known as:
we_may_use_colours?
#
use_colours?
Query whether we may use colours or not.
#
107
108
109
|
# File 'lib/rbt/base/colours.rb', line 107
def use_colours?
@use_colours
end
|
#use_mrxvt? ⇒ Boolean
252
253
254
|
# File 'lib/rbt/base/base.rb', line 252
def use_mrxvt?
RBT.configuration?.use_mrxvt
end
|
#use_opn=(i = true) ⇒ Object
54
55
56
|
# File 'lib/rbt/base/opn.rb', line 54
def use_opn=(i = true)
@use_opn = i
end
|
#use_opn? ⇒ Boolean
Also known as:
show_opnn?
40
41
42
|
# File 'lib/rbt/base/opn.rb', line 40
def use_opn?
@use_opn
end
|
#use_porg? ⇒ Boolean
#
use_porg?
Whether we will use porg for installation or whether we will not.
Most users probably do not need/want this, so this is mostly for my home system, but also those users who may wish to use porg.
#
481
482
483
|
# File 'lib/rbt/base/base.rb', line 481
def use_porg?
RBT.configuration?.use_porg
end
|
#use_stow? ⇒ Boolean
194
195
196
|
# File 'lib/rbt/base/base.rb', line 194
def use_stow?
RBT.configuration?.use_stow
end
|
259
260
261
|
# File 'lib/rbt/base/base.rb', line 259
def use_tags?
RBT.configuration?.use_tags
end
|
#verbose_truth(i, optional_arguments = nil) ⇒ Object
Also known as:
vt, verbose_truth?
#
verbose_truth
This will give us back “yes” or “no”, in String form.
#
950
951
952
|
# File 'lib/rbt/base/prototype.rb', line 950
def verbose_truth(i, optional_arguments = nil)
RBT.verbose_truth(i, optional_arguments)
end
|
#warn_and_exit(input, exit_mode = true) ⇒ Object
Also known as:
warn_then_exit
#
warn_and_exit
This method will exit from the scripts.
You should be careful when using this, because in some situations we do not actually want to exit completely - for example when we chain-compile something.
#
173
174
175
|
# File 'lib/rbt/base/base.rb', line 173
def warn_and_exit(input, exit_mode = true)
warn(input, exit_mode)
end
|
#wget(i) ⇒ Object
210
211
212
|
# File 'lib/rbt/base/misc.rb', line 210
def wget(i)
esystem "wget #{i}"
end
|
#word_wrap(this_text, n_characters_limit = 78) ⇒ Object
Also known as:
wrap_at
#
word_wrap
The first argument is the text that will be reformatted.
The second argument is at which position we will wrap it.
#
19
20
21
22
23
24
|
# File 'lib/rbt/base/word_wrap.rb', line 19
def word_wrap(
this_text,
n_characters_limit = 78
)
::RBT.wrap_at(this_text, n_characters_limit)
end
|
#write_what_into(what, into, permissions_to_use = '755') ⇒ Object
Also known as:
save_file, save_what_into, store_what_into, save_what_to
#
write_what_into
Delegate towards the SaveFile functionality here.
#
29
30
31
32
33
|
# File 'lib/rbt/base/save_file.rb', line 29
def write_what_into(
what, into, permissions_to_use = '755'
)
RBT.write_what_into(what, into, permissions_to_use)
end
|
#write_what_into_via_unicode(what, into, permissions_to_use = '755') ⇒ Object
#
write_what_into_via_unicode
Delegate towards the SaveFile functionality here.
#
18
19
20
21
22
|
# File 'lib/rbt/base/save_file.rb', line 18
def write_what_into_via_unicode(
what, into, permissions_to_use = '755'
)
RBT.write_what_into_via_unicode(what, into, permissions_to_use)
end
|
#yes_or_no(i) ⇒ Object
#
yes_or_no
Return 'Yes.' or 'No.' through this method here.
#
745
746
747
748
749
750
751
752
|
# File 'lib/rbt/base/prototype.rb', line 745
def yes_or_no(i)
case i
when true,'true'
'Yes.'
when false,'false'
'No.'
end
end
|