Class: Roebe::Base
- Inherits:
-
Object
show all
- Includes:
- CommandlineArguments
- Defined in:
- lib/roebe/base/env.rb,
lib/roebe/base/run.rb,
lib/roebe/base/base.rb,
lib/roebe/base/copy.rb,
lib/roebe/base/misc.rb,
lib/roebe/base/next.rb,
lib/roebe/base/opnn.rb,
lib/roebe/base/simp.rb,
lib/roebe/base/time.rb,
lib/roebe/base/chdir.rb,
lib/roebe/base/reset.rb,
lib/roebe/base/editor.rb,
lib/roebe/base/colours.rb,
lib/roebe/base/esystem.rb,
lib/roebe/base/symlink.rb,
lib/roebe/base/encoding.rb,
lib/roebe/base/constants.rb,
lib/roebe/base/prototype.rb,
lib/roebe/base/is_on_roebe.rb,
lib/roebe/base/verbose_truth.rb,
lib/roebe/base/write_what_into.rb,
lib/roebe/base/commandline_arguments.rb,
lib/roebe/base/home_directory_of_user_x.rb,
lib/roebe/base/support_for_beautiful_url.rb
Overview
Direct Known Subclasses
AddIrcQuote, AddNewlineAfter, AddNewlineAfterNCharacters, AddThisUserToTheSudoersFile, AddTwoBinaryNumbers, AddUserLighty, AggregateAllFilesTogetherFromThisDirectory, Aliases, AllGames, AllMyGems, Alltagsgeschichte, AlphabeticalSorter, Anteile, ApacheConfigurationMaker, AppendThis, AppendToLine, At, AudioInformation, AutoRenameFileBasedOnItsCreationDate, AutoRenameFileBasedOnTimeToday, Autodater, AutomountUSB, Automounter, AvailableClasses, BackupCoreSystem, BasicConfigure, BatchGenerateAllMyGems, BecomeAnotherUser, Bezirk, BirthdayNotifications, Books, Browser, BurnISO, CSS_Analyzer, CaesarCipher, Calendar, CalendarMaker, Cat, CelsiusToFahrenheit, CheckForBadBlocks, CheckYaml, ChmodCurrentTime, Clipboard, Clock, ColourizeNumbers, CompareTheseTwoDirectories, CompareTheseTwoFiles, CompileKernel, ConfigGenerator, Conky, ConkyRcfileGenerator, ConvertEncodingOfThisFile, ConvertFileIntoUtfEncoding, ConvertThisCgiFileIntoASinatrafiedApplication, CopyFromGlibc, CopyHere, CopyKernelConfig, CopyTheseDirectoriesTo, CorrectGibberish, CountCharacters, CovidLethality, CreateAsoundrcFile, CreateBenchmarkFile, CreateBootableUSB, CreateDesktopFile, CreateDocbookSgmlDtdCatalog, CreateFileSkeleton, CreateFirefoxExtension, CreateISO, CreateIsoForGames, CreateJarArchive, CreateLocalImagesYamlFile, CreateMyDirectories, CreateRubyDirectoryLayout, CreateZip, CurrentMonitorResolution, CurrentTimeInSingapore, CutAfterColon, CuteEmoji, Daemonize, DateSort, DayCalendar, Dbus, DeleteAllDirectories, DeleteEmptyFiles, DhcpcdWrapper, DifferencesBetweenTwoDirectories, Disable, DisplayGccVersion, DisplayWeekdays, DoAGoogleSearch, DoInstall, Done, DoneAndOpen, DoskeyGenerator, DowncaseDirectories, DowncaseExtension, DownloadFromThisUrl, DuplicateFiles, Eduroam, Email, Empty, Enable, EnableAutologin, EnglishToGerman, Ethernet, EuclidianDistance, ExtractDocumentation, ExtractGemFile, FeetToCentimetres, FetchUrl, FileFilter, FileParser, FileRenamer, FilesThatCouldBecomeApps, FilterApacheLog, FindAllFilesEncodedInISO, FindAllFilesWithAQuestionMark, FindDuplicateEntriesInAliasFile, FindEmptyFiles, FindExpandedAlias, FindOutVersionOf, FindStaticLibraries, FinishedBooks, FixMcookie, FixMissingNumbersForAsciiParadise, FixTimezone, FontInstaller, FotoSearcher, FotosFürIngrid, FragmentMaker, GUI::Calculator, GUI::PingWidget, GUI::SimpleClock, GUI::UniversalWidgets::CodeGenerator, GUI::UniversalWidgets::GenerateXorgConfiguration, GUI::UniversalWidgets::Ifconfig, GUI::UniversalWidgets::Md5Comparer, GUI::UniversalWidgets::MicrosoftController, GUI::UniversalWidgets::SendEmail, GUI::UniversalWidgets::Shell, GUI::UniversalWidgets::ShowAliases, GUI::UniversalWidgets::ShowTenAliases, GUI::UniversalWidgets::SystemWidget, GUI::UniversalWidgets::TaskViewer, GUI::UniversalWidgets::TodoViewer, GUI::UniversalWidgets::ViewImage, GUI::UniversalWidgets::WlanInformationCenter, GUI::UniversalWidgets::WorldCapitals, GeneralOverviewer, GenerateAlsaConf, GenerateDosboxConfig, GenerateEtcResolvConfFile, GenerateEtcShellFile, GenerateFluxboxAppsFile, GenerateFluxboxKeysFile, GenerateFstabFile, GenerateGemspec, GenerateGrubConfig, GenerateLocales, GenerateLsColors, GenerateMasterShellScript, GenerateNanoConfig, GenerateNsswitchConf, GenerateOverviewOfTheLocallyAvailableBooks, GenerateProtocols, GenerateRewriteRules, GenerateRtfFile, GenerateSystemValues, GenerateUnitFiles, GenerateXauthorityFile, GenerateXorgConf, GetDependencies, Github, GoodNight, GoogleUrlCleaner, GrantSuperuserRights, GrubAppender, GrubConfigGenerator, GzipThisFile, HandleLightppd, HandleQuicktipps, HelloWorld, HexToRGB, Holiday, HostsAppender, HtmlFormFetcher, IPaste, IcewmKeysGenerator, Identical, Imdb, In, IncrementApplicationVersion, Inhalt, Inputrc, InstallDebianFile, InstallFlash, InstallLibreoffice, InstallMyGems, InstallOpensslCertificates, InstallRubyProject, InstallThisKonsoleTheme, InstallWrapper, InteractiveFileCreator, Into, IsoToUsb, JavaHeader, JavaRunner, KdeKonsole, KdeKonsoleSendCommand, KeyValueParser, KeysGenerator, KillFirefox, KillPalemoon, KonsoleNewTab, LastCalledLogger, LastLine, LeftHyphenInThisFile, LevelSubdirectories, LighttpdConfigGenerator, LiloConfigGenerator, LinePadder, Log10, MakeCookbooksGem, MakeGem, ManipulateQuotes, MarkThisDirectory, MarriedWithChildren, Mbl, MealMaker, Menu::Generator, Merge, ModifyShebangHeader, Modright, MonthlyActivityOnRubygems, MountDVD, MountIsoFile, MoveContentOfThisDirectoryToThatDirectoryUnlessTargetAlreadyExists, MoveFile, MoveMouse, Mrxvt, MrxvtOptions, MyDefaultWebrickServer, MyIp, NDirectories, NDownloadsOnRubygemsOrg, NFiles, NFotos, NGemsExistInTotal, NSymlinks, NcursesTerminal, NibbleConverter, NonSymlinks, NumberFiles, NumberToEnglish, Nutrition, Nvidia, ObtainAudioRecordingsFromVoiceRecorder, OnScreenDisplay, OneLinePasswords, OpenPDF, OpenRandomBook, OutputRandomLine, OutputTextThenAssignToTheXorgBuffer, PackageJavaCompiler, PadViaQuotes, ParagraphOntoOneLine, ParseApacheLog, PascalschesDreieck, Passwords, PathGenerator, PercentageCounter, PermissionAsciiFormat, PhpToRuby, PoundToKgConverter, PrependThis, PrependThisLineToThatFile, PrependThisStringToEveryLineOfThisFile, PrependTodaysDate, Primfaktorzerlegung, PristineGems, ProperEnglish, PublishGem, PullTogether, PurgeFilesOrDirectories, PutAllGemsIntoThisProject, Qemu, QueryWorldTime, Quiz, RXinitrc, Ram, RandomBackground, RandomOpen, Rbashrc, Rdate, ReadmeGenerator, RegelVonSarrus, RemoteGems, RemoveBadFluxboxStyles, RemoveComments, RemoveDirectory, RemoveDuplicateLines, RemoveExtension, RemoveFileExtension, RemoveGems, RemoveLightyLogs, RemoveLine, RemoveLocalhost, RemoveMissing, RemoveNewlines, RemoveSoloNumbers, RemoveThisSubstringFromAllFiles, RenameMateTerminal, ReplaceGlobalVariablesInThisFile, ReplaceSpaceWithUnderscore, ReplaceWhatWith, ReportHowManyClassesExistForThisDirectory, ReportHowManyFilesAreInThisDirectory, ReportSameNamedFiles, RequireEverything, RestoreKde, ReturnNAliases, ReturnRandomImage, RomanNumberConverter, RubyCat, RubyHeader, RubyMain, RubyNano, RubySeq, RubyUseConfigFile, RubyVersionSwitcher, Run, RunEachLineAsEsystem, SanitizeThisBookPath, ScanForHttpLinks, Schlafe, SendEmail, ServeLocalPage, SetAliases, SetBackground, SetChained, SetCurrentISO, SetHardwareClock, SetHwclock, SetNormalAliasTo, SetXfceWallpaper, SetupChrootedEnvironment, Shell, Shell::ColourizedHelpLine, Shell::Commandline, ShowAppointments, ShowAvailableFonts, ShowAvailableUsers, ShowKernelModules, ShowNonSymlinks, ShowOnlyFiles, ShowPrimeNumbers, ShowSigint, ShowTenAliases, ShowTwentyAliases, SimpleBootScript, SimpleExtractor, SimpleMarkdownParser, SizeOf, SizeOfStates, SkelMaker, Slogans, SlowLoad, SortedOutput, Sourcerank, SpecialSymlink, StartProgram, StdRenamer, Stories::Stories, Story, SumOfAllNumbers, Supermerger, SymlinkAllDirectoriesInThisDirectory, SymlinkDirectoriesFromThatDirectoryToTheCurrentDirectory, SymlinkDirectory, SymlinkEverythingFromThatDirectoryToThisDirectory, SymlinkFilesFromThatDirectoryToTheCurrentDirectory, SyntaxChecker, SystemChecker, TakeScreenshot, TalesFromTheCrypt, TelnetWrapper, TerminalPS1, TestForPsych, TestOpenssl, TestYaml, TheCollatzProblem, ThresholdSplitter, TicTacToe, ToBinary, ToBuy, ToNext, ToSquashfs, ToUtf, Today, TodoOverview, TodoSanitizer, TopTenAliases, TotalPagesInFinishedBooks, Translate, TraurigeOderFröhlicheZahl, TraverseInstall, Treeview, TrivialTimeParser, TurnRubyFileIntoGem, TwentyfourHoursNotation, UmlautConverter, Undone, UnicodeSnowman, UnifiedPadding, Unrar, Upcaser, Update, UpdateStaticHtmlPagesInTheDirectoryContainingMyFotos, UploadToImgur, UpwardsCounter, Usage, UsbDevices, UseJruby, ValidateRoeberiaEnvironmentVariables, VteStarter, Wallpaper, WaylandOrXorgserver, WebfancyController, Wikipedia, Windows::Powershell, Wlan, WochentagAnzeiger, WriteWhatInto, YamlCheck, YoutubeDownloader, Zenity, Zoll
Defined Under Namespace
Modules: CommandlineArguments
Constant Summary
collapse
- COLOURS =
::Colours
- N =
"\n"
- NAMESPACE =
inspect
- HOME_DIRECTORY_OF_USER_X =
#
HOME_DIRECTORY_OF_USER_X
This constant is only useful on my home system.
#
Roebe::HOME_DIRECTORY_OF_USER_X
Instance Method Summary
collapse
-
#actions(i = nil, &block) ⇒ Object
(also: #action)
# === actions (actions tag, action tag) ========================================================================= #.
-
#append_this_onto_that_file(this, that_file) ⇒ Object
(also: #append_what_to_this_file)
# === append_this_onto_that_file ========================================================================= #.
-
#append_what_into(what, into) ⇒ Object
(also: #append_what_onto)
# === append_what_into ========================================================================= #.
-
#be_silent ⇒ Object
(also: #be_quiet, #set_be_quiet, #do_not_be_verbose)
# === be_silent ========================================================================= #.
-
#be_verbose? ⇒ Boolean
(also: #verbose?)
# === be_verbose? ========================================================================= #.
-
#beautiful_url(i) ⇒ Object
(also: #prettify_this_url, #prettify_url, #sanitize_url)
# === beautiful_url ========================================================================= #.
-
#burlywood(i = '', use_colours = @use_colours) ⇒ Object
# === burlywood ========================================================================= #.
-
#call_next(i = 'exams') ⇒ Object
# === call_next ========================================================================= #.
-
#chdir(i) ⇒ Object
(also: #cd, #cd_to_this_directory, #change_directory)
# === chdir.
-
#cheerful_guy ⇒ Object
(also: #cheering_person, #return_cheering_person)
# === cheerful_guy.
-
#cliner(use_this_token = '*') ⇒ Object
# === cliner ========================================================================= #.
-
#complex_esystem(i, optional_colourize = true, default_colour = :steelblue, use_this_padding = ' ', &block) ⇒ Object
(also: #esystem, #raw_esystem, #esystem_colourized, #esystem_colourize)
# === complex_esystem.
-
#convert_global_env(i) ⇒ Object
# === convert_global_env.
-
#copy_directory(from, to = return_pwd) ⇒ Object
(also: #cpr)
# === copy_directory.
-
#copy_file(from, to) ⇒ Object
(also: #cp, #copy, #copy_files)
# === copy_file ========================================================================= #.
-
#cornflowerblue(i = '', use_colours = use_colours?) ) ⇒ Object
# === cornflowerblue ========================================================================= #.
-
#create_directory(i, be_verbose = false) ⇒ Object
# === create_directory ========================================================================= #.
-
#crimson(i = '', use_colours = use_colours?) ) ⇒ Object
# === crimson ========================================================================= #.
-
#current_month? ⇒ Boolean
# === current_month?.
-
#current_time? ⇒ Boolean
(also: #return_time)
# === current_time?.
-
#current_year? ⇒ Boolean
(also: #current_year, #return_current_year)
# === current_year?.
-
#cyan(i = '', use_colours = @use_colours) ⇒ Object
# === cyan ========================================================================= #.
-
#darkcyan(i = '', use_colours = use_colours? ) ⇒ Object
# === darkcyan ========================================================================= #.
-
#darkgreen(i = '', use_colours = use_colours?) ) ⇒ Object
# === darkgreen ========================================================================= #.
-
#darkkhaki(i = '', use_colours = use_colours? ) ⇒ Object
# === darkkhaki ========================================================================= #.
-
#darkslateblue(i = '', use_colours = use_colours?) ) ⇒ Object
# === darkslateblue ========================================================================= #.
-
#deeppink(i = '', use_colours = @use_colours) ⇒ Object
# === deeppink ========================================================================= #.
-
#delete_symlink(i) ⇒ Object
# === delete_symlink.
-
#do_not_use_the_base_colours ⇒ Object
(also: #do_not_use_colours, #disable_colours)
# === disable_colours ========================================================================= #.
-
#do_use_the_base_colours ⇒ Object
(also: #enable_colours, #do_use_colours)
# === do_use_the_base_colours.
-
#e(i = '') ⇒ Object
(also: #br)
# === e (e tag).
-
#ecomment(i, use_colours = use_colours? ) ⇒ Object
-
#editor_to_use? ⇒ Boolean
(also: #main_editor?)
# === editor_to_use? ========================================================================= #.
-
#efancy(i = '', use_colours = @use_colours) ⇒ Object
# === efancy ========================================================================= #.
-
#eimp(i = '') ⇒ Object
# === eimp ========================================================================= #.
-
#emphasis(i) ⇒ Object
# === emphasis ========================================================================= #.
-
#ensure_main_encoding(i) ⇒ Object
# === ensure_main_encoding.
-
#ensure_utf_encoding(i) ⇒ Object
# === ensure_utf_encoding.
-
#eparse(i = '', use_colours = use_colours? ) ⇒ Object
# === eparse ========================================================================= #.
-
#erev(i = '') ⇒ Object
# === erev ========================================================================= #.
-
#esteelblue(i) ⇒ Object
# === esteelblue ========================================================================= #.
-
#etomato(i = '', use_colours = use_colours?) ) ⇒ Object
# === etomato ========================================================================= #.
-
#ewarn(i = '') ⇒ Object
# === ewarn ========================================================================= #.
-
#firebrick(i = '', use_colours = @use_colours) ⇒ Object
# === firebrick ========================================================================= #.
-
#get_current_day ⇒ Object
(also: #current_day?)
# === get_current_day.
-
#get_current_month ⇒ Object
(also: #current_month_as_number?)
# === get_current_month ========================================================================= #.
-
#get_files_and_directories(i) ⇒ Object
# === get_files_and_directories ========================================================================= #.
-
#get_files_from(i = return_pwd, additional_modifiers = nil, &block) ⇒ Object
(also: #get_all_files_from, #get_files)
# === get_files_from.
-
#get_german_name_for_this_weekday(i) ⇒ Object
(also: #return_german_name_for_this_weekday)
# === get_german_name_for_this_weekday ========================================================================= #.
-
#gold(i = '', use_colours = use_colours? ) ⇒ Object
# === gold ========================================================================= #.
-
#green(i = '', use_colours = use_colours? ) ⇒ Object
# === green ========================================================================= #.
-
#grey(i = '', use_colours = use_colours? ) ⇒ Object
(also: #grey?)
# === grey ========================================================================= #.
-
#hh_mm_ss(i = ::Time.now) ⇒ Object
(also: #ss_mm_hh)
# === hh_mm_ss.
-
#hh_mm_ss_day_month_year(i) ⇒ Object
# === hh_mm_ss_day_month_year.
-
#home_dir?(i = ENV['HOME']) ⇒ Boolean
# === home_dir?.
-
#home_directory_of_user_x? ⇒ Boolean
(also: #home_dir_of_user_x?)
# === home_directory_of_user_x? ========================================================================= #.
-
#infer_the_namespace ⇒ Object
# === infer_the_namespace.
-
#initialize(run_already = true) ⇒ Base
constructor
# === initialize ========================================================================= #.
-
#internal_hash? ⇒ Boolean
(also: #ihash?)
# === internal_hash? ========================================================================= #.
-
#is_a_directory?(i) ⇒ Boolean
# === is_a_directory? ========================================================================= #.
-
#is_a_file?(i) ⇒ Boolean
# === is_a_file? ========================================================================= #.
-
#is_a_jpg_file?(i) ⇒ Boolean
# === is_a_jpg_file? ========================================================================= #.
-
#is_an_image_file?(i) ⇒ Boolean
(also: #is_image_file?, #is_an_image?)
# === is_an_image_file? ========================================================================= #.
-
#is_archive?(i) ⇒ Boolean
# === is_archive?.
-
#is_audio_file?(i) ⇒ Boolean
# === is_audio_file?.
-
#is_in_studium_dir? ⇒ Boolean
# === is_in_studium_dir? ========================================================================= #.
-
#is_multimedia_file?(i) ⇒ Boolean
(also: #is_a_multimedia_file?)
-
#is_on_roebe? ⇒ Boolean
(also: #on_roebe?, #is_roebe?)
# === is_on_roebe?.
-
#is_on_windows? ⇒ Boolean
(also: #on_windows?, #are_we_on_windows?)
# === is_on_windows?.
-
#is_studium_available? ⇒ Boolean
# === is_studium_available?.
-
#is_symlink?(i) ⇒ Boolean
# === is_symlink? ========================================================================= #.
-
#is_this_a_ruby_file?(this_file) ⇒ Boolean
(also: #is_this_file_a_ruby_file?)
# === is_this_a_ruby_file?.
-
#is_video_file?(i) ⇒ Boolean
# === is_video_file? ========================================================================= #.
-
#iso_encoding? ⇒ Boolean
(also: #encoding?)
# === iso_encoding? ========================================================================= #.
-
#le(i = '') ⇒ Object
# === le.
-
#left_colour(i) ⇒ Object
# === left_colour.
-
#lightblue(i = '', use_colours = use_colours? ) ⇒ Object
# === lightblue ========================================================================= #.
-
#lightgreen(i = '') ⇒ Object
# === lightgreen ========================================================================= #.
-
#lightseagreen(i = '', use_colours = use_colours? ) ⇒ Object
# === lightseagreen ========================================================================= #.
-
#lightsteelblue(i = '', use_colours = use_colours? ) ⇒ Object
# === lightsteelblue ========================================================================= #.
-
#lime(i = '', use_colours = use_colours?) ) ⇒ Object
# === lime ========================================================================= #.
-
#limegreen(i = '', use_colours = use_colours? ) ⇒ Object
# === limegreen ========================================================================= #.
-
#localhost_to_data(i) ⇒ Object
# === localhost_to_data ========================================================================= #.
-
#log_directory? ⇒ Boolean
(also: #log_dir?)
# === log_directory?.
-
#main_encoding? ⇒ Boolean
# === main_encoding? ========================================================================= #.
-
#mediumorchid(i = '', use_colours = use_colours?) ) ⇒ Object
# === mediumorchid ========================================================================= #.
-
#mediumpurple(i = '', use_colours = use_colours? ) ⇒ Object
# === mediumpurple ========================================================================= #.
-
#mediumseagreen(i = '', use_colours = use_colours? ) ⇒ Object
# === mediumseagreen ========================================================================= #.
-
#mediumslateblue(i = '', use_colours = use_colours? ) ⇒ Object
# === mediumslateblue ========================================================================= #.
-
#mediumspringgreen(i = '', use_colours = use_colours? ) ⇒ Object
# === mediumspringgreen ========================================================================= #.
-
#mediumturquoise(i = '', use_colours = use_colours?) ) ⇒ Object
# === mediumturquoise ========================================================================= #.
-
#mkdir_p(i, &block) ⇒ Object
(also: #mkdir)
# === mkdir_p (mkdir tag) ========================================================================= #.
-
#mv(old, new = nil, be_verbose_when_moving_existing_files = false, &block) ⇒ Object
(also: #rename_this_file, #rename_files, #rename_file, #rename, #move_file, #move)
# === mv (mv tag).
-
#n_days_in_this_month(i) ⇒ Object
# === n_days_in_this_month.
-
#n_pages_in_this_pdf_file?(i) ⇒ Boolean
# === n_pages_in_this_pdf_file? ========================================================================= #.
-
#namespace? ⇒ Boolean
# === namespace? ========================================================================= #.
-
#no_file_exists_at(i) ⇒ Object
(also: #no_file_at)
# === no_file_exists_at =========================================================================== #.
-
#olivedrab(i = '', use_colours = use_colours?) ) ⇒ Object
# === olivedrab ========================================================================= #.
-
#open_in_browser(this_URL, &block) ⇒ Object
# === open_in_browser ========================================================================= #.
-
#opne(i = '') ⇒ Object
# === opne ========================================================================= #.
-
#opnesystem(i = '') ⇒ Object
# === opnesystem ========================================================================= #.
-
#opnn(i = namespace?, , optional_extra_mode = nil, &block) ⇒ Object
# === opnn ========================================================================= #.
-
#orange(i = '', use_colours = @use_colours) ⇒ Object
# === orange ========================================================================= #.
-
#orchid(i = '', use_colours = use_colours? ) ⇒ Object
# === orchid ========================================================================= #.
-
#palegoldenrod(i = '', use_colours = use_colours?) ) ⇒ Object
# === palegoldenrod ========================================================================= #.
-
#palevioletred(i = '', use_colours = use_colours?) ) ⇒ Object
# === palevioletred ========================================================================= #.
-
#pink(i = '', use_colours = use_colours? ) ⇒ Object
# === pink ========================================================================= #.
-
#powderblue(i = '', use_colours = use_colours? ) ⇒ Object
# === powderblue ========================================================================= #.
-
#programs_dir? ⇒ Boolean
# === programs_dir?.
-
#project_base_dir? ⇒ Boolean
(also: #project_base_directory?)
# === project_base_dir? ========================================================================= #.
-
#random_html_colour ⇒ Object
# === random_html_colour ========================================================================= #.
-
#rds(i) ⇒ Object
# === rds ========================================================================= #.
-
#read_file_in_iso_encoding(this_file) ⇒ Object
# === read_file_in_iso_encoding.
-
#read_file_via_the_default_encoding(i, use_this_encoding = main_encoding? ) ⇒ Object
(also: #readlines_via_proper_encoding, #file_read_with_proper_encoding, #read_this_file, #default_read, #default_read_file, #default_readfile, #file_read, #read_file, #readfile)
# === read_file_via_the_default_encoding.
-
#read_lines_via_iso_encoding(i) ⇒ Object
# === read_lines_via_iso_encoding.
-
#readlines_with_main_encoding(this_file) ⇒ Object
(also: #default_readlines, #readlines_with_proper_encoding, #readlines_with_default_encoding, #readlines_with_the_proper_encoding, #proper_readlines)
# === readlines_with_main_encoding ======================================================================= #.
-
#red(i = '', use_colours = use_colours?) ) ⇒ Object
# === red ========================================================================= #.
-
#register_sigint(use_this_as_exit_code = 0) ⇒ Object
# === register_sigint ========================================================================= #.
-
#remove(i) ⇒ Object
# === remove (remove tag) ========================================================================= #.
-
#remove_directory(this_directory) ⇒ Object
# === remove_directory.
-
#remove_file(i, optional_be_verbose = false) ⇒ Object
(also: #delete, #delete_file, #delete_this_file, #remove_this_file, #remove_files)
# === remove_file (remove tag).
-
#rename_kde_konsole_tab(new_title = '', be_verbose = true) ⇒ Object
(also: #rename_konsole_tab)
# === rename_kde_konsole_tab ========================================================================= #.
-
#replace_localhost_with_data(i) ⇒ Object
# === replace_localhost_with_data.
-
#report_pwd ⇒ Object
(also: #show_pwd)
# === report_pwd ========================================================================= #.
-
#require_rescue(i = 'wget_wrapper') ⇒ Object
# === require_rescue ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#reset_the_internal_hash ⇒ Object
(also: #initialize_the_internal_hash)
# === reset_the_internal_hash ========================================================================= #.
-
#return_all_directories_from_this_directory(i = return_pwd) ⇒ Object
(also: #return_all_directories, #get_all_directories)
# === return_all_directories_from_this_directory.
-
#return_all_files_from_this_directory(i = return_pwd) ⇒ Object
(also: #obtain_all_files, #get_all_files, #return_all_files, #return_files)
# === return_all_files_from_this_directory.
-
#return_current_directory ⇒ Object
(also: #return_pwd, #get_pwd)
# === return_current_directory ========================================================================= #.
-
#return_dd_mm_yyyy(i = ::Time.now) ⇒ Object
(also: #dd_mm_yyyy, #today?, #return_date)
# === return_dd_mm_yyyy.
-
#return_file_or_directory_of(i) ⇒ Object
# === return_file_or_directory_of ========================================================================= #.
-
#return_files_from_pwd ⇒ Object
# === return_files_from_pwd ========================================================================= #.
-
#return_last_part_of_the_current_directory ⇒ Object
# === return_last_part_of_the_current_directory ========================================================================= #.
-
#return_utc ⇒ Object
# === return_utc.
-
#rev(use_colours = use_colours? ) ⇒ Object
# === rev (rev tag) ========================================================================= #.
-
#right_arrow? ⇒ Boolean
(also: #rarrow?)
# === right_arrow? ========================================================================= #.
-
#right_colour(i) ⇒ Object
# === right_colour ========================================================================= #.
-
#roebe_log_directory? ⇒ Boolean
# === roebe_log_directory?.
-
#rosybrown(i = '', use_colours = use_colours?) ) ⇒ Object
# === rosybrown ========================================================================= #.
-
#royalblue(i = '', use_colours = use_colours? ) ⇒ Object
# === royalblue ========================================================================= #.
-
#ruby_base_directory? ⇒ Boolean
# === ruby_base_directory? ========================================================================= #.
-
#run ⇒ Object
# === run ========================================================================= #.
-
#run_in_background(i) ⇒ Object
# === run_in_background ========================================================================= #.
-
#run_rcfiles_then_run_ata_via_qdbus ⇒ Object
# === run_rcfiles_then_run_ata_via_qdbus ========================================================================= #.
-
#sandybrown(i = '', use_colours = use_colours? ) ⇒ Object
# === sandybrown ========================================================================= #.
-
#sdir(i = '') ⇒ Object
# === sdir ========================================================================= #.
-
#seagreen(i = '', use_colours = use_colours? ) ⇒ Object
# === seagreen ========================================================================= #.
-
#set_be_verbose(i = true) ⇒ Object
(also: #be_verbose, #yes_be_verbose)
# === set_be_verbose ========================================================================= #.
-
#set_xorg_buffer(i) ⇒ Object
# === set_xorg_buffer ========================================================================= #.
-
#sfancy(i = '', use_colours = @use_colours) ⇒ Object
# === sfancy ========================================================================= #.
-
#sfile(i = '', use_colours = use_colours?) ) ⇒ Object
# === sfile ========================================================================= #.
-
#show_help ⇒ Object
# === show_help (help tag).
-
#silent_redirection? ⇒ Boolean
# === silent_redirection? ========================================================================= #.
-
#simp(i = '') ⇒ Object
# === simp ========================================================================= #.
-
#simple_esystem(i) ⇒ Object
# === simple_esystem.
-
#skyblue(i = '', use_colours = use_colours?) ) ⇒ Object
# === skyblue ========================================================================= #.
-
#slateblue(i = '', use_colours = use_colours? ) ⇒ Object
# === slateblue ========================================================================= #.
-
#slategray(i = '', use_colours = use_colours?) ) ⇒ Object
# === slategray ========================================================================= #.
-
#springgreen(i = '', use_colours = use_colours? ) ⇒ Object
# === springgreen ========================================================================= #.
-
#steelblue(i = '', use_colours = use_colours? ) ⇒ Object
# === steelblue ========================================================================= #.
-
#swarn(i = '', use_colours = @use_colours) ⇒ Object
# === swarn ========================================================================= #.
-
#symlink(old_target, new_target) ⇒ Object
(also: #symlink_this_to_that)
# === symlink.
-
#teal(i = '', use_colours = use_colours?) ) ⇒ Object
# === teal ========================================================================= #.
-
#temp_dir? ⇒ Boolean
# === temp_dir?.
-
#to_camelcase(i) ⇒ Object
# === to_camelcase ========================================================================= #.
-
#to_counted_hash(array) ⇒ Object
# === to_counted_hash.
-
#tomato(i = '', use_colours = use_colours?) ) ⇒ Object
# === tomato ========================================================================= #.
-
#touch(i, be_verbose = true) ⇒ Object
(also: #create_file)
# === touch (touch tag) ========================================================================= #.
-
#try_to_require_the_beautiful_url_gem ⇒ Object
(also: #try_to_require_the_beautiful_url_project)
# === try_to_require_the_beautiful_url_gem ========================================================================= #.
-
#try_to_require_the_html_template ⇒ Object
# === try_to_require_the_html_template ========================================================================= #.
-
#try_to_require_the_open_gem ⇒ Object
# === try_to_require_the_open_gem ========================================================================= #.
-
#try_to_require_the_program_information_gem ⇒ Object
(also: #try_to_require_program_information)
-
#try_to_require_the_xorg_buffer ⇒ Object
# === try_to_require_the_xorg_buffer ========================================================================= #.
-
#use_colours? ⇒ Boolean
# === use_colours? ========================================================================= #.
-
#verbose_truth(i) ⇒ Object
(also: #vb, #vt, #yes_no, #yes_or_no)
# === verbose_truth ========================================================================= #.
-
#weekday?(this_weekday_as_number = Date.today.wday) ⇒ Boolean
# === weekday? ========================================================================= #.
-
#word_wrap(text, line_width = 80) ⇒ Object
# === word_wrap ========================================================================= #.
-
#write_what_into(what, into, use_this_mode = 'w+') ⇒ Object
(also: #store_what_into, #save_what_into, #save_what_to)
# === write_what_into ========================================================================= #.
-
#yellow(i = '', use_colours = use_colours? ) ⇒ Object
(also: #yel)
# === yellow ========================================================================= #.
#append_onto_the_commandline_arguments, #clear_commandline_arguments, #commandline_arguments?, #commandline_arguments_as_string?, #commandline_arguments_without_leading_hyphens?, #first_argument?, #first_argument_without_leading_hyphens?, #has_an_argument_been_passed?, #remove_hyphened_arguments_from_the_commandline_arguments, #return_commandline_arguments_with_leading_hyphens, #second_argument?, #set_commandline_arguments
Constructor Details
#initialize(run_already = true) ⇒ Base
38
39
40
41
42
43
|
# File 'lib/roebe/base/prototype.rb', line 38
def initialize(
run_already = true
)
reset
run if run_already
end
|
Instance Method Details
#actions(i = nil, &block) ⇒ Object
Also known as:
action
#
actions (actions tag, action tag)
#
60
61
62
63
64
|
# File 'lib/roebe/base/misc.rb', line 60
def actions(
i = nil, &block
)
Roebe.actions(i, &block)
end
|
#append_this_onto_that_file(this, that_file) ⇒ Object
Also known as:
append_what_to_this_file
#
append_this_onto_that_file
#
#append_what_into(what, into) ⇒ Object
Also known as:
append_what_onto
176
177
178
|
# File 'lib/roebe/base/prototype.rb', line 176
def append_what_into(what, into)
Roebe.append_what_into(what, into)
end
|
#be_silent ⇒ Object
Also known as:
be_quiet, set_be_quiet, do_not_be_verbose
522
523
524
|
# File 'lib/roebe/base/prototype.rb', line 522
def be_silent
set_be_verbose(:be_silent)
end
|
#be_verbose? ⇒ Boolean
Also known as:
verbose?
515
516
517
|
# File 'lib/roebe/base/prototype.rb', line 515
def be_verbose?
@be_verbose
end
|
#beautiful_url(i) ⇒ Object
Also known as:
prettify_this_url, prettify_url, sanitize_url
14
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/roebe/base/support_for_beautiful_url.rb', line 14
def beautiful_url(i)
unless Object.const_defined? :BeautifulUrl
require 'beautiful_url/requires/failsafe_require_of_beautiful_url.rb'
end
_ = i.dup
_ = BeautifulUrl[_]
if _.is_a? Array
_ = _.first
end
_
end
|
#burlywood(i = '', use_colours = @use_colours) ⇒ Object
418
419
420
421
422
423
424
|
# File 'lib/roebe/base/colours.rb', line 418
def burlywood(
i = '',
use_colours = @use_colours
)
return COLOURS.burlywood(i) if use_colours
return i
end
|
#call_next(i = 'exams') ⇒ Object
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/roebe/base/next.rb', line 16
def call_next(i = 'exams')
case i
when 'exam',
'exams',
'exam?',
'default'
Studium::Exams::NextExam.new
end
end
|
#chdir(i) ⇒ Object
Also known as:
cd, cd_to_this_directory, change_directory
#
chdir
Change directory to the target given via this method. The input to this method should be a String representing a directory, such as “/tmp/”.
#
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
|
# File 'lib/roebe/base/chdir.rb', line 18
def chdir(i)
if i.is_a? Array
i = i.join(' ').strip
end
case i when :home_dir,
:home
i = rds(ENV['HOME'].to_s+'/')
when :ruby_src_dir
i = RUBY_SRC
when :log_directory
i = ::Roebe.log_directory?
end
Dir.chdir(i) if File.directory? i
end
|
#cheerful_guy ⇒ Object
Also known as:
cheering_person, return_cheering_person
#
cheerful_guy
This is a “cheerful guy”, in ASCII, which can be output on the commandline, indicating that some operation has run successfully.
#
274
275
276
|
# File 'lib/roebe/base/misc.rb', line 274
def cheerful_guy
"\\o/"
end
|
#cliner(use_this_token = '*') ⇒ Object
29
30
31
32
33
|
# File 'lib/roebe/base/misc.rb', line 29
def cliner(
use_this_token = '*'
)
::Cliner.cliner(use_this_token)
end
|
#complex_esystem(i, optional_colourize = true, default_colour = :steelblue, use_this_padding = ' ', &block) ⇒ Object
Also known as:
esystem, raw_esystem, esystem_colourized, esystem_colourize
#
complex_esystem
This method was written in June 2023 to work around a strange bug.
Since June 2023 the method will try to automatically colourize the given command.
#
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
|
# File 'lib/roebe/base/esystem.rb', line 34
def complex_esystem(
i,
optional_colourize = true,
default_colour = :steelblue,
use_this_padding = ' ',
&block
)
begin
require 'colours/autogenerated/html_colours_methods.rb'
rescue LoadError; end
case optional_colourize
when :do_colourize,
:colourize
optional_colourize = true
when :do_colourize_and_pad_the_system_command
optional_colourize = true
use_this_padding = ' ' end
if i.is_a? Array
i.each {|entry|
complex_esystem(
entry,
optional_colourize,
default_colour,
use_this_padding,
&block
)
}
else
i = i.dup if i.frozen?
i.strip! if i
real_cmd_to_use = i.dup
if block_given? yielded = block.call if yielded.is_a? Hash
if yielded.has_key? :colour
yielded = yielded.delete(:colour)
end
else case yielded
when :colourize_first_word_differently
if i.include?(' ')
splitted = i.split(' ')
first_word = lightblue(splitted.first)
i = first_word+' '+
::Colours::HtmlColoursMethods.send(
default_colour.to_sym,
splitted[1..-1].join(' ')
)
optional_colourize = false
end
when :do_colourize,
:colourize
optional_colourize = true
yielded = default_colour
end
end
end
i = i.to_s if i.is_a? Symbol
i = i.dup if i.frozen?
e
if real_cmd_to_use.include?('& 2>&1')
real_cmd_to_use.sub!(/& 2>&1/,'2>&1 &')
end
if optional_colourize
e "#{rev}#{use_this_padding}#{::Colours::HtmlColoursMethods.send(default_colour, i)}"
else
e "#{rev}#{use_this_padding}#{i}"
end
_result = `#{real_cmd_to_use}`
if _result.include?(': command not found')
e tomato("The command #{i} was not found.")+rev
return false
else
e _result return true
end
end
end
|
#convert_global_env(i) ⇒ Object
#
convert_global_env
This method requires that the “convert_global_env” project is available.
#
18
19
20
|
# File 'lib/roebe/base/env.rb', line 18
def convert_global_env(i)
return ConvertGlobalEnv[i]
end
|
#copy_directory(from, to = return_pwd) ⇒ Object
Also known as:
cpr
#
copy_directory
This method can be used to (recursively) copy a directory from one location to another. If remove_destination is true then FileUtils.copy_entry will remove each destination file before the copy-operation.
Documentation for FileUtils.copy_entry can be seen here:
https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html
https://ruby-doc.org/stdlib/libdoc/fileutils/rdoc/FileUtils.html
#
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/roebe/base/copy.rb', line 30
def copy_directory(
from, to = return_pwd )
case to
when :default, nil
to = return_pwd
end
remove_destination = true
FileUtils.copy_entry(
from, to, false, false, remove_destination )
end
|
#copy_file(from, to) ⇒ Object
Also known as:
cp, copy, copy_files
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/roebe/base/copy.rb', line 54
def copy_file(
from, to
)
if from.is_a? Array
from.each {|entry|
copy_file(entry, to)
}
else
if block_given?
::Roebe.copy_file(from, to) { yield }
else
::Roebe.copy_file(from, to)
end
end
end
|
#cornflowerblue(i = '', use_colours = use_colours?)
) ⇒ Object
142
143
144
145
|
# File 'lib/roebe/base/colours.rb', line 142
def cornflowerblue(i = '', use_colours = use_colours?)
return COLOURS.cornflowerblue(i) if use_colours
return i
end
|
#create_directory(i, be_verbose = false) ⇒ Object
131
132
133
134
135
136
137
138
139
|
# File 'lib/roebe/base/prototype.rb', line 131
def create_directory(
i,
be_verbose = false
)
if be_verbose
e "Creating the directory `#{sdir(i)}` next."
end
::Roebe.create_directory(i) end
|
#crimson(i = '', use_colours = use_colours?)
) ⇒ Object
246
247
248
249
|
# File 'lib/roebe/base/colours.rb', line 246
def crimson(i = '', use_colours = use_colours?)
return COLOURS.crimson(i) if use_colours
i
end
|
#current_month? ⇒ Boolean
#
current_month?
This method here will return the long name of the current month.
For instance, during August we will return the String ‘August’ here.
#
41
42
43
44
45
|
# File 'lib/roebe/base/time.rb', line 41
def current_month?
Date::MONTHNAMES[
get_current_month.to_s.to_i
].to_s
end
|
#current_time? ⇒ Boolean
Also known as:
return_time
#
current_time?
This method will return a String such as “16:35:03”.
#
81
82
83
|
# File 'lib/roebe/base/time.rb', line 81
def current_time?
::Time.now.strftime '%H:%M:%S'
end
|
#current_year? ⇒ Boolean
Also known as:
current_year, return_current_year
#
current_year?
This method will return a string, such as “2018” - thus denoting the current year.
#
22
23
24
|
# File 'lib/roebe/base/time.rb', line 22
def current_year?
::Time.now.strftime('%Y').dup
end
|
#cyan(i = '', use_colours = @use_colours) ⇒ Object
365
366
367
368
369
370
371
|
# File 'lib/roebe/base/colours.rb', line 365
def cyan(
i = '',
use_colours = @use_colours
)
return COLOURS.cyan(i) if use_colours
return i
end
|
#darkcyan(i = '', use_colours = use_colours?
) ⇒ Object
550
551
552
553
554
555
556
|
# File 'lib/roebe/base/colours.rb', line 550
def darkcyan(
i = '',
use_colours = use_colours?
)
return COLOURS.darkcyan(i) if use_colours
return i
end
|
#darkgreen(i = '', use_colours = use_colours?)
) ⇒ Object
238
239
240
241
|
# File 'lib/roebe/base/colours.rb', line 238
def darkgreen(i = '', use_colours = use_colours?)
return COLOURS.darkgreen(i) if use_colours
i
end
|
#darkkhaki(i = '', use_colours = use_colours?
) ⇒ Object
539
540
541
542
543
544
545
|
# File 'lib/roebe/base/colours.rb', line 539
def darkkhaki(
i = '',
use_colours = use_colours?
)
return COLOURS.darkkhaki(i) if use_colours
return i
end
|
#darkslateblue(i = '', use_colours = use_colours?)
) ⇒ Object
190
191
192
193
|
# File 'lib/roebe/base/colours.rb', line 190
def darkslateblue(i = '', use_colours = use_colours?)
return COLOURS.darkslateblue(i) if use_colours
return i
end
|
#deeppink(i = '', use_colours = @use_colours) ⇒ Object
429
430
431
432
433
434
435
|
# File 'lib/roebe/base/colours.rb', line 429
def deeppink(
i = '',
use_colours = @use_colours
)
return COLOURS.deeppink(i) if use_colours
return i
end
|
#delete_symlink(i) ⇒ Object
#
delete_symlink
This method can be used to remove symlinks.
#
23
24
25
26
27
|
# File 'lib/roebe/base/symlink.rb', line 23
def delete_symlink(i)
if File.symlink? i
delete_this_file(i)
end
end
|
#do_not_use_the_base_colours ⇒ Object
Also known as:
do_not_use_colours, disable_colours
67
68
69
|
# File 'lib/roebe/base/colours.rb', line 67
def do_not_use_the_base_colours
@use_colours = false
end
|
#do_use_the_base_colours ⇒ Object
Also known as:
enable_colours, do_use_colours
#
do_use_the_base_colours
The reason for this long, cumbersome name is so that we can always tap into this method, even if a downstream class overrides the “enable_colours()” and “do_use_colours()” method - which is the case for class Roebe::Shell, for instance.
#
59
60
61
|
# File 'lib/roebe/base/colours.rb', line 59
def do_use_the_base_colours
@use_colours = true
end
|
#e(i = '') ⇒ Object
Also known as:
br
#
e (e tag)
Note that the alias br() to e() is experimental, as of October 2023.
#
421
422
423
|
# File 'lib/roebe/base/prototype.rb', line 421
def e(i = '')
puts i
end
|
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
|
# File 'lib/roebe/base/colours.rb', line 619
def (
i,
use_colours = use_colours?
)
if i.is_a? Array
(i, use_colours)
else if use_colours
if i.include? '#'
splitted = i.split('#')
e "#{rev}"\
"#{limegreen(splitted[0])}"\
"#{orange('#')}"\
"#{mediumpurple(splitted[1])}"
else
e i
end
else
e i
end
end
end
|
#editor_to_use? ⇒ Boolean
Also known as:
main_editor?
14
15
16
|
# File 'lib/roebe/base/editor.rb', line 14
def editor_to_use?
Roebe.editor?
end
|
#efancy(i = '', use_colours = @use_colours) ⇒ Object
376
377
378
379
380
381
|
# File 'lib/roebe/base/colours.rb', line 376
def efancy(
i = '',
use_colours = @use_colours
)
e sfancy(i, use_colours)
end
|
#eimp(i = '') ⇒ Object
21
22
23
|
# File 'lib/roebe/base/simp.rb', line 21
def eimp(i = '')
e simp(i)
end
|
#emphasis(i) ⇒ Object
645
646
647
|
# File 'lib/roebe/base/colours.rb', line 645
def emphasis(i)
lightgreen(i)
end
|
#ensure_main_encoding(i) ⇒ Object
#
ensure_main_encoding
This currently defaults to the ISO-8859-1 encoding.
#
#ensure_utf_encoding(i) ⇒ Object
#
ensure_utf_encoding
Ensure UTF/Unicode encoding of Strings through this method here.
#
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/roebe/base/encoding.rb', line 30
def ensure_utf_encoding(i)
if i.is_a? String
i = i.dup if i.frozen?
i = i.force_encoding(::Roebe::Encoding::ENCODING_UTF)
end
i
end
|
#eparse(i = '', use_colours = use_colours?
) ⇒ Object
304
305
306
307
308
309
310
311
312
313
|
# File 'lib/roebe/base/colours.rb', line 304
def eparse(
i = '',
use_colours = use_colours?
)
if use_colours
COLOURS.eparse(i)
else
e i
end
end
|
#erev(i = '') ⇒ Object
612
613
614
|
# File 'lib/roebe/base/colours.rb', line 612
def erev(i = '')
e "#{rev}#{i}"
end
|
#esteelblue(i) ⇒ Object
330
331
332
|
# File 'lib/roebe/base/colours.rb', line 330
def esteelblue(i)
e steelblue(i)
end
|
#etomato(i = '', use_colours = use_colours?)
) ⇒ Object
127
128
129
|
# File 'lib/roebe/base/colours.rb', line 127
def etomato(i = '', use_colours = use_colours?)
e tomato(i, use_colours)
end
|
#ewarn(i = '') ⇒ Object
344
345
346
|
# File 'lib/roebe/base/colours.rb', line 344
def ewarn(i = '')
e swarn(i)
end
|
#firebrick(i = '', use_colours = @use_colours) ⇒ Object
407
408
409
410
411
412
413
|
# File 'lib/roebe/base/colours.rb', line 407
def firebrick(
i = '',
use_colours = @use_colours
)
return COLOURS.firebrick(i) if use_colours
return i
end
|
#get_current_day ⇒ Object
Also known as:
current_day?
#
get_current_day
This method will return a number from 1 to 31, representing the current time.
#
53
54
55
|
# File 'lib/roebe/base/time.rb', line 53
def get_current_day
::Time.now.strftime('%d').to_i
end
|
#get_current_month ⇒ Object
Also known as:
current_month_as_number?
#get_files_and_directories(i) ⇒ Object
#
get_files_and_directories
#
275
276
277
278
279
280
|
# File 'lib/roebe/base/prototype.rb', line 275
def get_files_and_directories(i)
i = rds(i.dup)
Dir[i].select {|entry|
File.file?(entry) or File.directory?(entry)
}.flatten.compact
end
|
#get_files_from(i = return_pwd, additional_modifiers = nil, &block) ⇒ Object
Also known as:
get_all_files_from, get_files
#
get_files_from
This method will return all files from the current directory.
#
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
# File 'lib/roebe/base/prototype.rb', line 287
def get_files_from(
i = return_pwd,
additional_modifiers = nil,
&block
)
yielded = nil
if block_given?
yielded = yield
additional_modifiers = yielded end
case i
when :songs_directory
i = '/home/x/songs/*'
end
if additional_modifiers.is_a? Hash
if additional_modifiers.has_key?(:include_directories) and
(additional_modifiers[:include_directories] == true)
i = rds("#{i}/*")
else
i = rds("#{i}/*")
end
else
case additional_modifiers
when :ignore_subdirectories
i = rds("#{i}/*")
else i = rds("#{i}/**")
end
end
all_results = Dir[i]
result = all_results.select {|entry| File.file? entry }
return result
end
|
#get_german_name_for_this_weekday(i) ⇒ Object
Also known as:
return_german_name_for_this_weekday
#
get_german_name_for_this_weekday
#
#gold(i = '', use_colours = use_colours?
) ⇒ Object
108
109
110
111
112
113
114
|
# File 'lib/roebe/base/colours.rb', line 108
def gold(
i = '',
use_colours = use_colours?
)
return COLOURS.gold(i) if use_colours
return i
end
|
#green(i = '', use_colours = use_colours?
) ⇒ Object
601
602
603
604
605
606
607
|
# File 'lib/roebe/base/colours.rb', line 601
def green(
i = '',
use_colours = use_colours?
)
return COLOURS.green(i) if use_colours
return i
end
|
#grey(i = '', use_colours = use_colours?
) ⇒ Object
Also known as:
grey?
169
170
171
172
173
174
175
|
# File 'lib/roebe/base/colours.rb', line 169
def grey(
i = '',
use_colours = use_colours?
)
return COLOURS.grey(i) if COLOURS and COLOURS.respond_to?(:grey) and use_colours
return i
end
|
#hh_mm_ss(i = ::Time.now) ⇒ Object
Also known as:
ss_mm_hh
#
hh_mm_ss
This will display the current time in hours:minutes:seconds.
There is also an alias for this, called ss_mm_hh, but that variant is wrong as name. Still, since my brain isn’t the best, I will retain that “wrong” alias as well.
#
#hh_mm_ss_day_month_year(i) ⇒ Object
#
hh_mm_ss_day_month_year
This method expects a time-object as its input.
#
171
172
173
|
# File 'lib/roebe/base/time.rb', line 171
def hh_mm_ss_day_month_year(i)
hh_mm_ss(i).to_s+' '+dd_mm_yyyy(i).to_s
end
|
#home_dir?(i = ENV['HOME']) ⇒ Boolean
#
home_dir?
Just return the value of the environment HOME, for the home directory.
#
102
103
104
|
# File 'lib/roebe/base/misc.rb', line 102
def home_dir?(i = ENV['HOME'])
"#{i}/".squeeze('/')
end
|
#home_directory_of_user_x? ⇒ Boolean
Also known as:
home_dir_of_user_x?
#
home_directory_of_user_x?
#
23
24
25
|
# File 'lib/roebe/base/home_directory_of_user_x.rb', line 23
def home_directory_of_user_x?
HOME_DIRECTORY_OF_USER_X
end
|
#infer_the_namespace ⇒ Object
#
infer_the_namespace
This will assume the true namespace from the inspectable name.
#
317
318
319
320
321
322
323
324
325
326
327
328
329
330
|
# File 'lib/roebe/base/misc.rb', line 317
def infer_the_namespace
_ = inspect
if _.include?(':0x')
_ = _.split(':0x').first.to_s.strip
end
_ = _.to_s.delete('<')
if _.include? ' '
_ = _.split(' ').first.delete('#')
if _.include? ':'
_ = _.split(':')[0 .. -2].reject {|entry| entry.empty? }.join('::')
end
end
@namespace = _.delete('#') end
|
#internal_hash? ⇒ Boolean
Also known as:
ihash?
308
309
310
|
# File 'lib/roebe/base/misc.rb', line 308
def internal_hash?
@internal_hash
end
|
#is_a_directory?(i) ⇒ Boolean
511
512
513
|
# File 'lib/roebe/base/misc.rb', line 511
def is_a_directory?(i)
i and File.directory?(i)
end
|
#is_a_file?(i) ⇒ Boolean
504
505
506
|
# File 'lib/roebe/base/misc.rb', line 504
def is_a_file?(i)
i and File.file?(i)
end
|
#is_a_jpg_file?(i) ⇒ Boolean
232
233
234
|
# File 'lib/roebe/base/misc.rb', line 232
def is_a_jpg_file?(i)
File.extname(i).delete('.') == 'jpg'
end
|
#is_an_image_file?(i) ⇒ Boolean
Also known as:
is_image_file?, is_an_image?
70
71
72
|
# File 'lib/roebe/base/misc.rb', line 70
def is_an_image_file?(i)
::Roebe.is_image_file?(i)
end
|
#is_archive?(i) ⇒ Boolean
#
is_archive?
Determine whether the given input is an archive or whether it is not.
#
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
|
# File 'lib/roebe/base/misc.rb', line 250
def is_archive?(i)
return_value = false
if i.include? '/'
i = File.basename(i)
end
case i
when /\.xz$/,
/\.tar$/,
/\.zip$/,
/\.tar.gz$/,
/\.tar.bz2gz$/,
/\.tar.xz$/,
/\.gem$/
return_value = true
end
return return_value
end
|
#is_audio_file?(i) ⇒ Boolean
#
is_audio_file?
This query-method can be used to determine whether the given argument (assumed to be a file) is an audio file or whether it is not. File extensions such as .mp3, .ogg or .wav are simply assumed to be audio files, as far as this method here is concerned.
Usage example:
"abc.wav".is_audio_file?
#
480
481
482
483
484
485
486
487
488
|
# File 'lib/roebe/base/misc.rb', line 480
def is_audio_file?(i)
extension_name = File.extname(i).delete('.').downcase
%w(
mp3
ogg
wav
m4a
).include? extension_name
end
|
#is_in_studium_dir? ⇒ Boolean
475
476
477
|
# File 'lib/roebe/base/prototype.rb', line 475
def is_in_studium_dir?
return_pwd.include?(home_directory_of_user_x?+'studium')
end
|
493
494
495
496
497
498
499
|
# File 'lib/roebe/base/misc.rb', line 493
def is_multimedia_file?(i) if is_audio_file?(i) or is_video_file?(i)
return true
else
return false
end
end
|
#is_on_roebe? ⇒ Boolean
Also known as:
on_roebe?, is_roebe?
#
is_on_roebe?
Whether I am at home or whether I am not.
#
#is_on_windows? ⇒ Boolean
Also known as:
on_windows?, are_we_on_windows?
#
is_on_windows?
Use this to check if you are on windows or not.
#
284
285
286
287
288
289
290
291
|
# File 'lib/roebe/base/misc.rb', line 284
def is_on_windows?
case RUBY_PLATFORM
when /win/,/mingw/
true
else
false
end
end
|
#is_studium_available? ⇒ Boolean
#
is_studium_available?
Method to query whether the studium gem is available or whether it is not.
#
345
346
347
|
# File 'lib/roebe/base/misc.rb', line 345
def is_studium_available?
Object.const_defined?(:Studium)
end
|
#is_symlink?(i) ⇒ Boolean
14
15
16
|
# File 'lib/roebe/base/symlink.rb', line 14
def is_symlink?(i)
File.symlink?(i)
end
|
#is_this_a_ruby_file?(this_file) ⇒ Boolean
Also known as:
is_this_file_a_ruby_file?
#
is_this_a_ruby_file?
This query method can be used to determine whether xyz is a ruby-file or whether it is not.
#
88
89
90
91
92
93
94
95
|
# File 'lib/roebe/base/misc.rb', line 88
def is_this_a_ruby_file?(this_file)
_ = false first_line = File.open(this_file) {|f| f.readline }
if first_line.include? 'bin/ruby' _ = true
end
return _
end
|
#is_video_file?(i) ⇒ Boolean
457
458
459
460
461
462
463
464
|
# File 'lib/roebe/base/misc.rb', line 457
def is_video_file?(i)
extension_name = File.extname(i).delete('.').downcase
%w(
avi
mp4
ogm
).include? extension_name
end
|
#iso_encoding? ⇒ Boolean
Also known as:
encoding?
#le(i = '') ⇒ Object
#
le
This is basically echo/puts, but with two ‘ ’ on the left side.
#
151
152
153
|
# File 'lib/roebe/base/misc.rb', line 151
def le(i = '')
e " #{i}"
end
|
#left_colour(i) ⇒ Object
#
left_colour
This method is typically used to colourize the part on the “left” side of a longer string, on the commandline. I did not want to keep using hardcoded colour-method names, which explains why this method was added at 20.10.2019.
#
323
324
325
|
# File 'lib/roebe/base/colours.rb', line 323
def left_colour(i)
steelblue(i)
end
|
#lightblue(i = '', use_colours = use_colours?
) ⇒ Object
451
452
453
454
455
456
457
|
# File 'lib/roebe/base/colours.rb', line 451
def lightblue(
i = '',
use_colours = use_colours?
)
return COLOURS.lightblue(i) if use_colours
return i
end
|
#lightgreen(i = '') ⇒ Object
572
573
574
575
|
# File 'lib/roebe/base/colours.rb', line 572
def lightgreen(i = '')
return COLOURS.lightgreen(i) if @use_colours
return i
end
|
#lightseagreen(i = '', use_colours = use_colours?
) ⇒ Object
580
581
582
583
584
585
|
# File 'lib/roebe/base/colours.rb', line 580
def lightseagreen(
i = '', use_colours = use_colours?
)
return COLOURS.lightseagreen(i) if use_colours
return i
end
|
#lightsteelblue(i = '', use_colours = use_colours?
) ⇒ Object
473
474
475
476
477
478
479
|
# File 'lib/roebe/base/colours.rb', line 473
def lightsteelblue(
i = '',
use_colours = use_colours?
)
return COLOURS.lightsteelblue(i) if use_colours
return i
end
|
#lime(i = '', use_colours = use_colours?)
) ⇒ Object
198
199
200
201
|
# File 'lib/roebe/base/colours.rb', line 198
def lime(i = '', use_colours = use_colours?)
return COLOURS.lime(i) if use_colours
return i
end
|
#limegreen(i = '', use_colours = use_colours?
) ⇒ Object
590
591
592
593
594
595
596
|
# File 'lib/roebe/base/colours.rb', line 590
def limegreen(
i = '',
use_colours = use_colours?
)
return COLOURS.limegreen(i) if use_colours
return i
end
|
#localhost_to_data(i) ⇒ Object
124
125
126
127
128
129
130
131
132
|
# File 'lib/roebe/base/misc.rb', line 124
def localhost_to_data(i)
if i.include? 'localhost'
i.sub!(
/^http:\/\/localhost\//,
'/home/x/'
)
end
return i
end
|
#log_directory? ⇒ Boolean
Also known as:
log_dir?
#
log_directory?
This method wraps over the toplevel method Roebe.log_directory?().
#
#main_encoding? ⇒ Boolean
14
15
16
|
# File 'lib/roebe/base/encoding.rb', line 14
def main_encoding?
::Roebe::Encoding::MAIN_ENCODING_TO_USE
end
|
#mediumorchid(i = '', use_colours = use_colours?)
) ⇒ Object
270
271
272
273
|
# File 'lib/roebe/base/colours.rb', line 270
def mediumorchid(i = '', use_colours = use_colours?)
return COLOURS.mediumorchid(i) if use_colours
return i
end
|
#mediumpurple(i = '', use_colours = use_colours?
) ⇒ Object
528
529
530
531
532
533
534
|
# File 'lib/roebe/base/colours.rb', line 528
def mediumpurple(
i = '',
use_colours = use_colours?
)
return COLOURS.mediumpurple(i) if use_colours
return i
end
|
#mediumseagreen(i = '', use_colours = use_colours?
) ⇒ Object
484
485
486
487
488
489
490
|
# File 'lib/roebe/base/colours.rb', line 484
def mediumseagreen(
i = '',
use_colours = use_colours?
)
return COLOURS.mediumseagreen(i) if use_colours
return i
end
|
#mediumslateblue(i = '', use_colours = use_colours?
) ⇒ Object
663
664
665
666
667
668
669
|
# File 'lib/roebe/base/colours.rb', line 663
def mediumslateblue(
i = '',
use_colours = use_colours?
)
return COLOURS.mediumslateblue(i) if use_colours
return i
end
|
#mediumspringgreen(i = '', use_colours = use_colours?
) ⇒ Object
561
562
563
564
565
566
567
|
# File 'lib/roebe/base/colours.rb', line 561
def mediumspringgreen(
i = '',
use_colours = use_colours?
)
return COLOURS.mediumspringgreen(i) if use_colours
return i
end
|
#mediumturquoise(i = '', use_colours = use_colours?)
) ⇒ Object
150
151
152
153
|
# File 'lib/roebe/base/colours.rb', line 150
def mediumturquoise(i = '', use_colours = use_colours?)
return COLOURS.mediumturquoise(i) if use_colours
return i
end
|
#mkdir_p(i, &block) ⇒ Object
Also known as:
mkdir
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
# File 'lib/roebe/base/prototype.rb', line 352
def mkdir_p(
i, &block
)
unless File.exist? i
if block_given?
yielded = yield
case yielded
when :be_verbose
e "Creating the directory #{sdir(i)} next."
end
end
FileUtils.mkdir_p(i)
end
end
|
#mv(old, new = nil, be_verbose_when_moving_existing_files = false, &block) ⇒ Object
Also known as:
rename_this_file, rename_files, rename_file, rename, move_file, move
#
mv (mv tag)
The first input argument is denoting the old file.
The second input argument is the new name of that old file.
#
216
217
218
219
220
221
222
223
224
225
226
227
228
229
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
|
# File 'lib/roebe/base/prototype.rb', line 216
def mv(
old,
new = nil,
be_verbose_when_moving_existing_files = false,
&block
)
if block_given?
yielded = yield
case yielded
when :be_verbose
be_verbose_when_moving_existing_files = true
end
end
case be_verbose_when_moving_existing_files
when :be_verbose
be_verbose_when_moving_existing_files = true
end
if old.is_a? Hash
if old.has_key? :new_name
new = old.delete(:new_name)
end
if old.is_a?(Hash) and old.has_key? :old_name
old = old.delete(:old_name)
end
end
if File.exist? old
if be_verbose_when_moving_existing_files
e "Now renaming from `#{sfile(old)}` to `#{sfile(new)}`."
end
FileUtils.mv(old, new)
else
e "No file called #{sfile(old)} appears to exist."
end
end
|
#n_days_in_this_month(i) ⇒ Object
#
n_days_in_this_month
This method will return how many days are in a given month.
The method will currently not handle leap years though. Thus, february is a failed month.
#
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/roebe/base/time.rb', line 93
def n_days_in_this_month(i)
case i.to_i
when 1
31
when 2
28
when 3
31
when 4
30
when 5
31
when 6
30
when 7
31
when 8
31
when 9
30
when 10
31
when 11
30
when 12
31
end
end
|
#n_pages_in_this_pdf_file?(i) ⇒ Boolean
#
n_pages_in_this_pdf_file?
#
387
388
389
390
391
392
|
# File 'lib/roebe/base/misc.rb', line 387
def n_pages_in_this_pdf_file?(i)
begin
require 'pdf_paradise/utility_scripts/pdf_file_n_total_pages.rb'
rescue LoadError; end
::PdfParadise.n_pages_in_this_pdf_file?(i)
end
|
#namespace? ⇒ Boolean
335
336
337
|
# File 'lib/roebe/base/misc.rb', line 335
def namespace?
@namespace
end
|
#no_file_exists_at(i) ⇒ Object
Also known as:
no_file_at
217
218
219
|
# File 'lib/roebe/base/misc.rb', line 217
def no_file_exists_at(i)
e "#{rev}No file exists at `#{sfile(i)}`."
end
|
#olivedrab(i = '', use_colours = use_colours?)
) ⇒ Object
206
207
208
209
|
# File 'lib/roebe/base/colours.rb', line 206
def olivedrab(i = '', use_colours = use_colours?)
return COLOURS.olivedrab(i) if use_colours
i
end
|
#open_in_browser(this_URL, &block) ⇒ Object
421
422
423
424
425
426
|
# File 'lib/roebe/base/misc.rb', line 421
def open_in_browser(
this_URL, &block
)
require 'open' unless Object.const_defined?(:Open)
Open.in_browser(this_URL, &block)
end
|
#opne(i = '') ⇒ Object
51
52
53
|
# File 'lib/roebe/base/opnn.rb', line 51
def opne(i = '')
opnn; e i
end
|
#opnesystem(i = '') ⇒ Object
58
59
60
61
62
63
|
# File 'lib/roebe/base/opnn.rb', line 58
def opnesystem(
i = ''
)
opne(i)
system(i)
end
|
#opnn(i = namespace?,
, optional_extra_mode = nil, &block) ⇒ Object
14
15
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
|
# File 'lib/roebe/base/opnn.rb', line 14
def opnn(
i = namespace?,
= nil,
&block
)
case i
when :default
i = namespace?
end
i = { namespace: i } if i.is_a? String
if i.is_a? Hash
i.update(use_colours: use_colours?)
end
if block_given?
yielded = yield
case yielded
when :no_trailing
i.update(trailing_token: false)
end
end
if Object.const_defined? :Opn
Opn.opn(i) { }
end
end
|
#orange(i = '', use_colours = @use_colours) ⇒ Object
97
98
99
100
101
102
103
|
# File 'lib/roebe/base/colours.rb', line 97
def orange(
i = '',
use_colours = @use_colours
)
return COLOURS.orange(i) if use_colours
return i
end
|
#orchid(i = '', use_colours = use_colours?
) ⇒ Object
517
518
519
520
521
522
523
|
# File 'lib/roebe/base/colours.rb', line 517
def orchid(
i = '',
use_colours = use_colours?
)
return COLOURS.orchid(i) if use_colours
return i
end
|
#palegoldenrod(i = '', use_colours = use_colours?)
) ⇒ Object
222
223
224
225
|
# File 'lib/roebe/base/colours.rb', line 222
def palegoldenrod(i = '', use_colours = use_colours?)
return COLOURS.palegoldenrod(i) if use_colours
i
end
|
#palevioletred(i = '', use_colours = use_colours?)
) ⇒ Object
278
279
280
281
|
# File 'lib/roebe/base/colours.rb', line 278
def palevioletred(i = '', use_colours = use_colours?)
return COLOURS.palevioletred(i) if use_colours
return i
end
|
#pink(i = '', use_colours = use_colours?
) ⇒ Object
462
463
464
465
466
467
468
|
# File 'lib/roebe/base/colours.rb', line 462
def pink(
i = '',
use_colours = use_colours?
)
return COLOURS.pink(i) if use_colours
return i
end
|
#powderblue(i = '', use_colours = use_colours?
) ⇒ Object
75
76
77
78
79
80
81
|
# File 'lib/roebe/base/colours.rb', line 75
def powderblue(
i = '',
use_colours = use_colours?
)
return COLOURS.powderblue(i) if use_colours
return i
end
|
#programs_dir? ⇒ Boolean
#
programs_dir?
This method will only work (and is useful) for RBT-specific support.
#
139
140
141
142
143
144
|
# File 'lib/roebe/base/misc.rb', line 139
def programs_dir?
unless Object.const_defined?(:RBT) and RBT.respond_to?(:programs_dir?)
require 'rbt/toplevel_methods/files_and_directories_related_methods.rb'
RBT.programs_dir?
end
end
|
#project_base_dir? ⇒ Boolean
Also known as:
project_base_directory?
#random_html_colour ⇒ Object
400
401
402
|
# File 'lib/roebe/base/colours.rb', line 400
def random_html_colour
Colours.random_html_colour
end
|
108
109
110
111
112
113
114
|
# File 'lib/roebe/base/prototype.rb', line 108
def rds(i)
if i.is_a? Array
i.map {|entry| rds(entry) }
else
i.squeeze('/')
end
end
|
#read_file_in_iso_encoding(this_file) ⇒ Object
#
read_file_in_iso_encoding
This method will read in a file in the ISO encoding.
You have to check whether the file exists on your own, prior to calling this method.
#
446
447
448
449
450
|
# File 'lib/roebe/base/prototype.rb', line 446
def read_file_in_iso_encoding(
this_file
)
File.read(this_file, encoding: 'iso8859-1')
end
|
#read_file_via_the_default_encoding(i, use_this_encoding = main_encoding?
) ⇒ Object
Also known as:
readlines_via_proper_encoding, file_read_with_proper_encoding, read_this_file, default_read, default_read_file, default_readfile, file_read, read_file, readfile
#
read_file_via_the_default_encoding
This method should be preferentially used whenever file content is to be read in.
#
458
459
460
461
462
|
# File 'lib/roebe/base/prototype.rb', line 458
def read_file_via_the_default_encoding(
i, use_this_encoding = main_encoding?
)
File.read(i, encoding: use_this_encoding)
end
|
#read_lines_via_iso_encoding(i) ⇒ Object
#
read_lines_via_iso_encoding
This method will always use ISO encoding, as per its name suggested.
#
185
186
187
|
# File 'lib/roebe/base/prototype.rb', line 185
def read_lines_via_iso_encoding(i)
File.readlines(i, encoding: ENCODING_ISO)
end
|
#readlines_with_main_encoding(this_file) ⇒ Object
Also known as:
default_readlines, readlines_with_proper_encoding, readlines_with_default_encoding, readlines_with_the_proper_encoding, proper_readlines
#
readlines_with_main_encoding
#
339
340
341
342
343
|
# File 'lib/roebe/base/prototype.rb', line 339
def readlines_with_main_encoding(
this_file
)
File.readlines(this_file, encoding: main_encoding?)
end
|
#red(i = '', use_colours = use_colours?)
) ⇒ Object
262
263
264
265
|
# File 'lib/roebe/base/colours.rb', line 262
def red(i = '', use_colours = use_colours?)
return COLOURS.red(i) if use_colours
i
end
|
#register_sigint(use_this_as_exit_code = 0) ⇒ Object
96
97
98
99
100
101
102
103
|
# File 'lib/roebe/base/prototype.rb', line 96
def register_sigint(
use_this_as_exit_code = 0
)
Roebe.register_sigint {{
use_this_as_exit_code: use_this_as_exit_code,
invoke_this_method: :exit
}}
end
|
#remove(i) ⇒ Object
119
120
121
122
123
124
125
|
# File 'lib/roebe/base/prototype.rb', line 119
def remove(i)
if File.file? i
remove_file(i)
else remove_directory(i)
end
end
|
#remove_directory(this_directory) ⇒ Object
#
remove_directory
Use this method if you wish to remove a directory. We will never remove the directory ‘/’ though.
#
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# File 'lib/roebe/base/prototype.rb', line 58
def remove_directory(
this_directory
)
if this_directory.frozen?
this_directory = this_directory.dup
end
this_directory.squeeze!('/')
unless this_directory == '/'
FileUtils.rm_rf(this_directory)
end
end
|
#remove_file(i, optional_be_verbose = false) ⇒ Object
Also known as:
delete, delete_file, delete_this_file, remove_this_file, remove_files
#
remove_file (remove tag)
Use this method if you wish to delete a (local) file.
#
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
# File 'lib/roebe/base/prototype.rb', line 146
def remove_file(
i,
optional_be_verbose = false
)
if i.is_a? Array
i.each {|entry| remove_file(entry, optional_be_verbose) }
else
case optional_be_verbose
when :be_verbose
optional_be_verbose = true
end
if File.exist? i
if optional_be_verbose
e "Removing the file `#{sfile(i)}`."
end
File.delete(i)
end
end
end
|
#rename_kde_konsole_tab(new_title = '', be_verbose = true) ⇒ Object
Also known as:
rename_konsole_tab
#
rename_kde_konsole_tab
#
192
193
194
195
196
197
198
199
200
201
202
203
204
205
|
# File 'lib/roebe/base/misc.rb', line 192
def rename_kde_konsole_tab(
new_title = '',
be_verbose = true
)
case be_verbose
when :be_quiet,
:be_silent
be_verbose = false
end
::Roebe.rename_konsole(new_title, be_verbose)
end
|
#replace_localhost_with_data(i) ⇒ Object
#
replace_localhost_with_data
This method may replace a String such as “localhost/data/SCIENCE/STRATEGEME.cgi” into the variant without “localhost”, such as “/home/x/data/SCIENCE/STRATEGEME.cgi”.
#
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
|
# File 'lib/roebe/base/misc.rb', line 163
def replace_localhost_with_data(i)
i = i.to_s.dup
i.sub!(/^http:\/\//,'') if i.start_with? 'http:'
my_data = ENV['MY_DATA'].to_s.dup
programming = '/home/x/programming/'
if i.include?('/data') and my_data.end_with?('data')
my_data.sub!(/\/data$/, '')
end
if i.include? 'localhost'
if i.start_with? 'localhost/studium/'
i.sub!(/^localhost\/studium\//, "#{HOME_DIRECTORY_OF_USER_X}studium/")
elsif i.include? 'localhost/programming'
i.gsub!(/localhost\/programming/, programming)
else
i.gsub!(/localhost/, my_data)
end
end
return i
end
|
#report_pwd ⇒ Object
Also known as:
show_pwd
#require_rescue(i = 'wget_wrapper') ⇒ Object
38
39
40
41
42
43
44
|
# File 'lib/roebe/base/misc.rb', line 38
def require_rescue(
i = 'wget_wrapper'
)
begin
require 'i'
rescue LoadError; end
end
|
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
|
# File 'lib/roebe/base/reset.rb', line 26
def reset
@internal_hash = {}
@namespace = NAMESPACE
@be_verbose = true
@use_colours = ::Roebe.use_colours?
@commandline_arguments = []
end
|
#reset_the_internal_hash ⇒ Object
Also known as:
initialize_the_internal_hash
#
reset_the_internal_hash
#
16
17
18
19
20
21
|
# File 'lib/roebe/base/reset.rb', line 16
def reset_the_internal_hash
@internal_hash = {}
end
|
#return_all_directories_from_this_directory(i = return_pwd) ⇒ Object
Also known as:
return_all_directories, get_all_directories
#
return_all_directories_from_this_directory
This method will return all (sub)directories from the given input directory at hand.
Pass a directory into this method, such as ‘/tmp/’.
#
197
198
199
200
201
202
203
204
205
206
|
# File 'lib/roebe/base/prototype.rb', line 197
def return_all_directories_from_this_directory(
i = return_pwd
)
target = rds("#{i}/")
Dir["#{target}*"].select {|entry|
File.directory?(entry)
}.flatten.map {|line|
rds("#{line}/")
}
end
|
#return_all_files_from_this_directory(i = return_pwd) ⇒ Object
Also known as:
obtain_all_files, get_all_files, return_all_files, return_files
#
return_all_files_from_this_directory
This method can be used to obtain all files from the given (input) directory at hand.
#
404
405
406
407
408
409
410
411
|
# File 'lib/roebe/base/prototype.rb', line 404
def return_all_files_from_this_directory(
i = return_pwd
)
target = rds("#{i}/")
Dir["#{target}*"].select {|entry|
File.file?(entry)
}.flatten
end
|
#return_current_directory ⇒ Object
Also known as:
return_pwd, get_pwd
#
return_current_directory
#
489
490
491
|
# File 'lib/roebe/base/prototype.rb', line 489
def return_current_directory
rds("#{Dir.pwd}/")
end
|
#return_dd_mm_yyyy(i = ::Time.now) ⇒ Object
Also known as:
dd_mm_yyyy, today?, return_date
#
return_dd_mm_yyyy
This helper method will return something like:
"03.06.2020"
In other words:
dd.mm.yyyy
#
160
161
162
|
# File 'lib/roebe/base/time.rb', line 160
def return_dd_mm_yyyy(i = ::Time.now)
i.strftime '%d.%m.%Y' end
|
#return_file_or_directory_of(i) ⇒ Object
#
return_file_or_directory_of
#
83
84
85
86
87
88
89
90
91
|
# File 'lib/roebe/base/prototype.rb', line 83
def return_file_or_directory_of(i)
_ = ''.dup
ftype = File.ftype(i)
case ftype
when 'directory','file'
_ << ftype.dup
end
return _
end
|
#return_files_from_pwd ⇒ Object
#
return_files_from_pwd
#
268
269
270
|
# File 'lib/roebe/base/prototype.rb', line 268
def return_files_from_pwd
get_files_from(return_pwd)
end
|
#return_last_part_of_the_current_directory ⇒ Object
#
return_last_part_of_the_current_directory
#
76
77
78
|
# File 'lib/roebe/base/prototype.rb', line 76
def return_last_part_of_the_current_directory
File.basename(return_current_directory)
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”.
#
72
73
74
|
# File 'lib/roebe/base/time.rb', line 72
def return_utc
::Time.now.getutc
end
|
#rev(use_colours = use_colours?
) ⇒ Object
38
39
40
41
42
|
# File 'lib/roebe/base/colours.rb', line 38
def rev(
use_colours = use_colours?
)
return ::Colours.rev
end
|
#right_arrow? ⇒ Boolean
Also known as:
rarrow?
210
211
212
|
# File 'lib/roebe/base/misc.rb', line 210
def right_arrow?
'→'
end
|
#right_colour(i) ⇒ Object
337
338
339
|
# File 'lib/roebe/base/colours.rb', line 337
def right_colour(i)
lightseagreen(i)
end
|
#roebe_log_directory? ⇒ Boolean
#
roebe_log_directory?
This method will make sure that there is a trailing ‘roebe/’ part of the log directory.
#
409
410
411
412
413
414
415
416
|
# File 'lib/roebe/base/misc.rb', line 409
def roebe_log_directory?
_ = log_directory?
unless _.end_with? 'roebe/'
_ = _.dup if _.frozen?
_ << 'roebe/'
end
return _
end
|
#rosybrown(i = '', use_colours = use_colours?)
) ⇒ Object
134
135
136
137
|
# File 'lib/roebe/base/colours.rb', line 134
def rosybrown(i = '', use_colours = use_colours?)
return COLOURS.rosybrown(i) if use_colours
return i
end
|
#royalblue(i = '', use_colours = use_colours?
) ⇒ Object
86
87
88
89
90
91
92
|
# File 'lib/roebe/base/colours.rb', line 86
def royalblue(
i = '',
use_colours = use_colours?
)
return COLOURS.royalblue(i) if use_colours
return i
end
|
#ruby_base_directory? ⇒ Boolean
78
79
80
|
# File 'lib/roebe/base/misc.rb', line 78
def ruby_base_directory?
return File.absolute_path("#{__dir__}/../..")+'/'
end
|
14
15
|
# File 'lib/roebe/base/run.rb', line 14
def run
end
|
#run_in_background(i) ⇒ Object
109
110
111
|
# File 'lib/roebe/base/misc.rb', line 109
def run_in_background(i)
esystem "#{i} &"
end
|
#run_rcfiles_then_run_ata_via_qdbus ⇒ Object
#
run_rcfiles_then_run_ata_via_qdbus
#
49
50
51
52
53
54
55
|
# File 'lib/roebe/base/misc.rb', line 49
def run_rcfiles_then_run_ata_via_qdbus
require 'rcfiles'
Rcfiles.run
esystem 'qdbus org.kde.konsole-`pidof -s konsole` /Sessions/2 runCommand "ata"'
esystem 'qdbus org.kde.konsole-`pidof -s konsole` /Sessions/3 runCommand "ata"'
esystem 'qdbus org.kde.konsole-`pidof -s konsole` /Sessions/4 runCommand "ata"'
end
|
#sandybrown(i = '', use_colours = use_colours?
) ⇒ Object
440
441
442
443
444
445
446
|
# File 'lib/roebe/base/colours.rb', line 440
def sandybrown(
i = '',
use_colours = use_colours?
)
return COLOURS.sandybrown(i) if use_colours
return i
end
|
#sdir(i = '') ⇒ Object
297
298
299
|
# File 'lib/roebe/base/colours.rb', line 297
def sdir(i = '')
::Roebe.sdir(i)
end
|
#seagreen(i = '', use_colours = use_colours?
) ⇒ Object
652
653
654
655
656
657
658
|
# File 'lib/roebe/base/colours.rb', line 652
def seagreen(
i = '',
use_colours = use_colours?
)
return COLOURS.seagreen(i) if use_colours
return i
end
|
#set_be_verbose(i = true) ⇒ Object
Also known as:
be_verbose, yes_be_verbose
497
498
499
500
501
502
503
504
505
506
507
508
509
|
# File 'lib/roebe/base/prototype.rb', line 497
def set_be_verbose(
i = true
)
case i
when :be_silent,
:be_quiet
i = false
end
@be_verbose = i
end
|
#set_xorg_buffer(i) ⇒ Object
224
225
226
227
|
# File 'lib/roebe/base/misc.rb', line 224
def set_xorg_buffer(i)
require 'roebe/toplevel_methods/xorg_buffer.rb'
XorgBuffer[i] if Object.const_defined? :XorgBuffer
end
|
#sfancy(i = '', use_colours = @use_colours) ⇒ Object
386
387
388
389
390
391
392
393
394
395
|
# File 'lib/roebe/base/colours.rb', line 386
def sfancy(
i = '',
use_colours = @use_colours
)
if use_colours
::Roebe.sfancy(i)
else
return i
end
end
|
#sfile(i = '', use_colours = use_colours?)
) ⇒ Object
286
287
288
289
290
291
292
|
# File 'lib/roebe/base/colours.rb', line 286
def sfile(i = '', use_colours = use_colours?)
if use_colours
::Roebe.sfile(i)
else
i
end
end
|
#show_help ⇒ Object
#
show_help (help tag)
The sub-class can overwrite this method.
#
299
300
301
302
303
|
# File 'lib/roebe/base/misc.rb', line 299
def show_help
e
e 'Currently no help options are documented for this class.'
e
end
|
#silent_redirection? ⇒ Boolean
#simp(i = '') ⇒ Object
14
15
16
|
# File 'lib/roebe/base/simp.rb', line 14
def simp(i = '')
::Roebe.simp(i)
end
|
#simple_esystem(i) ⇒ Object
#
simple_esystem
This method only calls two other methods:
1) e()
2) system()
This method is NOT allowed to become more complex than that.
#
21
22
23
24
|
# File 'lib/roebe/base/esystem.rb', line 21
def simple_esystem(i)
e "#{rev}i"
system i
end
|
#skyblue(i = '', use_colours = use_colours?)
) ⇒ Object
254
255
256
257
|
# File 'lib/roebe/base/colours.rb', line 254
def skyblue(i = '', use_colours = use_colours?)
return COLOURS.skyblue(i) if use_colours
i
end
|
#slateblue(i = '', use_colours = use_colours?
) ⇒ Object
180
181
182
183
184
185
|
# File 'lib/roebe/base/colours.rb', line 180
def slateblue(
i = '', use_colours = use_colours?
)
return COLOURS.slateblue(i) if use_colours
return i
end
|
#slategray(i = '', use_colours = use_colours?)
) ⇒ Object
214
215
216
217
|
# File 'lib/roebe/base/colours.rb', line 214
def slategray(i = '', use_colours = use_colours?)
return COLOURS.slategray(i) if use_colours
i
end
|
#springgreen(i = '', use_colours = use_colours?
) ⇒ Object
158
159
160
161
162
163
164
|
# File 'lib/roebe/base/colours.rb', line 158
def springgreen(
i = '',
use_colours = use_colours?
)
return COLOURS.springgreen(i) if use_colours and COLOURS.respond_to?(:springgreen)
return i
end
|
#steelblue(i = '', use_colours = use_colours?
) ⇒ Object
506
507
508
509
510
511
512
|
# File 'lib/roebe/base/colours.rb', line 506
def steelblue(
i = '',
use_colours = use_colours?
)
return COLOURS.steelblue(i) if COLOURS and use_colours and COLOURS.respond_to?(:steelblue)
return i
end
|
#swarn(i = '', use_colours = @use_colours) ⇒ Object
351
352
353
354
355
356
357
358
359
360
|
# File 'lib/roebe/base/colours.rb', line 351
def swarn(
i = '',
use_colours = @use_colours
)
if use_colours
return ::Colours.swarn(i)
else
return i
end
end
|
#symlink(old_target, new_target) ⇒ Object
Also known as:
symlink_this_to_that
#
symlink
See the core docu at:
https://ruby-doc.org/core/File.html
#
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
# File 'lib/roebe/base/symlink.rb', line 37
def symlink(
old_target,
new_target
)
if File.exist? new_target
e "The target at #{sfile(new_target)} aready exists."
else
begin
File.symlink(old_target, new_target)
rescue Errno::EEXIST => error
pp error
end
end
end
|
#teal(i = '', use_colours = use_colours?)
) ⇒ Object
230
231
232
233
|
# File 'lib/roebe/base/colours.rb', line 230
def teal(i = '', use_colours = use_colours?)
return COLOURS.teal(i) if use_colours
i
end
|
#temp_dir? ⇒ Boolean
#
temp_dir?
This method will return the path to the (local) temporary directory.
#
433
434
435
436
437
438
439
440
441
442
443
|
# File 'lib/roebe/base/misc.rb', line 433
def temp_dir?
_ = ENV['MY_TEMP_DIR']
if _.nil? or _.empty?
if File.directory?('/home/x/Temp')
_ = '/home/x/Temp'
elsif File.directory?('/tmp')
_ = '/tmp'
end
end
return _
end
|
#to_camelcase(i) ⇒ Object
48
49
50
|
# File 'lib/roebe/base/prototype.rb', line 48
def to_camelcase(i)
i.split('_').map(&:capitalize).join
end
|
#to_counted_hash(array) ⇒ Object
#
to_counted_hash
This method expects an Array as its input.
This Array is then converted into a Hash, or rather, a Hash will be returned that keeps track of how many times a specific key was found in that Array.
#
434
435
436
|
# File 'lib/roebe/base/prototype.rb', line 434
def to_counted_hash(array)
array.tally
end
|
#tomato(i = '', use_colours = use_colours?)
) ⇒ Object
119
120
121
122
|
# File 'lib/roebe/base/colours.rb', line 119
def tomato(i = '', use_colours = use_colours?)
return COLOURS.tomato(i) if use_colours
return i
end
|
#touch(i, be_verbose = true) ⇒ Object
Also known as:
create_file
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
|
# File 'lib/roebe/base/prototype.rb', line 376
def touch(
i,
be_verbose = true
)
i = [i].flatten.compact
i.each {|this_file|
unless File.exist? this_file
if be_verbose
e "#{rev}Next creating the file `#{sfile(this_file)}`."
end
begin FileUtils.touch(this_file)
if File.exist?(this_file)
FileUtils.chmod(0644, this_file)
end
rescue Exception => error
pp error
end
end
}
end
|
#try_to_require_the_beautiful_url_gem ⇒ Object
Also known as:
try_to_require_the_beautiful_url_project
#
try_to_require_the_beautiful_url_gem
#
31
32
33
|
# File 'lib/roebe/base/support_for_beautiful_url.rb', line 31
def try_to_require_the_beautiful_url_gem
require 'roebe/requires/failsafe_require_of_beautiful_url.rb'
end
|
#try_to_require_the_html_template ⇒ Object
#
try_to_require_the_html_template
#
448
449
450
451
452
|
# File 'lib/roebe/base/misc.rb', line 448
def try_to_require_the_html_template
begin
require 'cyberweb/requires/require_the_html_template.rb'
rescue LoadError; end
end
|
#try_to_require_the_open_gem ⇒ Object
#
try_to_require_the_open_gem
#
368
369
370
371
372
|
# File 'lib/roebe/base/misc.rb', line 368
def try_to_require_the_open_gem
begin
require 'open'
rescue LoadError; end
end
|
359
360
361
362
363
|
# File 'lib/roebe/base/misc.rb', line 359
def try_to_require_the_program_information_gem
begin
require 'program_information'
rescue LoadError; end
end
|
#try_to_require_the_xorg_buffer ⇒ Object
#
try_to_require_the_xorg_buffer
#
239
240
241
242
243
|
# File 'lib/roebe/base/misc.rb', line 239
def try_to_require_the_xorg_buffer
begin
require 'xorg_buffer'
rescue LoadError; end
end
|
#use_colours? ⇒ Boolean
47
48
49
|
# File 'lib/roebe/base/colours.rb', line 47
def use_colours?
@use_colours
end
|
#verbose_truth(i) ⇒ Object
Also known as:
vb, vt, yes_no, yes_or_no
#weekday?(this_weekday_as_number = Date.today.wday) ⇒ Boolean
60
61
62
63
64
|
# File 'lib/roebe/base/time.rb', line 60
def weekday?(
this_weekday_as_number = Date.today.wday
)
DAY_NAMES[this_weekday_as_number] end
|
#word_wrap(text, line_width = 80) ⇒ Object
377
378
379
380
381
382
|
# File 'lib/roebe/base/misc.rb', line 377
def word_wrap(
text,
line_width = 80
)
return text.scan(/\S.{0,#{line_width}}\S(?=\s|$)|\S+/).join(N)
end
|
#write_what_into(what, into, use_this_mode = 'w+') ⇒ Object
Also known as:
store_what_into, save_what_into, save_what_to
16
17
18
19
20
|
# File 'lib/roebe/base/write_what_into.rb', line 16
def write_what_into(
what, into, use_this_mode = 'w+'
)
Roebe.write_what_into(what, into, use_this_mode)
end
|
#yellow(i = '', use_colours = use_colours?
) ⇒ Object
Also known as:
yel
495
496
497
498
499
500
501
|
# File 'lib/roebe/base/colours.rb', line 495
def yellow(
i = '',
use_colours = use_colours?
)
return COLOURS.yellow(i) if use_colours
return i
end
|