Class: EnvironmentInformation::EnvironmentInformation
- Defined in:
- lib/environment_information/class/class.rb,
lib/environment_information/class/colours.rb
Overview
EnvironmentInformation::EnvironmentInformation
Constant Summary collapse
- TRY_TO_USE_HTML_COLOURS =
#
EnvironmentInformation::EnvironmentInformation::TRY_TO_USE_HTML_COLOURS
If true then we will try to use the konsole-colours, when possible.
These are part of the colours gem, so this adds a dependency on the colours gem.
#
true
- THIS_FILE =
#
EnvironmentInformation::EnvironmentInformation::THIS_FILE
THIS_FILE = __FILE__
We hardcode this since it is only relevant on my home system, anyway.
#
'/home/x/programming/ruby/src/'\ 'environment_information/lib/environment_information/class/'\ 'environment_information.rb'
- THE_PROGRAM_IS_NOT_INSTALLED_OR_COULD_NOT_BE_FOUND =
#
THE_PROGRAM_IS_NOT_INSTALLED_OR_COULD_NOT_BE_FOUND
#
'[The program is not installed or could not be found.]'.dup
Class Method Summary collapse
-
.[](i = ARGV, &block) ⇒ Object
# === EnvironmentInformation::EnvironmentInformation[] ========================================================================= #.
Instance Method Summary collapse
-
#add(i) ⇒ Object
(also: #update_version_for, #append, #append_this_to_main_string, #show_these_entries, #set_additional)
# === add (add tag).
-
#add_ruby_and_rubygems ⇒ Object
# === add_ruby_and_rubygems ========================================================================= #.
-
#add_the_default_programs_on_a_linux_computer ⇒ Object
(also: #add_default_linux_programs)
# === add_the_default_programs_on_a_linux_computer ========================================================================= #.
-
#add_this_to_the_toplevel_hash(a, b) ⇒ Object
(also: #register_onto_the_main_hash)
# === add_this_to_the_toplevel_hash ========================================================================= #.
-
#assign_components_for_the_short_format ⇒ Object
# === assign_components_for_the_short_format.
-
#be_silent ⇒ Object
(also: #be_quiet)
# === be_silent ========================================================================= #.
-
#be_silent? ⇒ Boolean
# === be_silent? ========================================================================= #.
-
#bit_type? ⇒ Boolean
# === bit_type? ========================================================================= #.
-
#blue(i = '') ⇒ Object
# === blue ========================================================================= #.
-
#can_we_query_the_mate_desktop? ⇒ Boolean
# === can_we_query_the_mate_desktop? ========================================================================= #.
-
#cflags_in_use? ⇒ Boolean
# === cflags_in_use? ========================================================================= #.
-
#clear_hash_and_missing_components ⇒ Object
# === clear_hash_and_missing_components ========================================================================= #.
-
#clear_missing_components ⇒ Object
# === clear_missing_components ========================================================================= #.
-
#clear_old_dataset ⇒ Object
# === clear_old_dataset ========================================================================= #.
-
#clear_the_main_dataset ⇒ Object
(also: #clear_main_dataset, #empty_main_dataset, #empty_main_array)
# === clear_the_main_dataset ========================================================================= #.
-
#clear_toplevel_hash ⇒ Object
# === clear_toplevel_hash ========================================================================= #.
-
#col1 ⇒ Object
# === col1.
-
#colourize_this_in_the_right_side_colour(i) ⇒ Object
# === colourize_this_in_the_right_side_colour ========================================================================= #.
-
#commandline? ⇒ Boolean
# === commandline?.
-
#compare_program_versions? ⇒ Boolean
(also: #compare_program_version?)
# === compare_program_versions? ========================================================================= #.
-
#compare_via_gem_version(i) ⇒ Object
# === compare_via_gem_version ========================================================================= #.
-
#consider_adding_the_ruby_components ⇒ Object
# === consider_adding_the_ruby_components.
-
#consider_storing_the_components_that_were_displayed ⇒ Object
(also: #consider_storing_which_components_were_displayed)
# === consider_storing_the_components_that_were_displayed ========================================================================= #.
-
#consider_storing_which_programs_are_not_up_to_date ⇒ Object
# === consider_storing_which_programs_are_not_up_to_date ========================================================================= #.
-
#cpu_model? ⇒ Boolean
# === cpu_model? ========================================================================= #.
-
#crimson(i = '') ⇒ Object
# === crimson ========================================================================= #.
-
#cyan(i = '', use_colours = use_colours? ) ⇒ Object
# === cyan ========================================================================= #.
-
#darkgreen(i = '') ⇒ Object
# === darkgreen ========================================================================= #.
-
#darkolivegreen(i = '') ⇒ Object
# === darkolivegreen ========================================================================= #.
-
#dataset_as_string ⇒ Object
(also: #string?, #string, #main_string?, #stringified)
# === dataset_as_string.
-
#dimgray(i = '') ⇒ Object
# === dimgray ========================================================================= #.
-
#disable_colours ⇒ Object
(also: #no_colours)
# === disable_colours.
-
#display_these_components? ⇒ Boolean
(also: #result, #components?, #main_dataset?, #main_entry?, #dataset?, #result?, #display_which_components?, #array_obtain_these_programs?, #array_with_entries?, #main_array?, #programs?, #show_these_components?)
# === display_these_components?.
-
#do_compare_the_program_version(be_verbose = true) ⇒ Object
# === do_compare_the_program_version.
-
#do_display_in_a_short_format ⇒ Object
# === do_display_in_a_short_format.
-
#do_exit_the_program ⇒ Object
# === do_exit_the_program ========================================================================= #.
-
#do_generate_a_html_file(styling_instructions = :none) ⇒ Object
# === do_generate_a_html_file (html tag).
-
#do_not_display_the_result ⇒ Object
# === do_not_display_the_result ========================================================================= #.
-
#do_not_run_already ⇒ Object
(also: #do_not_run)
# === do_not_run_already ========================================================================= #.
-
#do_not_save_anything ⇒ Object
(also: #do_not_store_anything)
# === do_not_save_anything ========================================================================= #.
-
#do_not_show_the_ruby_components ⇒ Object
(also: #do_not_display_the_ruby_components)
# === do_not_show_the_ruby_components ========================================================================= #.
-
#do_rename_kde_konsole(use_this_title = 'Environment Information') ⇒ Object
# === do_rename_kde_konsole.
-
#do_report_the_remote_urls ⇒ Object
# === do_report_the_remote_urls.
-
#do_show_almost_everything_excluding_the_default_linux_programs ⇒ Object
# === do_show_almost_everything_excluding_the_default_linux_programs.
-
#do_show_everything ⇒ Object
(also: #do_show_full_information, #show_full_information)
# === do_show_everything (everything tag, full tag).
-
#do_show_help ⇒ Object
(also: #show_help)
# === do_show_help (help tag).
-
#do_show_only_the_operating_system ⇒ Object
# === do_show_only_the_operating_system.
-
#do_show_only_the_xorg_components ⇒ Object
# === do_show_only_the_xorg_components.
-
#do_sort_alphabetically(display_these_components = display_which_components? ) ⇒ Object
# === do_sort_alphabetically (sort tag).
-
#dont_show_ruby_stuff ⇒ Object
(also: #show_no_ruby)
# === dont_show_ruby_stuff.
-
#e(i = '') ⇒ Object
# === e (e tag).
-
#enable_colours ⇒ Object
# === enable_colours ========================================================================= #.
-
#enable_sort_alphabetically ⇒ Object
# === enable_sort_alphabetically ========================================================================= #.
-
#gui? ⇒ Boolean
# === gui? ========================================================================= #.
-
#initialize(commandline_arguments = nil, run_already = true) ⇒ EnvironmentInformation
constructor
# === initialize ========================================================================= #.
-
#is_a_registered_component?(i) ⇒ Boolean
(also: #is_an_allowed_entry?)
# === is_a_registered_component? ========================================================================= #.
-
#is_rbt_available_and_may_we_try_to_use_rbt? ⇒ Boolean
# === is_rbt_available_and_may_we_try_to_use_rbt? ========================================================================= #.
-
#is_this_program_included?(i) ⇒ Boolean
# === is_this_program_included? ========================================================================= #.
-
#lightgreen(i = '') ⇒ Object
# === lightgreen ========================================================================= #.
-
#limegreen(i = '') ⇒ Object
# === limegreen ========================================================================= #.
-
#load_dataset_from_this_file(i) ⇒ Object
(also: #try_to_load_dataset_from_this_file, #try_to_read_content_from_this_file)
# === load_dataset_from_this_file.
-
#main_hash? ⇒ Boolean
# === main_hash? ========================================================================= #.
-
#may_we_try_to_use_rbt? ⇒ Boolean
# === may_we_try_to_use_rbt? ========================================================================= #.
-
#mediumpurple(i = '') ⇒ Object
# === mediumpurple ========================================================================= #.
-
#menu(i = @commandline_arguments) ⇒ Object
# === menu (menu tag).
-
#olive(i = '') ⇒ Object
# === olive ========================================================================= #.
-
#olivedrab(i = '') ⇒ Object
# === olivedrab.
-
#open_this_file_in_editor ⇒ Object
# === open_this_file_in_editor ========================================================================= #.
-
#operating_system? ⇒ Boolean
(also: #return_version_of_operating_system)
# === operating_system?.
-
#opnn ⇒ Object
(also: #opn)
# === opnn ========================================================================= #.
-
#orange(i = '') ⇒ Object
# === orange ========================================================================= #.
-
#ram? ⇒ Boolean
# === ram? ========================================================================= #.
-
#register_sigint ⇒ Object
# === register_sigint ========================================================================= #.
-
#register_the_available_components_and_show_them_at_once(report_these_programs = @array_report_these_programs) ⇒ Object
(also: #display, #report_result, #display_the_components, #display_the_dataset, #work_through_the_programs, #build_up_the_main_string, #display_the_main_components, #report)
# === register_the_available_components_and_show_them_at_once (report tag).
-
#register_unavailable_program(i) ⇒ Object
(also: #register_not_found)
# === register_unavailable_program.
-
#report_the_installed_KDE_software_suite ⇒ Object
# === report_the_installed_KDE_software_suite ========================================================================= #.
-
#report_the_remote_urls? ⇒ Boolean
# === report_the_remote_urls? ========================================================================= #.
-
#report_version ⇒ Object
# === report_version ========================================================================= #.
-
#reset ⇒ Object
# === reset (reset tag) ========================================================================= #.
-
#result_as_array ⇒ Object
# === result_as_array.
-
#return_all_ruby_components ⇒ Object
# === return_all_ruby_components.
-
#return_default_programs_on_linux ⇒ Object
(also: #return_default_programs_on_a_linux_computer, #return_default_programs)
# === return_default_programs_on_linux.
-
#return_every_registered_component ⇒ Object
# === return_every_registered_component ========================================================================= #.
-
#return_remote_gtk2_version ⇒ Object
# === return_remote_gtk2_version.
-
#return_version_of_awk? ⇒ Boolean
(also: #return_version_of_awk)
# === return_version_of_awk? ========================================================================= #.
-
#return_version_of_binutils? ⇒ Boolean
(also: #return_version_of_binutils)
# === return_version_of_binutils? ========================================================================= #.
-
#return_version_of_bison? ⇒ Boolean
(also: #return_version_of_bison)
# === return_version_of_bison? ========================================================================= #.
-
#return_version_of_boost? ⇒ Boolean
(also: #return_version_of_boost)
# === return_version_of_boost? ========================================================================= #.
-
#return_version_of_busyboxy? ⇒ Boolean
(also: #return_version_of_busyboxy)
# === return_version_of_busyboxy? ========================================================================= #.
-
#return_version_of_coreutils? ⇒ Boolean
(also: #return_version_of_coreutils)
# === return_version_of_coreutils? ========================================================================= #.
-
#return_version_of_diffutils? ⇒ Boolean
(also: #return_version_of_diffutils)
# === return_version_of_diffutils? ========================================================================= #.
-
#return_version_of_flex? ⇒ Boolean
(also: #return_version_of_flex)
# === return_version_of_flex? ========================================================================= #.
-
#return_version_of_gcc? ⇒ Boolean
(also: #return_version_of_gcc)
# === return_version_of_gcc? ========================================================================= #.
-
#return_version_of_glibc? ⇒ Boolean
(also: #return_version_of_glibc)
# === return_version_of_glibc? ========================================================================= #.
-
#return_version_of_gnupg? ⇒ Boolean
(also: #return_version_of_gnupg)
# === return_version_of_gnupg? ========================================================================= #.
-
#return_version_of_grep? ⇒ Boolean
(also: #return_version_of_grep)
# === return_version_of_grep? ========================================================================= #.
-
#return_version_of_intltool? ⇒ Boolean
(also: #return_version_of_intltool)
# === return_version_of_intltool? ========================================================================= #.
-
#return_version_of_linux_kernel? ⇒ Boolean
(also: #return_version_of_linux_kernel)
# === return_version_of_linux_kernel? ========================================================================= #.
-
#return_version_of_ruby? ⇒ Boolean
(also: #return_version_of_ruby)
# === return_version_of_ruby? ========================================================================= #.
-
#return_version_of_rubygems? ⇒ Boolean
(also: #return_version_of_rubygems)
# === return_version_of_rubygems? ========================================================================= #.
-
#return_version_of_xvid? ⇒ Boolean
(also: #return_version_of_xvid)
# === return_version_of_xvid? ========================================================================= #.
-
#rev ⇒ Object
# === rev ========================================================================= #.
-
#royalblue(i = '') ⇒ Object
# === royalblue ========================================================================= #.
-
#rubygems_installation_directory? ⇒ Boolean
# === rubygems_installation_directory? ========================================================================= #.
-
#run ⇒ Object
(also: #feedback_everything, #do_feedback_everything, #output, #feedback)
# === run (run tag) ========================================================================= #.
-
#screen_resolution? ⇒ Boolean
# === screen_resolution? ========================================================================= #.
-
#seagreen(i = '') ⇒ Object
# === seagreen ========================================================================= #.
-
#set_be_silent(i = true) ⇒ Object
# === set_be_silent ========================================================================= #.
-
#set_main_array(i) ⇒ Object
(also: #set_display_these_components, #set_use_this_as_main_input, #set_report_these_programs, #show_only_the_components_from_this_dataset)
# === set_main_array ========================================================================= #.
-
#set_runmode_gui ⇒ Object
# === set_runmode_gui ========================================================================= #.
-
#set_runmode_html ⇒ Object
# === set_runmode_html ========================================================================= #.
-
#set_use_colours(i = '') ⇒ Object
# === set_use_colours ========================================================================= #.
-
#sfancy(i = '') ⇒ Object
# === sfancy ========================================================================= #.
-
#sfile(i) ⇒ Object
# === sfile ========================================================================= #.
-
#shall_we_really_store_which_programs_are_not_up_to_date? ⇒ Boolean
# === shall_we_really_store_which_programs_are_not_up_to_date?.
-
#show_everything? ⇒ Boolean
# === show_everything? ========================================================================= #.
-
#show_help? ⇒ Boolean
# === show_help? ========================================================================= #.
-
#show_n_registered_entries ⇒ Object
# === show_n_registered_entries.
-
#show_the_registered_components(i = tracked_programs? ) ⇒ Object
# === show_the_registered_components ========================================================================= #.
-
#simp(i, use_colours = use_colours?) ) ⇒ Object
# === simp ========================================================================= #.
-
#slateblue(i = '') ⇒ Object
# === slateblue ========================================================================= #.
-
#sort_alphabetically? ⇒ Boolean
# === sort_alphabetically? ========================================================================= #.
-
#start_gtk_component ⇒ Object
# === start_gtk_component.
-
#start_the_sinatra_interface ⇒ Object
# === start_the_sinatra_interface ========================================================================= #.
-
#steelblue(i = '') ⇒ Object
# === steelblue ========================================================================= #.
-
#store_the_results_into_local_files? ⇒ Boolean
# === store_the_results_into_local_files? ========================================================================= #.
-
#teal(i = '') ⇒ Object
# === teal ========================================================================= #.
-
#tracked_programs? ⇒ Boolean
# === tracked_programs? ========================================================================= #.
-
#true_rev ⇒ Object
# === true_rev ========================================================================= #.
-
#try_to_rename_the_kde_konsole_tab? ⇒ Boolean
# === try_to_rename_the_kde_konsole_tab? ========================================================================= #.
-
#use_ascii_table ⇒ Object
# === use_ascii_table.
-
#use_colours? ⇒ Boolean
# === use_colours? ========================================================================= #.
-
#use_one_line_to_show_the_result? ⇒ Boolean
# === use_one_line_to_show_the_result? ========================================================================= #.
-
#work_on_the_programs_directory_only(use_this_as_programs_directory = '/home/Programs/') ⇒ Object
# === work_on_the_programs_directory_only.
-
#write_what_into(what, into) ⇒ Object
# === write_what_into ========================================================================= #.
-
#xorg_components? ⇒ Boolean
(also: #return_all_xorg_components)
# === xorg_components? ========================================================================= #.
Methods inherited from Base
#cd, #commandline_arguments?, #esystem, #first_argument?, #gold, #is_on_roebe?, #is_rbt_available?, #lightblue, #log_dir?, #mediumaquamarine, #report_left_right, #set_commandline_arguments
Constructor Details
#initialize(commandline_arguments = nil, run_already = true) ⇒ EnvironmentInformation
#
initialize
#
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 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/environment_information/class/class.rb', line 76 def initialize( commandline_arguments = nil, run_already = true ) register_sigint reset # ======================================================================= # # Next, we handle special run-mode variants. # ======================================================================= # case run_already when :do_show_everything do_show_everything run_already = true end # ======================================================================= # # And set @run_already, so that menu() can overrule it lateron. # ======================================================================= # @run_already = run_already set_commandline_arguments( commandline_arguments ) # ======================================================================= # # === Handle blocks # # Next blocks will be handled. This must come after the reset() method. # ======================================================================= # if block_given? yielded = yield case yielded # case tag # ===================================================================== # # === :do_not_use_rbt # ===================================================================== # when :do_not_use_rbt @internal_hash[:may_we_try_to_use_rbt] = false # ===================================================================== # # === :disable_colours # ===================================================================== # when :disable_colours disable_colours # ===================================================================== # # === :disable_colours_and_do_not_store_into_a_local_file # ===================================================================== # when :disable_colours_and_do_not_store_into_a_local_file disable_colours do_not_save_anything # ===================================================================== # # === :do_not_run_yet # ===================================================================== # when :do_not_run_yet @run_already = false else # =================================================================== # # Handle Hashes given in the block. # =================================================================== # if yielded.is_a? Hash # ================================================================= # # === :use_n_tokens # ================================================================= # if yielded.has_key? :use_n_tokens set_use_n_tokens(yielded.delete(:use_n_tokens)) # ================================================================= # # === :n_tokens # ================================================================= # elsif yielded.has_key? :n_tokens set_use_n_tokens(yielded.delete(:n_tokens)) end # ================================================================= # # === :use_colours # ================================================================= # if yielded.has_key? :use_colours set_use_colours(yielded.delete(:use_colours)) end # ================================================================= # # === :be_silent # ================================================================= # if yielded.has_key? :be_silent set_be_silent(yielded.delete(:be_silent)) end # ================================================================= # # === :show_ruby_stuff # ================================================================= # if yielded.has_key? :show_ruby_stuff if yielded.delete(:show_ruby_stuff) == false dont_show_ruby_stuff end end end end end # ======================================================================= # # First, we will add the default programs on a linux computer. The # later invocation to menu() can change this, but we also want to # provide "useful defaults" for users to benefit from this gem. # ======================================================================= # add_the_default_programs_on_a_linux_computer # ======================================================================= # # Add the ruby components next. This must come before menu(). # ======================================================================= # consider_adding_the_ruby_components # ======================================================================= # # Invoke menu() to query and honour the commandline arguments. # ======================================================================= # run if @run_already end |
Class Method Details
.[](i = ARGV, &block) ⇒ Object
#
EnvironmentInformation::EnvironmentInformation[]
#
2543 2544 2545 |
# File 'lib/environment_information/class/class.rb', line 2543 def self.[](i = ARGV, &block) new(i, &block) end |
Instance Method Details
#add(i) ⇒ Object Also known as: update_version_for, append, append_this_to_main_string, show_these_entries, set_additional
#
add (add tag)
This method can be used to add individual entries to the main array called @array_report_these_programs.
The format for add() contains only one component, which appears on the left side, and denotes the name of the program or component that we wish to query, such as “php” or “ruby” and so forth.
Some Symbols will be used as a “pointer” towards an Array of registered programs.
Note that (1) will be converted into a Symbol if it is a String.
If the second entry (2) is nil, then the version will be inferred at “runtime” within the method display(). Otherwise display() will simply use the passed version (which should be a String in that case, then).
Before we can add an entry to the main dataset, we have to check whether it is a registered entry altogether. If it is not registered, the user has to be notified about this fact. This notification will ONLY happen if the associated version is nil; if a specific version is supplied then this method will assume that the program should be displayed anyway.
An Array can also be supplied to this method, if necessary.
#
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 |
# File 'lib/environment_information/class/class.rb', line 415 def add( i ) if i.is_a?(String) and i.include?(',') # ===================================================================== # # Strings containing ',' will be split accordingly. # ===================================================================== # i = i.split(',') elsif i.is_a?(String) and i.include?('-') # ===================================================================== # # Strings containing '-' will lose that '-'. # ===================================================================== # i = i.dup if i.frozen? i.delete!('-') end [i].flatten.compact.each {|entry| case entry # ===================================================================== # # === :everything # # This entry point is meant for simply adding everything. # ===================================================================== # when :everything entry = return_every_registered_component # ===================================================================== # # === Rubygems installation directory # ===================================================================== # when :rubygems_installation_directory, /^rubygems( |_)?installation( |_)?directory\??$/i entry = 'rubygems_installation_directory' # ===================================================================== # # === cflags # ===================================================================== # when :cflags, /^cflags$/i entry = 'CFLAGS in use' # ===================================================================== # # === screen_resolution # ===================================================================== # when :screen_resolution, /^screen( |_)?resolution$/i entry = 'Screen Resolution' # ===================================================================== # # === ram # ===================================================================== # when :ram, /^ram$/i entry = 'RAM' # ===================================================================== # # === cpuinfo # ===================================================================== # when :cpuinfo, /^cpuinfo$/i entry = 'CPU Model' # ===================================================================== # # === operating_system_bit_type # ===================================================================== # when :operating_system_bit_type, /^operating(_|-)?system(_|-)?bit(_|-)?type$/i entry = 'Operating system bit type' # ===================================================================== # # === :operating_system # ===================================================================== # when :operating_system, /^operating(_|-)?system$/i, /^operating(_|-)?system(_|-)?in(_|-)?use$/i entry = 'Operating system' # ===================================================================== # # === cpflags # ===================================================================== # when /^cflags$/i, /^CFLAGS in use$/i entry = 'CFLAGS in use' # ===================================================================== # # === :pkgconfig_entries # ===================================================================== # when :pkgconfig_entries entry = ::EnvironmentInformation.return_pkgconfig_based_programs # ===================================================================== # # === :all_xorg_components # ===================================================================== # when :all_xorg_components entry = return_all_xorg_components # ===================================================================== # # === envi --science # ===================================================================== # when :science_cluster entry = ARRAY_SCIENCE_CLUSTER # ===================================================================== # # === envi --lfs_core_programs # ===================================================================== # when :lfs, :lfs_core_programs entry = ::EnvironmentInformation.lfs_core_programs? # ===================================================================== # # === :linux_kernel # ===================================================================== # when :linux_kernel i = :linux # ===================================================================== # # === :RAM # ===================================================================== # when :RAM entry = :ram # Just the "alias" to the real entry. end unless @array_report_these_programs.include? entry @array_report_these_programs << entry @array_report_these_programs.flatten! end } end |
#add_ruby_and_rubygems ⇒ Object
#
add_ruby_and_rubygems
#
546 547 548 549 550 |
# File 'lib/environment_information/class/class.rb', line 546 def add_ruby_and_rubygems add(:ruby) add(:rubygems) add(:rubygems_installation_directory) end |
#add_the_default_programs_on_a_linux_computer ⇒ Object Also known as: add_default_linux_programs
#
add_the_default_programs_on_a_linux_computer
#
534 535 536 537 538 539 540 541 |
# File 'lib/environment_information/class/class.rb', line 534 def add_the_default_programs_on_a_linux_computer # ======================================================================= # # Add the default programs on a linux computer. # ======================================================================= # add( return_default_programs_on_a_linux_computer ) end |
#add_this_to_the_toplevel_hash(a, b) ⇒ Object Also known as: register_onto_the_main_hash
#
add_this_to_the_toplevel_hash
#
555 556 557 558 |
# File 'lib/environment_information/class/class.rb', line 555 def add_this_to_the_toplevel_hash(a, b) a = a.to_sym unless a.is_a? Symbol ::EnvironmentInformation.hash?[a] = b end |
#assign_components_for_the_short_format ⇒ Object
#
assign_components_for_the_short_format
We will only display 6 components when we use the short variant.
#
898 899 900 901 902 903 904 905 906 907 908 909 |
# File 'lib/environment_information/class/class.rb', line 898 def assign_components_for_the_short_format clear_old_dataset dont_show_ruby_stuff add(i( cpuinfo cflags RAM screen_resolution )) end |
#be_silent ⇒ Object Also known as: be_quiet
#
be_silent
#
1012 1013 1014 |
# File 'lib/environment_information/class/class.rb', line 1012 def be_silent @be_silent = true end |
#be_silent? ⇒ Boolean
#
be_silent?
#
1026 1027 1028 |
# File 'lib/environment_information/class/class.rb', line 1026 def be_silent? @be_silent end |
#bit_type? ⇒ Boolean
#
bit_type?
#
1360 1361 1362 |
# File 'lib/environment_information/class/class.rb', line 1360 def bit_type? ::EnvironmentInformation. end |
#blue(i = '') ⇒ Object
#
blue
#
38 39 40 41 42 |
# File 'lib/environment_information/class/colours.rb', line 38 def blue(i = '') if i.empty? ::Colours::BLUE end if use_colours? end |
#can_we_query_the_mate_desktop? ⇒ Boolean
#
can_we_query_the_mate_desktop?
#
875 876 877 |
# File 'lib/environment_information/class/class.rb', line 875 def can_we_query_the_mate_desktop? is_rbt_available? and RBT.const_defined?(:ReportMateDesktopVersion) end |
#cflags_in_use? ⇒ Boolean
#
cflags_in_use?
#
1402 1403 1404 |
# File 'lib/environment_information/class/class.rb', line 1402 def cflags_in_use? ::EnvironmentInformation.cflags_in_use? end |
#clear_hash_and_missing_components ⇒ Object
#
clear_hash_and_missing_components
#
1439 1440 1441 1442 |
# File 'lib/environment_information/class/class.rb', line 1439 def clear_hash_and_missing_components clear_toplevel_hash clear_missing_components end |
#clear_missing_components ⇒ Object
#
clear_missing_components
#
1447 1448 1449 |
# File 'lib/environment_information/class/class.rb', line 1447 def clear_missing_components ::EnvironmentInformation.clear_missing_components end |
#clear_old_dataset ⇒ Object
#
clear_old_dataset
#
1137 1138 1139 |
# File 'lib/environment_information/class/class.rb', line 1137 def clear_old_dataset @array_report_these_programs.clear end |
#clear_the_main_dataset ⇒ Object Also known as: clear_main_dataset, empty_main_dataset, empty_main_array
#
clear_the_main_dataset
#
1171 1172 1173 1174 |
# File 'lib/environment_information/class/class.rb', line 1171 def clear_the_main_dataset clear_old_dataset do_not_display_the_ruby_components end |
#clear_toplevel_hash ⇒ Object
#
clear_toplevel_hash
#
1181 1182 1183 |
# File 'lib/environment_information/class/class.rb', line 1181 def clear_toplevel_hash ::EnvironmentInformation.clear_hash end |
#col1 ⇒ Object
#
col1
The “first” colour to be used.
#
110 111 112 113 114 115 116 |
# File 'lib/environment_information/class/colours.rb', line 110 def col1 if use_colours? Colours::BOLD_BLUE else '' end end |
#colourize_this_in_the_right_side_colour(i) ⇒ Object
#
colourize_this_in_the_right_side_colour
#
16 17 18 19 20 21 22 |
# File 'lib/environment_information/class/colours.rb', line 16 def colourize_this_in_the_right_side_colour(i) if use_colours? ::Colours.send(::EnvironmentInformation.colour_for_the_right_side, i) else i end end |
#commandline? ⇒ Boolean
#
commandline?
Whether we run in the “commandline mode” or whether we run in the GUI or WWW/HTML mode.
#
1005 1006 1007 |
# File 'lib/environment_information/class/class.rb', line 1005 def commandline? @runmode == :commandline end |
#compare_program_versions? ⇒ Boolean Also known as: compare_program_version?
#
compare_program_versions?
#
1481 1482 1483 |
# File 'lib/environment_information/class/class.rb', line 1481 def compare_program_versions? @internal_hash[:compare_program_versions] end |
#compare_via_gem_version(i) ⇒ Object
#
compare_via_gem_version
#
1697 1698 1699 1700 1701 1702 1703 1704 1705 |
# File 'lib/environment_information/class/class.rb', line 1697 def compare_via_gem_version(i) begin Gem::Version.new(i) rescue ArgumentError => error e Colours.tomato(error) e "#{rev}We will continue nonetheless (#{i})" return nil end end |
#consider_adding_the_ruby_components ⇒ Object
#
consider_adding_the_ruby_components
This method can be used to consider adding the ruby-components, which means “ruby” itself, rubygems “gem”, and the rubygems installation directory.
#
1632 1633 1634 1635 1636 1637 1638 |
# File 'lib/environment_information/class/class.rb', line 1632 def consider_adding_the_ruby_components if @show_ruby_version_and_gem_version add( return_all_ruby_components # Combine three calls into one here - all related to ruby. ) end end |
#consider_storing_the_components_that_were_displayed ⇒ Object Also known as: consider_storing_which_components_were_displayed
#
consider_storing_the_components_that_were_displayed
#
846 847 848 849 850 |
# File 'lib/environment_information/class/class.rb', line 846 def consider_storing_the_components_that_were_displayed if store_the_results_into_local_files? ::EnvironmentInformation.consider_storing_these_results_into_a_local_file end end |
#consider_storing_which_programs_are_not_up_to_date ⇒ Object
#
consider_storing_which_programs_are_not_up_to_date
#
1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 |
# File 'lib/environment_information/class/class.rb', line 1341 def consider_storing_which_programs_are_not_up_to_date if shall_we_really_store_which_programs_are_not_up_to_date? into = FILE_THESE_PROGRAMS_CAN_BE_UPGRADED what = YAML.dump(@array_these_programs_not_up_to_date) if File.directory?('/home/Temp/rbt/') into = "/home/Temp/rbt/#{File.basename(into)}" else into = "#{log_dir?}#{File.basename(into)}" end opnn; e 'We will also store which programs are not up to date.' opnn; e "These will be stored into the file at `#{sfile(into)}`." ::EnvironmentInformation.write_what_into(what, into) end end |
#cpu_model? ⇒ Boolean
#
cpu_model?
#
1378 1379 1380 |
# File 'lib/environment_information/class/class.rb', line 1378 def cpu_model? ::EnvironmentInformation.cpuinfo? end |
#crimson(i = '') ⇒ Object
#
crimson
#
137 138 139 140 141 142 |
# File 'lib/environment_information/class/colours.rb', line 137 def crimson(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.crimson(i) end return i end |
#cyan(i = '', use_colours = use_colours? ) ⇒ Object
#
cyan
#
27 28 29 30 31 32 33 |
# File 'lib/environment_information/class/colours.rb', line 27 def cyan( i = '', use_colours = use_colours? ) if i.empty? Colours::CYAN end if use_colours end |
#darkgreen(i = '') ⇒ Object
#
darkgreen
#
147 148 149 150 151 152 |
# File 'lib/environment_information/class/colours.rb', line 147 def darkgreen(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.darkgreen(i) end return i end |
#darkolivegreen(i = '') ⇒ Object
#
darkolivegreen
#
239 240 241 242 243 244 |
# File 'lib/environment_information/class/colours.rb', line 239 def darkolivegreen(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.darkolivegreen(i) end return i end |
#dataset_as_string ⇒ Object Also known as: string?, string, main_string?, stringified
#
dataset_as_string
This method must return the dataset in String format. That String must already be properly “formatted”.
#
1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 |
# File 'lib/environment_information/class/class.rb', line 1191 def dataset_as_string _ = ''.dup # Put the information onto that String here. main_dataset?.each {|entry| if entry.is_a? Array entry = entry.first # The second entry is ignored in that event. end # ===================================================================== # # Before we can use .send() we have to check whether EnvironmentInformation # actually responds to that method. If not then we will simply skip # this snippet for now; but this may have to be changed at some # point in the future, to more elegantly handle failure. (Sep 2019). # ===================================================================== # use_this_method = "return_version_of_#{entry}".to_sym if ::EnvironmentInformation.respond_to? use_this_method program_version = ::EnvironmentInformation.send( use_this_method ) entry = " #{entry}:" _ << "#{entry} #{program_version}#{N}" end } return _ # And return the generated String. end |
#dimgray(i = '') ⇒ Object
#
dimgray
#
157 158 159 160 161 162 |
# File 'lib/environment_information/class/colours.rb', line 157 def dimgray(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.dimgray(i) end return i end |
#disable_colours ⇒ Object Also known as: no_colours
#
disable_colours
Call this method when you wish to disable the colours. Note that this will disable colours on the toplevel.
#
79 80 81 |
# File 'lib/environment_information/class/colours.rb', line 79 def disable_colours ::EnvironmentInformation.use_colours = false end |
#display_these_components? ⇒ Boolean Also known as: result, components?, main_dataset?, main_entry?, dataset?, result?, display_which_components?, array_obtain_these_programs?, array_with_entries?, main_array?, programs?, show_these_components?
#
display_these_components?
Note that @display_these_components is a Hash.
#
1771 1772 1773 |
# File 'lib/environment_information/class/class.rb', line 1771 def display_these_components? @array_report_these_programs end |
#do_compare_the_program_version(be_verbose = true) ⇒ Object
#
do_compare_the_program_version
This method can be used if the user wishes to also compare the program version of the installed programs. This functionality depends on the rbt gem, and the RBT namespace.
#
1468 1469 1470 1471 1472 1473 1474 1475 1476 |
# File 'lib/environment_information/class/class.rb', line 1468 def do_compare_the_program_version( be_verbose = true ) if be_verbose @array_show_this_to_the_user << 'The program versions will also be compared.' end @internal_hash[:compare_program_versions] = true end |
#do_display_in_a_short_format ⇒ Object
#
do_display_in_a_short_format
The short-format means that we will use only a compact set of programs to display. For example, “make” and “bash” will not be displayed, neither “binutils” or “ruby”.
#
1565 1566 1567 |
# File 'lib/environment_information/class/class.rb', line 1565 def do_display_in_a_short_format @display_everything_in_short_format = true end |
#do_exit_the_program ⇒ Object
#
do_exit_the_program
#
988 989 990 |
# File 'lib/environment_information/class/class.rb', line 988 def do_exit_the_program @do_exit_the_program = true end |
#do_generate_a_html_file(styling_instructions = :none) ⇒ Object
#
do_generate_a_html_file (html tag)
The action-method that will generate the html file. This depends on the gem html_tags, with module HtmlTags though.
To invoke this method, do:
envi --generate-html-file
#
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 |
# File 'lib/environment_information/class/class.rb', line 664 def do_generate_a_html_file( styling_instructions = :none ) # ======================================================================= # # === Ensure that the html_tags project is available # ======================================================================= # unless Object.const_defined? :HtmlTags begin require 'html_tags' rescue LoadError e 'html_tags is not available. Considering installing it via:' e e ' gem install html_tags' e end end # ======================================================================= # # === Define where to store the .html file in question # ======================================================================= # this_html_file = "#{::EnvironmentInformation.temp_directory?}environment_information.html" # ======================================================================= # # Obtain the main dataset next. # ======================================================================= # what = dataset_as_string case styling_instructions when :bold what = HtmlTags.b(what) end what = HtmlTags.html( HtmlTags.title('Information about the local environment')+ HtmlTags.body( HtmlTags.h1( 'Your environment', css_style: 'margin-top: 0.5em; margin-bottom: 0.5em; padding: 2px;' )+ HtmlTags.pre( what, css_style: 'font-weight: bold; font-size: 2em; padding-left: 1.0em; margin-top:2px;' ) ) ) ::EnvironmentInformation.write_what_into(what, this_html_file) # ======================================================================= # # Notify the user what has been done. # ======================================================================= # if File.exist? this_html_file opnn; e "Generated a HTML file at `#{sfile(this_html_file)}`." end end |
#do_not_display_the_result ⇒ Object
#
do_not_display_the_result
#
1041 1042 1043 |
# File 'lib/environment_information/class/class.rb', line 1041 def do_not_display_the_result @display_result = false end |
#do_not_run_already ⇒ Object Also known as: do_not_run
#
do_not_run_already
#
1098 1099 1100 |
# File 'lib/environment_information/class/class.rb', line 1098 def do_not_run_already @run_already = false end |
#do_not_save_anything ⇒ Object Also known as: do_not_store_anything
#
do_not_save_anything
#
1550 1551 1552 1553 1554 1555 1556 |
# File 'lib/environment_information/class/class.rb', line 1550 def do_not_save_anything @shall_the_results_be_saved = false # ======================================================================= # # We will also avoid saving the results into a local yaml file. # ======================================================================= # @internal_hash[:store_the_results_into_local_files] = false end |
#do_not_show_the_ruby_components ⇒ Object Also known as: do_not_display_the_ruby_components
#
do_not_show_the_ruby_components
#
1643 1644 1645 |
# File 'lib/environment_information/class/class.rb', line 1643 def do_not_show_the_ruby_components @show_ruby_version_and_gem_version = false end |
#do_rename_kde_konsole(use_this_title = 'Environment Information') ⇒ Object
#
do_rename_kde_konsole
This will attempt to rename the KDE Konsole tab, but only if we are on roebe.
#
1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 |
# File 'lib/environment_information/class/class.rb', line 1051 def do_rename_kde_konsole( use_this_title = 'Environment Information' ) begin require 'roebe/requires/require_kde_konsole.rb' rescue LoadError; end if try_to_rename_the_kde_konsole_tab? and is_on_roebe? and Object.const_defined?(:Roebe) and Roebe.const_defined?(:KdeKonsole) Roebe.rename_konsole(use_this_title) end end |
#do_report_the_remote_urls ⇒ Object
#
do_report_the_remote_urls
Enable the reporting of the remote URLs, if available.
#
1730 1731 1732 |
# File 'lib/environment_information/class/class.rb', line 1730 def do_report_the_remote_urls @internal_hash[:report_the_remote_urls] = true end |
#do_show_almost_everything_excluding_the_default_linux_programs ⇒ Object
#
do_show_almost_everything_excluding_the_default_linux_programs
This is similar to do_show_everything() but it will not show the default linux programs.
#
813 814 815 816 817 818 819 820 821 822 823 |
# File 'lib/environment_information/class/class.rb', line 813 def do_show_almost_everything_excluding_the_default_linux_programs these_programs = return_every_registered_component default_programs = return_default_programs # ======================================================================= # # Next subtract those that are part in the default_programs. # ======================================================================= # these_programs.reject! {|entry| default_programs.include? entry } add(these_programs) end |
#do_show_everything ⇒ Object Also known as: do_show_full_information, show_full_information
#
do_show_everything (everything tag, full tag)
This method can be used when the user wishes to enable seeing full information about his local environment (on the computer).
This will always display EVERY registered component.
Commandline invocation:
envi --everything
#
838 839 840 |
# File 'lib/environment_information/class/class.rb', line 838 def do_show_everything add(:everything) # Simply add everything. end |
#do_show_help ⇒ Object Also known as: show_help
#
do_show_help (help tag)
Show the commandline-usage through this method here.
To invoke this, try:
envi --help
#
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
# File 'lib/environment_information/class/class.rb', line 588 def do_show_help e lpad = "#{col1} " e "#{rev}The following options are available for "\ "#{simp('class EnvironmentInformation:')}#{rev}#{N}#{N}" if ASCIITABLE_IS_AVAILABLE e col1+' asciitable '+rev+'# Print in Ascii Table format' end e lpad+'html '+rev+'# Save the environment information '\ 'into a .html file' e lpad+'gui '+rev+'# Start the GTK gui bindings; some '\ 'aliases are possible such as --GUI' e lpad+'nocolours '+rev+'# Disable colours '\ '(--disable-colours also works)' e lpad+'noruby '+rev+'# dont show ruby-related environment '\ 'information' e lpad+'help '+rev+'# show some help' e lpad+'xorg '+rev+'# show some xorg-specific '\ 'components (also --xorg-components)' e lpad+'OS '+rev+'# show the OS then exit' e lpad+'full '+rev+'# show full information, including '\ 'GTK, Glib, Atk and Pango Version' e ' # ^^^ This is probably the most useful usage.' e lpad+'openssl '+rev+'# display openssl option' e lpad+'REALLY_ALL '+rev+'# also compare the program_versions '\ '(--really-everything is an alias to this)' e lpad+'save '+rev+'# display the result, then '\ 'save it into a file' e lpad+'sinatra '+rev+'# start the sinatra-interface '\ 'of the environment_information project' e lpad+'version '+rev+'# show the version of '\ 'EnvironmentInformation in use' e lpad+'--show-remote-url '+rev+'# show the remote URLs '\ 'of a program (requires the RBT project)' e lpad+'padding=value '+rev+'# set to another padding value' e lpad+'--one-liner '+rev+'# show everything compacted, without a newline' e lpad+'--nentries? '+rev+'# feedback how many entries are tracked in total' e rev+N+'The above commands should be commandline arguments, '\ 'such as: "'+teal('envi full')+rev+'".' e e "#{rev}Do note that you can prefix the above commands via "\ "a leading --, of course." e # ======================================================================= # # Show a simple usage example next: # ======================================================================= # e 'Usage example:' e e steelblue( ' envi --version' ) e e rev+'If you wish to show only some programs, you could '\ 'use the following:' e e steelblue( ' envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc' ) e steelblue( ' envi --use-these-programs=:lfs' ) e true_rev # Reset via Colours.rev here. do_exit_the_program end |
#do_show_only_the_operating_system ⇒ Object
#
do_show_only_the_operating_system
To invoke this method, try:
envi --os?
#
867 868 869 870 |
# File 'lib/environment_information/class/class.rb', line 867 def clear_old_dataset add(:operating_system) end |
#do_show_only_the_xorg_components ⇒ Object
#
do_show_only_the_xorg_components
This method will essentially clear the old dataset before adding all xorg-components to the display-part of this class.
The components that are appended here, are defined in the file constants/array_tracked_components.rb - so if you wish to add new xorg-related entries, you should modify the entries in that .rb file.
#
1128 1129 1130 1131 1132 |
# File 'lib/environment_information/class/class.rb', line 1128 def do_show_only_the_xorg_components clear_old_dataset do_not_show_the_ruby_components add(:all_xorg_components) end |
#do_sort_alphabetically(display_these_components = display_which_components? ) ⇒ Object
#
do_sort_alphabetically (sort tag)
Some entries are Symbols, which is why we have to call .to_s in the method here.
#
1540 1541 1542 1543 1544 1545 |
# File 'lib/environment_information/class/class.rb', line 1540 def do_sort_alphabetically( display_these_components = display_which_components? ) _ = display_these_components.sort_by {|name, version| name.to_s } set_main_array(_) end |
#dont_show_ruby_stuff ⇒ Object Also known as: show_no_ruby
#
dont_show_ruby_stuff
Disable showing ruby + gem information.
#
1608 1609 1610 |
# File 'lib/environment_information/class/class.rb', line 1608 def dont_show_ruby_stuff # Dont show ruby stuff. @show_ruby_version_and_gem_version = false end |
#e(i = '') ⇒ Object
#
e (e tag)
The e() method is the general output-method for this class.
#
1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 |
# File 'lib/environment_information/class/class.rb', line 1713 def e(i = '') unless @be_silent if use_one_line_to_show_the_result? # This will just use "print". ::EnvironmentInformation.ee(i) else ::EnvironmentInformation.e( i, display_everything_in_short_format: @display_everything_in_short_format ) end end end |
#enable_colours ⇒ Object
#
enable_colours
#
69 70 71 |
# File 'lib/environment_information/class/colours.rb', line 69 def enable_colours ::EnvironmentInformation.use_colours = true end |
#enable_sort_alphabetically ⇒ Object
#
enable_sort_alphabetically
#
1579 1580 1581 |
# File 'lib/environment_information/class/class.rb', line 1579 def enable_sort_alphabetically @internal_hash[:sort_alphabetically] = true end |
#gui? ⇒ Boolean
#
gui?
#
995 996 997 |
# File 'lib/environment_information/class/class.rb', line 995 def gui? @runmode == :gui end |
#is_a_registered_component?(i) ⇒ Boolean Also known as: is_an_allowed_entry?
#
is_a_registered_component?
#
785 786 787 |
# File 'lib/environment_information/class/class.rb', line 785 def is_a_registered_component?(i) ::EnvironmentInformation.is_this_component_included?(i) end |
#is_rbt_available_and_may_we_try_to_use_rbt? ⇒ Boolean
#
is_rbt_available_and_may_we_try_to_use_rbt?
#
1488 1489 1490 |
# File 'lib/environment_information/class/class.rb', line 1488 def is_rbt_available_and_may_we_try_to_use_rbt? is_rbt_available? and may_we_try_to_use_rbt? end |
#is_this_program_included?(i) ⇒ Boolean
#
is_this_program_included?
#
1263 1264 1265 |
# File 'lib/environment_information/class/class.rb', line 1263 def is_this_program_included?(i) ::EnvironmentInformation.is_this_program_included?(i) end |
#lightgreen(i = '') ⇒ Object
#
lightgreen
#
249 250 251 252 253 254 |
# File 'lib/environment_information/class/colours.rb', line 249 def lightgreen(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.lightgreen(i) end return i end |
#limegreen(i = '') ⇒ Object
#
limegreen
#
229 230 231 232 233 234 |
# File 'lib/environment_information/class/colours.rb', line 229 def limegreen(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.limegreen(i) end return i end |
#load_dataset_from_this_file(i) ⇒ Object Also known as: try_to_load_dataset_from_this_file, try_to_read_content_from_this_file
#
load_dataset_from_this_file
This method can be used to read which programs will be displayed from a local file, rather than rely on the pre-set default.
#
1327 1328 1329 1330 1331 1332 1333 1334 1335 |
# File 'lib/environment_information/class/class.rb', line 1327 def load_dataset_from_this_file(i) if File.exist? i File.readlines(i).map {|entry| entry.delete('-').strip # ← Clean up the input a little bit. } else opnn; e "No file exists at `#{sfile(i)}`." end end |
#main_hash? ⇒ Boolean
#
main_hash?
#
1789 1790 1791 |
# File 'lib/environment_information/class/class.rb', line 1789 def main_hash? ::EnvironmentInformation.hash? end |
#may_we_try_to_use_rbt? ⇒ Boolean
#
may_we_try_to_use_rbt?
#
914 915 916 |
# File 'lib/environment_information/class/class.rb', line 914 def may_we_try_to_use_rbt? @internal_hash[:may_we_try_to_use_rbt] end |
#mediumpurple(i = '') ⇒ Object
#
mediumpurple
#
259 260 261 262 263 264 |
# File 'lib/environment_information/class/colours.rb', line 259 def mediumpurple(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.mediumpurple(i) end return i end |
#menu(i = @commandline_arguments) ⇒ Object
#
menu (menu tag)
This method constitutes the “menu” interface for class EnvironmentInformation. It usually deals with the commandline-given arguments stored in ARGV.
#
2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 |
# File 'lib/environment_information/class/class.rb', line 2044 def ( i = @commandline_arguments ) if i.is_a? Array i.each {|entry| (entry) } else case i # case tag # ===================================================================== # # === envi --really-all # # This entry point is for really showing everything. # ===================================================================== # when /^-?-?REALLY(_|-)?ALL$/i, /^-?-?compare(_|-)?program(_|-)?version$/i, /^-?-?compare(_|-)?to(_|-)?program(_|-)?versions$/i, /^-?-?do(_|-)?compare(_|-)?program(_|-)?version$/i, /^-?-?really(_|-)?everything$/i # === envi --really-everything clear_old_dataset add_default_linux_programs add_ruby_and_rubygems do_show_almost_everything_excluding_the_default_linux_programs do_compare_the_program_version # ===================================================================== # # === envi --one-liner # # A more complex usage example may be this: # # envi --rall --oneliner # # ===================================================================== # when /^-?-?one(-|_)?liner$/i # === envi --oneliner @internal_hash[:use_one_line_to_show_the_result] = true # This is different to the short-format. # ===================================================================== # # === envi --short # ===================================================================== # when /^-?-?short$/i, /^-?-?display(-|_)?short(-|_)?format$/i, /^-?-?do(-|_)?display(-|_)?in(-|_)?a(-|_)?short(-|_)?format$/i do_display_in_a_short_format # ===================================================================== # # === envi --sort-alphabetically # # This entry point can also be combined, such as in: # # envi --show-everything --sort-alphabetically # # ===================================================================== # when /^-?-?sort(-|_)?alphabetically$/i, /^-?-?sort$/i, /^-?-?alphabetically$/i, /^-?-?alphabet$/i enable_sort_alphabetically # ===================================================================== # # === envi --use-colours? # ===================================================================== # when /^-?-?use(-|_)?colou?rs\??$/i e 'Will colours be used? '+ ::EnvironmentInformation.verbose_truth( ::EnvironmentInformation.use_colours?.to_s ) do_not_run @do_exit_the_program = true # ===================================================================== # # === :do_show_everything # # An alternative way to make use of this entry point is via: # # envi --do-show-everything # envi --show-everything # envi --all # # ===================================================================== # when :do_show_everything, :show_really_everything, /^-?-?do(_|-)?show(_|-)?everything$/i, /^-?-?show(-|_)?everything$/i, /^-?-?show(-|_)?full(-|_)?information$/i, /^-?-?everything$/i, /^-?-?rall$/i, /^-?-?ALL$/i do_show_everything @run_already = true # ===================================================================== # # === envi --kdeversions? # # Note that this variant depends on another gem, called "rbt", and # the associated RBT namespace. # ===================================================================== # when /^-?-?kde(_|-)?versions\??$/i, /^-?-?kde\??$/i report_the_installed_KDE_software_suite # ===================================================================== # # === envi --registered-components? # ===================================================================== # when /^-?-?registered(_|-)?components\??$/i, /^-?-?available\??$/i do_not_run_already show_the_registered_components @do_exit_the_program = true # ===================================================================== # # === envi --additional=php # # This entry point allows us to show additional programs. # # Another usage example: # # envi --additional=php,python,perl # # ===================================================================== # when /^-?-?additional=(.+)$/i, /^-?-?add=(.+)$/i _ = $1.to_s.dup add(_) # ===================================================================== # # === envi --n_entries? # ===================================================================== # when /^-?-?n(_|-)?entries\??$/i, /^-?-?n(_|-)?programs\??$/i # envi --nprograms? show_n_registered_entries # === envi --n_entries @do_exit_the_program = true # ===================================================================== # # === envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc,grep,gzip,linux,make,m4,patch,perl,python,sed,tar,makeinfo,xz # === envi --use-these-programs=:lfs # # This entry point can be used to display a certain subset of # programs, at the user's discretion. # ===================================================================== # when /^-?-?use(-|_)?these(-|_)?programs=(.+)$/i # === $3 # =================================================================== # # First clear (aka reset) the main dataset. # =================================================================== # clear_old_dataset match = $3.to_s.dup add(match) # ===================================================================== # # === envi --show-remote-url # # This entry point will also show the remote URL to the # program at hand. # ===================================================================== # when /^-?-?show(_|-)?remote(_|-)?url$/i do_report_the_remote_urls # ===================================================================== # # === envi --help # # This entry point will always show help-related information. # ===================================================================== # when /^-?-?help$/i do_show_help # ===================================================================== # # === envi --no-save # # Skip saving into a local file through this entry point. # # Invocation example: # # envi --lfs --no-save # # ===================================================================== # when /^-?-?no(_|-)?save$/i do_not_save_anything # ===================================================================== # # === envi --os? # ===================================================================== # when /^-?-?OS\??$/i, /^-?-?show(-|_)?only(-|_)?the(-|_)?operating(-|_)?system$/i show_no_ruby # ===================================================================== # # === envi --help # ===================================================================== # when /help/i @show_help = true # ===================================================================== # # === envi --clear # # This entry point will simply clear the old dataset. # # This can be used to only display a few components, such as: # # envi --clear --python --ruby --perl # # ===================================================================== # when /^-?-?clear$/i, /^-?-?clear(_|-)?old(_|-)?dataset$/i clear_old_dataset # ===================================================================== # # === envi --sinatra # ===================================================================== # when /^-?-?sinatra$/i, /^-?-?www$/i start_the_sinatra_interface # ===================================================================== # # === envi --open # ===================================================================== # when /^-?-?open$/i, /^-?-?edit$/i open_this_file_in_editor # ===================================================================== # # === envi --lfs # ===================================================================== # when /^-?-?lfs$/i, /^-?-?lfs(_|-)?core(_|-)?programs$/i clear_old_dataset add(:lfs_core_programs) # ===================================================================== # # === envi openssl # ===================================================================== # when /^-?-?openssl$/, 'ssl' add(:openssl) # ===================================================================== # # === envi --science # ===================================================================== # when /^-?-?science$/ clear_old_dataset add(:science_cluster) # ===================================================================== # # === envi --nocolours # # This entry point can be used to disable usage of colours. # ===================================================================== # when /^-?-?nocolours/,'2', /^-?-?no(-|_)?colou?rs$/i, /^-?-?nocol$/i, /^-?-?disable(-|_)?colou?rs$/i, # === envi --really-all --disable-colours :disable_colours disable_colours # ===================================================================== # # === envi --version # ===================================================================== # when *ARRAY_VERSION report_version # ===================================================================== # # === envi --gui # ===================================================================== # when /^-?-?gui$/i, /^-?-?gtk$/i, /^-?-?start(-|_)?gtk$/i start_gtk_component # ===================================================================== # # === envi --replay # ===================================================================== # when /^-?-?replay$/i require 'environment_information/toplevel_methods/replay_from_the_stored_file.rb' ::EnvironmentInformation.replay_from_the_stored_file # ===================================================================== # # === envi --be_silent_no_colours # # Not sure why the following entry point exists, but I will retain it # for the time being. # ===================================================================== # when /^-?-?be(_|-)?silent(_|-)?no(_|-)?colours$/ disable_colours do_not_display_the_result do_show_everything # ===================================================================== # # This entry point is mostly for internal use, e. g. to pass # in Symbols to menu(). # ===================================================================== # when :be_silent_no_colours_everything, :be_silent_and_no_colours, :be_silent_no_colours, :full_be_silent disable_colours do_show_everything do_not_display_the_result # ===================================================================== # # === envi --be_silent # ===================================================================== # when /^-?-?be(_|-)?silent$/i # === envi --be-silent do_not_display_the_result do_show_everything # ===================================================================== # # === envi --work-on-programs-directory-only # ===================================================================== # when /^-?-?work(-|_)?on(-|_)?programs(-|_)?directory(-|_)?only$/i, /^-?-?work(-|_)?on(-|_)?the(-|_)?programs(-|_)?directory(-|_)?only$/i work_on_the_programs_directory_only # ===================================================================== # # === envi --do-save # ===================================================================== # when /^save$/i, /^-?-?do(_|-)?save$/i @store_the_results_into_local_files = true # ===================================================================== # # === envi --asciitable # ===================================================================== # when /^-?-?asciitable$/i, 'table','1' use_ascii_table if ASCIITABLE_IS_AVAILABLE # ===================================================================== # # === envi --read-from-this-file=/Depot/j/display_these_programs.md # === envi --file=/Depot/j/display_these_programs.md # === envi --input-from=/Depot/j/display_these_programs.md # ===================================================================== # when /^-?-?read(-|_)?from(-|_)?this(-|_)?file=(.+)$/i, # <- And this has $4 /^-?-?file=(.+)$/i, # <- This has only $1 /^-?-?input(-|_)?from=(.+)$/i # <- This has $2 _ = $1.to_s.dup _ = $2.to_s.dup if $2 _ = $4.to_s.dup if $4 clear_old_dataset set_use_this_as_main_input( load_dataset_from_this_file(_) ) # ===================================================================== # # === envi --no-yaml-file # ===================================================================== # when /^-?-?no(-|_)?yaml(-|_)?file$/i, /^-?-?no(-|_)?local(-|_)?file$/i @store_the_results_into_local_files = false # ===================================================================== # # === envi noruby # ===================================================================== # when /^-?-?noruby$/i, 'show_no_ruby', 'classic', 'naked', '3', 'minimal' show_no_ruby # ===================================================================== # # === envi --show-all # ===================================================================== # when /^-?-?show(-|_)?all$/i, /^-?-?all$/i, /^-?-?full$/i, /^-?-?everything$/i, # === envi --everything /^-?-?information$/i, 'f', '4' do_show_everything # <- Just to be sure. # ===================================================================== # # === :be_silent # ===================================================================== # when /^-?-?be(_|-)?silent$/i, :be_silent # We will be silent, but we will still show everything. do_not_display_the_result do_show_everything # ===================================================================== # # === envi --compare_programs # # This entry point allows us to compare the program versions with # the one registered in RBT. # ===================================================================== # when *ARRAY_COMPARE_PROGRAM_VERSIONS do_compare_the_program_version # ===================================================================== # # === envi --generate-html-file # # This entry point can be used to generate a local .html file. # ===================================================================== # when /^-?-?generate(-|_)?html(-|_)?file$/i, /^-?-?html$/i # envi --HTML @internal_hash[:generate_a_html_file] = true set_runmode_html # Set it here again, just in case. do_show_everything # ===================================================================== # # === envi --show-components? # ===================================================================== # when /^-?-?show(-|_)?components\??$/i e "#{true_rev}The following components will be shown on a default run:" e show_these_components?.each {|this_component| if this_component.is_a? Array this_component = this_component.first end e " - #{steelblue(this_component)}#{true_rev}" } e exit # ===================================================================== # # === :do_not_run_yet # # Invocation example: # # envi --do-not-run-yet # # ===================================================================== # when /^-?-?-do(-|_)?not(-|_)?run(-|_)?yet$/i, # === envi --do-not-run-yet :do_not_run_yet, :dont_run_yet, :default # This is the default variant. @run_already = false # ===================================================================== # # === envi --pkgconfig # # Show all pkgconfig entries - but only these. # ===================================================================== # when /^-?-?pkg(-|_)?config$/i clear_old_dataset add(:pkgconfig_entries) # ===================================================================== # # === envi --xorg-components # # This entry point is for when the user only wants to show the # xorg-components on the local computer system. # ===================================================================== # when /^-?-?xorg(_|-)?components$/i, /^-?-?xorg$/i, /^-?-?show(_|-)?xorg(_|-)?components$/i do_show_only_the_xorg_components else # else tag # =================================================================== # # It is better to report that the given commandline-input as # not found, so this will be reported. Before we can do so, we # will first check whether the user wanted to pass some # existing/registered component nonetheless. # # This clause can be checked via something like this: # # envi --bash # envi --brotli # # =================================================================== # if is_a_registered_component?(i.delete('-')) # ================================================================= # # The next line has been added in August 2022. Not sure if we # retain it or not - either way the future will show. # ================================================================= # @array_report_these_programs.clear # Clear the old result first. do_not_store_anything add( i.delete('-') ) else # ================================================================= # # Only enter the report-section if we do NOT want to exit early. # ================================================================= # do_show_help if show_help? # Or: # e 'Unhandled command input (in file environment_information/class/menu.rb): ' # e # e " #{sfancy(i)}" # e end end end end |
#olive(i = '') ⇒ Object
#
olive
#
219 220 221 222 223 224 |
# File 'lib/environment_information/class/colours.rb', line 219 def olive(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.olive(i) end return i end |
#olivedrab(i = '') ⇒ Object
#
olivedrab
This one will be used for the right-hand side.
#
209 210 211 212 213 214 |
# File 'lib/environment_information/class/colours.rb', line 209 def olivedrab(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.olivedrab(i) end return i end |
#open_this_file_in_editor ⇒ Object
#
open_this_file_in_editor
#
1105 1106 1107 1108 |
# File 'lib/environment_information/class/class.rb', line 1105 def open_this_file_in_editor _ = "bluefish #{THIS_FILE}" e _; system _; exit end |
#operating_system? ⇒ Boolean Also known as: return_version_of_operating_system
#
operating_system?
To quickly test this method, try:
EnvironmentInformation::EnvironmentInformation.new { :do_not_run_yet }.
#
1317 1318 1319 |
# File 'lib/environment_information/class/class.rb', line 1317 def ::EnvironmentInformation.send(__method__) end |
#opnn ⇒ Object Also known as: opn
#
opnn
#
1586 1587 1588 1589 1590 1591 1592 1593 1594 |
# File 'lib/environment_information/class/class.rb', line 1586 def opnn if TRY_TO_MAKE_USE_OF_THE_OPN_GEM_IF_IT_IS_AVAILABLE and Object.const_defined?(:Opn) Opn.opn({ namespace: NAMESPACE, use_colours: use_colours? }) end end |
#orange(i = '') ⇒ Object
#
orange
#
277 278 279 280 |
# File 'lib/environment_information/class/colours.rb', line 277 def orange(i = '') return ::Colours.orange(i) if use_colours? return i end |
#ram? ⇒ Boolean
#
ram?
#
1386 1387 1388 |
# File 'lib/environment_information/class/class.rb', line 1386 def ram? ::EnvironmentInformation.ram? end |
#register_sigint ⇒ Object
#
register_sigint
#
1599 1600 1601 |
# File 'lib/environment_information/class/class.rb', line 1599 def register_sigint Signal.trap('SIGINT') { e; exit } end |
#register_the_available_components_and_show_them_at_once(report_these_programs = @array_report_these_programs) ⇒ Object Also known as: display, report_result, display_the_components, display_the_dataset, work_through_the_programs, build_up_the_main_string, display_the_main_components, report
#
register_the_available_components_and_show_them_at_once (report tag)
This method can be used to register information about the various components. It will also instantly display the component at hand, to avoid “lagging” behaviour on the commandline.
#
1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 |
# File 'lib/environment_information/class/class.rb', line 1800 def register_the_available_components_and_show_them_at_once( report_these_programs = @array_report_these_programs ) if report_these_programs.empty? opn; e 'There are no components that can be displayed.' # And this ends here. else # ===================================================================== # # Always clear the main Array before proceeding here. # ===================================================================== # clear_missing_components toplevel_hash = ::EnvironmentInformation.hash? hash_use_this_for_the_query = ::EnvironmentInformation.all_the_queries # ===================================================================== # # Iterate over the registered programs next. # ===================================================================== # report_these_programs.each {|this_program| # =================================================================== # # First, determine the left_side and the right_side. # =================================================================== # left_side = this_program.to_s.dup right_side = nil case this_program # =================================================================== # # === RAM # =================================================================== # when :ram, /^RAM$/i right_side = ram?.to_s.dup right_side = right_side.dup if right_side.frozen? # ================================================================= # # Append 'MB RAM' in orange colour next, with some padding. # This is just a small visual "enhancement" that I quite like. # ================================================================= # right_side << orange(' MB RAM') # =================================================================== # # === Rubygems installation directory # =================================================================== # when :rubygems_installation_directory, /^rubygems( |_)?installation( |_)?directory\??$/i right_side = rubygems_installation_directory? # =================================================================== # # === cflags # =================================================================== # when :cflags, /^cflags$/i, /^cflags(_|-| )?in(_|-| )?use$/i right_side = cflags_in_use? # =================================================================== # # === Screen resolution # # This is a bit "special" in the sense that we will colourize # the middle 'x', if found, and if colours are used. # =================================================================== # when :screen_resolution, /^screen( |_)?resolution$/i right_side = screen_resolution? if right_side.include?('x') and use_colours? splitted = right_side.split('x') right_side = colourize_this_in_the_right_side_colour(splitted.first)+ royalblue('x')+ colourize_this_in_the_right_side_colour(splitted.last) end # =================================================================== # # === CPU Model # =================================================================== # when /^cpuinfo$/i, /^CPU(_|-| )?Model/ right_side = cpu_model? # =================================================================== # # === Operating system bit type # =================================================================== # when /^operating(_|-| )?system(_|-| )?bit(_|-| )?type$/i right_side = bit_type? # =================================================================== # # === Operating system # =================================================================== # when /^Operating(_|-| )?system$/i, :operating_system right_side = ::EnvironmentInformation. end # =================================================================== # # Find the corresponding entry next while including aliases: # =================================================================== # this_program = this_program.to_sym # These are stored as symbol. this_program = ::EnvironmentInformation.return_alias_to(this_program) _ = hash_use_this_for_the_query[this_program] # This holds the instruction for the program at hand. if hash_use_this_for_the_query.has_key? this_program if _.to_s.start_with? 'pkg' # =============================================================== # # === :pkgconfig # # This is by far the simplest solution. # =============================================================== # right_side = @pkg_config_query.return_version_of(this_program) add_this_to_the_toplevel_hash(left_side, right_side) # ================================================================= # # === :version # # Here we will handle simple versions, e. g. "lftp --version" # entries, and similar. # ================================================================= # elsif (_ == :version) or (_ == :short_version) # =============================================================== # # Pass into class EnvironmentInformation::Queries::SimpleVersion next: # =============================================================== # right_side = @simple_version_query.return_version_of(this_program) add_this_to_the_toplevel_hash(left_side, right_side) # ================================================================= # # The next entry is specifically for the program called # double-conversion: # ================================================================= # elsif _ == :special_entry_for_doubleconversion right_side = nil target_file = '/usr/lib/cmake/double-conversion/double-conversionConfigVersion.cmake' if File.exist? target_file dataset = File.read(target_file) right_side = dataset.scan( /PACKAGE_VERSION "(.+)"/ ).flatten.first.to_s end if right_side add_this_to_the_toplevel_hash(left_side, right_side) end else # =============================================================== # # Else we will pass through class ComplexVersion: # =============================================================== # right_side = @complex_version_query.return_version_of(this_program) add_this_to_the_toplevel_hash(left_side, right_side) end # =================================================================== # # The next clause has been written specifically to allow querying # the mate-desktop components. # =================================================================== # elsif toplevel_hash.has_key?(this_program) and toplevel_hash[this_program] # ← This is thus non-nil. right_side = toplevel_hash[this_program] end if right_side.nil? register_unavailable_program(this_program) end # =================================================================== # # === @internal_hash[:report_the_remote_urls] # # Next, honour @internal_hash[:report_the_remote_urls] if it is # set to true. # =================================================================== # if report_the_remote_urls? and is_rbt_available? and RBT.respond_to?(:remote_url_for?) version = ''.dup _ = this_program.to_s.delete('-').downcase.strip.to_sym if RBT.does_include?(_) remote_url = RBT.remote_url_for?(_, :return_as_string) if is_a_registered_component? _ if version.frozen? version = version.dup end version << lightgreen(remote_url) if right_side # We can only continue if the program is available. # In theory we could show the URL anyway, but for the time # being, at the least, we will not show the URL. right_side = right_side.dup if right_side.frozen? right_side << " #{olive('→')} #{version}" end end end end # =================================================================== # # The next method is defined in base.rb. # =================================================================== # report_left_right( left_side, right_side, :default_colour, :default_colour, :default_colour, !use_one_line_to_show_the_result? ) # =================================================================== # # Next compare the program versions with the local versions. # =================================================================== # if compare_program_versions? and is_rbt_available_and_may_we_try_to_use_rbt? and RBT.respond_to?(:swift_return_version_of_this_program) and RBT.does_include?(left_side.to_s.strip) # ================================================================= # # Example: # # RBT.swift_return_version_of_this_program(:gettext) # # ================================================================= # registered_local_version = RBT.swift_return_version_of_this_program( left_side.to_s.strip.to_sym ).to_s # ================================================================= # # We ignore gtk2 when it comes to the version-check. # ================================================================= # next if this_program == :gtk2 # ================================================================= # # Next use Gem::Version to compare them, but not if the version # is nil. # ================================================================= # unless right_side.nil? # =============================================================== # # The .delete('v') is specifically for libuv or node. # =============================================================== # registered_local_version = registered_local_version.to_s. delete('v'). tr('_','.') a = compare_via_gem_version(registered_local_version) b = compare_via_gem_version(right_side) if a and b and (a > b) result = ''.dup if use_one_line_to_show_the_result? result << mediumaquamarine(' ← ') else # else this is the default. result << lightblue(' ^^^^ ') end result << slateblue('This program could be '\ 'upgraded, to the version ')+ steelblue(registered_local_version) e result end if registered_local_version =~ /\d+/ end end } end end |
#register_unavailable_program(i) ⇒ Object Also known as: register_not_found
#
register_unavailable_program
Programs that were not be found can be registered through this method.
#
1369 1370 1371 1372 |
# File 'lib/environment_information/class/class.rb', line 1369 def register_unavailable_program(i) i = i.to_sym # Let's store only Symbols. @array_unavailable_programs << i end |
#report_the_installed_KDE_software_suite ⇒ Object
#
report_the_installed_KDE_software_suite
#
723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 |
# File 'lib/environment_information/class/class.rb', line 723 def report_the_installed_KDE_software_suite begin require 'rbt/toplevel_methods/toplevel_methods.rb' require 'rbt/toplevel_methods/try_to_return_a_special_compile_component.rb' require 'rbt/toplevel_methods/swift_return_version_of_this_program.rb' array = RBT.return_kde_apps append_this = ''.dup if array and !array.empty? e 'Now working through all registered KDE applications, trying to' e 'show their version on the commandline:' e array.each {|this_program| append_this.clear # ================================================================= # # The next line of code was added in August 2022 because ksmoothdock # is misbehaving. At a later time we may have to review this; # ideally we should not need any such ad-hoc exceptions ever. # ================================================================= # next if this_program == 'ksmoothdock' print gold( (' '+this_program+':').ljust(40) ) cmd_to_use = "#{this_program} --version 2>&1" version = `#{cmd_to_use}` if version.include? "command not found\n" version = THE_PROGRAM_IS_NOT_INSTALLED_OR_COULD_NOT_BE_FOUND else if version # Remove the name of the program here e. g. "kcachegrind 21.12.1" version.sub!(/#{this_program}/,'') most_recent_version = ::RBT.swift_return_version_of_this_program(this_program.strip.downcase) if RBT.is_this_version_higher_than_that_version?( most_recent_version.to_s, version.to_s, :do_not_report_any_errors ) append_this << orange( "\n ^^^ This program could "\ "be updated to version "+ most_recent_version.to_s ) end end end version.strip! if version.include? 'The program is not installed' e lightblue(version)+append_this else e steelblue(version)+append_this end } e else e 'The array appears to be empty.' end exit rescue LoadError; end end |
#report_the_remote_urls? ⇒ Boolean
#
report_the_remote_urls?
#
1495 1496 1497 |
# File 'lib/environment_information/class/class.rb', line 1495 def report_the_remote_urls? @internal_hash[:report_the_remote_urls] end |
#report_version ⇒ Object
#
report_version
#
1760 1761 1762 1763 1764 |
# File 'lib/environment_information/class/class.rb', line 1760 def report_version require 'environment_information/toplevel_methods/menu.rb' ::EnvironmentInformation.report_version @do_exit_the_program = true end |
#reset ⇒ Object
#
reset (reset tag)
#
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 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 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 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 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
# File 'lib/environment_information/class/class.rb', line 185 def reset # ======================================================================= # # === @internal_hash # ======================================================================= # @internal_hash = {} # ======================================================================= # # === :report_the_remote_urls # # If this instance variable is set to true then the remote URLs will # be shown as well, on the commandline. # ======================================================================= # @internal_hash[:report_the_remote_urls] = false # ======================================================================= # # === :try_to_rename_the_kde_konsole_tab # # The following instance variable will determine as to whether we will # try to make use of the KDE Konsole and rename the tab of the konsole # there. # # Since as of October 2018 we will not use the KDE konsole by default # anymore. This may change at a later moment in time, though. # ======================================================================= # @internal_hash[:try_to_rename_the_kde_konsole_tab] = false # ======================================================================= # # === :generate_a_html_file # # If the next instance variable is set to true then a html file will # be generated. By default this will not happen, though. # ======================================================================= # @internal_hash[:generate_a_html_file] = false # ======================================================================= # # === :store_the_results_into_local_files # # If the following variable is set to true then the project will # generate local files too, e. g. yaml files and what not. # ======================================================================= # @internal_hash[:store_the_results_into_local_files] = true # ======================================================================= # # === :use_ascii_table # # Whether to use an ASCII table or whether we will not: # ======================================================================= # @internal_hash[:use_ascii_table] = false # ======================================================================= # # === :table # ======================================================================= # @internal_hash[:table] = nil # The ascii table. # ======================================================================= # # === :compare_program_versions # # This instance variable can be used to also compare the program # versions, if the RBT project is available. # # By default this will not be done, though. # ======================================================================= # @internal_hash[:compare_program_versions] = false # ======================================================================= # # === :use_one_line_to_show_the_result # ======================================================================= # @internal_hash[:use_one_line_to_show_the_result] = false # ======================================================================= # # === :sort_alphabetically # # Whether to sort the main Hash alphabetically or not. # ======================================================================= # @internal_hash[:sort_alphabetically] = false # ======================================================================= # # === @pkg_config_query # ======================================================================= # @pkg_config_query = ::EnvironmentInformation::Queries::PkgConfig.new # ======================================================================= # # === @simple_version_query # ======================================================================= # @simple_version_query = ::EnvironmentInformation::Queries::SimpleVersion.new # ======================================================================= # # === @complex_version_query # ======================================================================= # @complex_version_query = ::EnvironmentInformation::Queries::ComplexVersion.new # ======================================================================= # # === @array_report_these_programs # # This Array denotes which programs are to be reported. # # By default it is empty. # ======================================================================= # @array_report_these_programs = [] # ======================================================================= # # === @array_unavailable_programs # # Programs which could not be found can be registered into the following # Array. # ======================================================================= # @array_unavailable_programs = [] # ======================================================================= # # === @runmode # # The @runmode variable can be :commandline or :gui or :www. # ======================================================================= # @runmode = :commandline # ======================================================================= # # === @show_everything # # If the following instance variable is set to true then this class # will try to show every registered (and thus, available) component. # # By default this is not wanted, so it is disabled. The user has to # specifically enable this option via the commandline, if so # desired, and thus overrule this default value. # ======================================================================= # @show_everything = false # ======================================================================= # # === @display_result # # If the following instance variable is true, which is the case by # default, then this class will report to the user on the commandline. # # If it is set to false then nothing will be displayed; this is # useful when you only want to obtain the dataset, without # showing anything to the user. # ======================================================================= # @display_result = true # ======================================================================= # # === @be_silent # # By default, this class is not silent, meaning that it will display # information to the user. # ======================================================================= # @be_silent = false # ======================================================================= # # === :may_we_try_to_use_rbt # # Whether we may query RBT for additional help or not. By default # we will try to make use of RBT. # ======================================================================= # @internal_hash[:may_we_try_to_use_rbt] = true # ======================================================================= # # === @array_show_this_to_the_user # # The following Array can be used to show messages to the user. # ======================================================================= # @array_show_this_to_the_user = [] # ======================================================================= # # === @array_display_these_components # # This Array will display the components on the commandline. # # Take note that the order is important: the entries that appear first # will be displayed earlier. In other words: first entries will be # shown first as well. # ======================================================================= # @array_display_these_components = [] # ======================================================================= # # === @show_ruby_version_and_gem_version # # This instance variable determines whether class EnvironmentInformation # will display the ruby version and the gem version. # # By default we will do so, but there may be situations where this # may be unwanted, or not a good idea, such as in a minimal system # where no ruby is running, or if the user only wants to display # very little information. # ======================================================================= # @show_ruby_version_and_gem_version = true # ======================================================================= # # === @display_everything_in_short_format # # This variable determines whether we will use a compact-display or # whether there will be one-entry-per-program instead. # ======================================================================= # @display_everything_in_short_format = false # ======================================================================= # # === @run_already # # This variable will be true by default. # ======================================================================= # @run_already = true # ======================================================================= # # === @show_help # # If this variable is set to true, then we will only show help, then # exit the program. # ======================================================================= # @show_help = false # ======================================================================= # # === @do_exit_the_program # # The following variable can determine when we exit from this class. # By default we will not exist early. # ======================================================================= # @do_exit_the_program = false # ======================================================================= # # === @array_these_programs_not_up_to_date # # This Array can be used to save into a local file which programs # are not up to date. # ======================================================================= # if is_on_roebe? @array_these_programs_not_up_to_date = [] end end |
#result_as_array ⇒ Object
#
result_as_array
The lines that we will have inside of this method, may look like this:
" operating_system: GNU/Linux\n"
#
1159 1160 1161 1162 1163 1164 1165 1166 |
# File 'lib/environment_information/class/class.rb', line 1159 def result_as_array _ = dataset_as_string splitted = _.split("\n") splitted.map! {|inner_line| inner_line.split(': ').map {|entry| entry.strip } } return splitted end |
#return_all_ruby_components ⇒ Object
#
return_all_ruby_components
Combine three calls into one here - all related to ruby.
#
1617 1618 1619 1620 1621 1622 1623 |
# File 'lib/environment_information/class/class.rb', line 1617 def return_all_ruby_components i( ruby rubygems rubygems_installation_directory ) end |
#return_default_programs_on_linux ⇒ Object Also known as: return_default_programs_on_a_linux_computer, return_default_programs
#
return_default_programs_on_linux
This method should return the “main” programs on a linux computer, the most important entries.
#
802 803 804 |
# File 'lib/environment_information/class/class.rb', line 802 def return_default_programs_on_linux ARRAY_DEFAULT_PROGRAMS_ON_LINUX end |
#return_every_registered_component ⇒ Object
#
return_every_registered_component
#
1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 |
# File 'lib/environment_information/class/class.rb', line 1409 def return_every_registered_component array = ::EnvironmentInformation.tracked_programs?+ ::EnvironmentInformation.tracked_non_programs?+ ::EnvironmentInformation.science_cluster?+ ::EnvironmentInformation.xorg_components? array = array.flatten.uniq # ======================================================================= # # === The mate-desktop # # Since as of 31.03.2019 we will also try to show the mate-desktop # components if the RBT project is available/installed. # ======================================================================= # if can_we_query_the_mate_desktop? # ===================================================================== # # Keep in mind that this Array is nested, so the name is # included as well as the version. # ===================================================================== # _ = RBT.return_mate_desktop_version_array _.each {|a,b| # array << [a, b] array << a register_onto_the_main_hash(a, b) } end return array # Return our findings. end |
#return_remote_gtk2_version ⇒ Object
#
return_remote_gtk2_version
Be wary when using this method, as it may slow down the whole application, due to making remote web-based queries.
#
1457 1458 1459 |
# File 'lib/environment_information/class/class.rb', line 1457 def return_remote_gtk2_version ::EnvironmentInformation.return_remote_gtk2_version end |
#return_version_of_awk? ⇒ Boolean Also known as: return_version_of_awk
#
return_version_of_awk?
#
1221 1222 1223 |
# File 'lib/environment_information/class/class.rb', line 1221 def return_version_of_awk? ::EnvironmentInformation.send(__method__) end |
#return_version_of_binutils? ⇒ Boolean Also known as: return_version_of_binutils
#
return_version_of_binutils?
#
1228 1229 1230 |
# File 'lib/environment_information/class/class.rb', line 1228 def return_version_of_binutils? ::EnvironmentInformation.send(__method__) end |
#return_version_of_bison? ⇒ Boolean Also known as: return_version_of_bison
#
return_version_of_bison?
#
1298 1299 1300 |
# File 'lib/environment_information/class/class.rb', line 1298 def return_version_of_bison? ::EnvironmentInformation.send(__method__) end |
#return_version_of_boost? ⇒ Boolean Also known as: return_version_of_boost
#
return_version_of_boost?
#
1509 1510 1511 |
# File 'lib/environment_information/class/class.rb', line 1509 def return_version_of_boost? ::EnvironmentInformation.send(__method__) end |
#return_version_of_busyboxy? ⇒ Boolean Also known as: return_version_of_busyboxy
#
return_version_of_busyboxy?
#
1502 1503 1504 |
# File 'lib/environment_information/class/class.rb', line 1502 def return_version_of_busyboxy? ::EnvironmentInformation.send(__method__) end |
#return_version_of_coreutils? ⇒ Boolean Also known as: return_version_of_coreutils
#
return_version_of_coreutils?
#
1235 1236 1237 |
# File 'lib/environment_information/class/class.rb', line 1235 def return_version_of_coreutils? ::EnvironmentInformation.send(__method__) end |
#return_version_of_diffutils? ⇒ Boolean Also known as: return_version_of_diffutils
#
return_version_of_diffutils?
#
1242 1243 1244 |
# File 'lib/environment_information/class/class.rb', line 1242 def return_version_of_diffutils? ::EnvironmentInformation.send(__method__) end |
#return_version_of_flex? ⇒ Boolean Also known as: return_version_of_flex
#
return_version_of_flex?
#
1305 1306 1307 |
# File 'lib/environment_information/class/class.rb', line 1305 def return_version_of_flex? ::EnvironmentInformation.send(__method__) end |
#return_version_of_gcc? ⇒ Boolean Also known as: return_version_of_gcc
#
return_version_of_gcc?
#
1249 1250 1251 |
# File 'lib/environment_information/class/class.rb', line 1249 def return_version_of_gcc? ::EnvironmentInformation.send(__method__) end |
#return_version_of_glibc? ⇒ Boolean Also known as: return_version_of_glibc
#
return_version_of_glibc?
#
1270 1271 1272 |
# File 'lib/environment_information/class/class.rb', line 1270 def return_version_of_glibc? ::EnvironmentInformation.send(__method__) end |
#return_version_of_gnupg? ⇒ Boolean Also known as: return_version_of_gnupg
#
return_version_of_gnupg?
#
1291 1292 1293 |
# File 'lib/environment_information/class/class.rb', line 1291 def return_version_of_gnupg? ::EnvironmentInformation.send(__method__) end |
#return_version_of_grep? ⇒ Boolean Also known as: return_version_of_grep
#
return_version_of_grep?
#
1284 1285 1286 |
# File 'lib/environment_information/class/class.rb', line 1284 def return_version_of_grep? ::EnvironmentInformation.send(__method__) end |
#return_version_of_intltool? ⇒ Boolean Also known as: return_version_of_intltool
#
return_version_of_intltool?
#
1277 1278 1279 |
# File 'lib/environment_information/class/class.rb', line 1277 def return_version_of_intltool? ::EnvironmentInformation.send(__method__) end |
#return_version_of_linux_kernel? ⇒ Boolean Also known as: return_version_of_linux_kernel
#
return_version_of_linux_kernel?
#
1256 1257 1258 |
# File 'lib/environment_information/class/class.rb', line 1256 def return_version_of_linux_kernel? ::EnvironmentInformation.send(__method__) end |
#return_version_of_ruby? ⇒ Boolean Also known as: return_version_of_ruby
#
return_version_of_ruby?
#
1657 1658 1659 |
# File 'lib/environment_information/class/class.rb', line 1657 def return_version_of_ruby? ::EnvironmentInformation.send(__method__) end |
#return_version_of_rubygems? ⇒ Boolean Also known as: return_version_of_rubygems
#
return_version_of_rubygems?
#
1650 1651 1652 |
# File 'lib/environment_information/class/class.rb', line 1650 def return_version_of_rubygems? ::EnvironmentInformation.send(__method__) end |
#return_version_of_xvid? ⇒ Boolean Also known as: return_version_of_xvid
#
return_version_of_xvid?
#
1516 1517 1518 |
# File 'lib/environment_information/class/class.rb', line 1516 def return_version_of_xvid? ::EnvironmentInformation.send(__method__) end |
#rev ⇒ Object
#
rev
#
86 87 88 89 90 91 92 |
# File 'lib/environment_information/class/colours.rb', line 86 def rev if use_colours? Colours::GREEN else '' end end |
#royalblue(i = '') ⇒ Object
#
royalblue
#
167 168 169 170 171 172 |
# File 'lib/environment_information/class/colours.rb', line 167 def royalblue(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.royalblue(i) end return i end |
#rubygems_installation_directory? ⇒ Boolean
#
rubygems_installation_directory?
#
1665 1666 1667 |
# File 'lib/environment_information/class/class.rb', line 1665 def rubygems_installation_directory? ::EnvironmentInformation.rubygems_installation_directory? end |
#run ⇒ Object Also known as: feedback_everything, do_feedback_everything, output, feedback
#
run (run tag)
#
2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 |
# File 'lib/environment_information/class/class.rb', line 2495 def run # ======================================================================= # # Try to rename the KDE konsole first. This will happen on # roebe-systems only. # ======================================================================= # do_rename_kde_konsole # ======================================================================= # # ^^^ This check happens here again because menu() is allowed to # toggle this variable. # ======================================================================= # if @display_everything_in_short_format assign_components_for_the_short_format # Handle the short format here. end do_sort_alphabetically if sort_alphabetically? # ← Must come before the report-step. unless @do_exit_the_program # ===================================================================== # # === Report step # # We may only display the components if @display_result is true. # ===================================================================== # if @display_result register_the_available_components_and_show_them_at_once end end # ======================================================================= # # === Consider generating a .html file # # The user may want to generate a .html file, so the following # functionality allows the user to do so. This check should # ideally come before other local files are generated. # ======================================================================= # do_generate_a_html_file if @internal_hash[:generate_a_html_file] if commandline? and store_the_results_into_local_files? # ===================================================================== # # Only store local files if the variable # @store_the_results_into_local_files is true. # ===================================================================== # consider_storing_the_components_that_were_displayed consider_storing_which_programs_are_not_up_to_date end end |
#screen_resolution? ⇒ Boolean
#
screen_resolution?
#
1394 1395 1396 |
# File 'lib/environment_information/class/class.rb', line 1394 def screen_resolution? ::EnvironmentInformation.screen_resolution? end |
#seagreen(i = '') ⇒ Object
#
seagreen
#
197 198 199 200 201 202 |
# File 'lib/environment_information/class/colours.rb', line 197 def seagreen(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.seagreen(i) end return i end |
#set_be_silent(i = true) ⇒ Object
#
set_be_silent
#
1019 1020 1021 |
# File 'lib/environment_information/class/class.rb', line 1019 def set_be_silent(i = true) @be_silent = i end |
#set_main_array(i) ⇒ Object Also known as: set_display_these_components, set_use_this_as_main_input, set_report_these_programs, show_only_the_components_from_this_dataset
#
set_main_array
#
964 965 966 |
# File 'lib/environment_information/class/class.rb', line 964 def set_main_array(i) @array_report_these_programs = i end |
#set_runmode_gui ⇒ Object
#
set_runmode_gui
#
974 975 976 |
# File 'lib/environment_information/class/class.rb', line 974 def set_runmode_gui @runmode = :gui end |
#set_runmode_html ⇒ Object
#
set_runmode_html
#
981 982 983 |
# File 'lib/environment_information/class/class.rb', line 981 def set_runmode_html @runmode = :html end |
#set_use_colours(i = '') ⇒ Object
#
set_use_colours
#
55 56 57 |
# File 'lib/environment_information/class/colours.rb', line 55 def set_use_colours(i = '') ::EnvironmentInformation.set_use_colours(true) end |
#sfancy(i = '') ⇒ Object
#
sfancy
#
129 130 131 132 |
# File 'lib/environment_information/class/colours.rb', line 129 def sfancy(i = '') return ::Colours.sfancy(i) if use_colours? return i end |
#sfile(i) ⇒ Object
#
sfile
#
121 122 123 124 |
# File 'lib/environment_information/class/colours.rb', line 121 def sfile(i) return ::Colours.sfile(i) if use_colours? return i end |
#shall_we_really_store_which_programs_are_not_up_to_date? ⇒ Boolean
#
shall_we_really_store_which_programs_are_not_up_to_date?
This method will also honour whether the user is on a roebe-like system or whether the user is not.
#
1147 1148 1149 |
# File 'lib/environment_information/class/class.rb', line 1147 def shall_we_really_store_which_programs_are_not_up_to_date? is_on_roebe? and !@array_these_programs_not_up_to_date.empty? end |
#show_everything? ⇒ Boolean
#
show_everything?
#
1084 1085 1086 |
# File 'lib/environment_information/class/class.rb', line 1084 def show_everything? @show_everything end |
#show_help? ⇒ Boolean
#
show_help?
#
1690 1691 1692 |
# File 'lib/environment_information/class/class.rb', line 1690 def show_help? @show_help end |
#show_n_registered_entries ⇒ Object
#
show_n_registered_entries
Invoke this via:
envi --n_entries
#
887 888 889 890 891 |
# File 'lib/environment_information/class/class.rb', line 887 def show_n_registered_entries e "#{true_rev}The EnvironmentInformation project contains "\ "#{sfancy(::EnvironmentInformation.tracked_programs?.size)} "\ "#{true_rev}registered entries." end |
#show_the_registered_components(i = tracked_programs? ) ⇒ Object
#
show_the_registered_components
#
1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 |
# File 'lib/environment_information/class/class.rb', line 1737 def show_the_registered_components( i = tracked_programs? ) e e 'The following programs will be tracked:' e use_one_line_to_show_the_result = use_one_line_to_show_the_result? i.each_with_index {|this_program, index| index += 1 if use_one_line_to_show_the_result padded_index = index.to_s+') ' else padded_index = ' '+(index.to_s+') ').rjust(5) end colourized_and_padded_index = seagreen(padded_index) e colourized_and_padded_index+ steelblue(this_program) } e end |
#simp(i, use_colours = use_colours?) ) ⇒ Object
#
simp
#
47 48 49 50 |
# File 'lib/environment_information/class/colours.rb', line 47 def simp(i, use_colours = use_colours?) return ::Colours.simp(i) if use_colours return i end |
#slateblue(i = '') ⇒ Object
#
slateblue
#
177 178 179 180 181 182 |
# File 'lib/environment_information/class/colours.rb', line 177 def slateblue(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.slateblue(i) end return i end |
#sort_alphabetically? ⇒ Boolean
#
sort_alphabetically?
#
1572 1573 1574 |
# File 'lib/environment_information/class/class.rb', line 1572 def sort_alphabetically? @internal_hash[:sort_alphabetically] end |
#start_gtk_component ⇒ Object
#
start_gtk_component
To invoke this method from the commandline, do:
envi --start-gtk
#
1528 1529 1530 1531 1532 |
# File 'lib/environment_information/class/class.rb', line 1528 def start_gtk_component require 'environment_information/gui/gtk3/environment_information.rb' ::EnvironmentInformation.run_gtk @do_exit_the_program = true end |
#start_the_sinatra_interface ⇒ Object
#
start_the_sinatra_interface
#
1033 1034 1035 1036 |
# File 'lib/environment_information/class/class.rb', line 1033 def start_the_sinatra_interface require 'environment_information/www/sinatra_interface.rb' ::EnvironmentInformation.start_sinatra_interface end |
#steelblue(i = '') ⇒ Object
#
steelblue
#
187 188 189 190 191 192 |
# File 'lib/environment_information/class/colours.rb', line 187 def steelblue(i = '') if use_colours? and TRY_TO_USE_HTML_COLOURS i = ::Colours.steelblue(i) end return i end |
#store_the_results_into_local_files? ⇒ Boolean
#
store_the_results_into_local_files?
#
855 856 857 |
# File 'lib/environment_information/class/class.rb', line 855 def store_the_results_into_local_files? @internal_hash[:store_the_results_into_local_files] end |
#teal(i = '') ⇒ Object
#
teal
#
269 270 271 272 |
# File 'lib/environment_information/class/colours.rb', line 269 def teal(i = '') return ::Colours.teal(i) if use_colours? return i end |
#tracked_programs? ⇒ Boolean
#
tracked_programs?
#
792 793 794 |
# File 'lib/environment_information/class/class.rb', line 792 def tracked_programs? ARRAY_TRACKED_PROGRAMS end |
#true_rev ⇒ Object
#
true_rev
#
97 98 99 100 101 102 103 |
# File 'lib/environment_information/class/colours.rb', line 97 def true_rev if use_colours? Colours::REV else '' end end |
#try_to_rename_the_kde_konsole_tab? ⇒ Boolean
#
try_to_rename_the_kde_konsole_tab?
#
1091 1092 1093 |
# File 'lib/environment_information/class/class.rb', line 1091 def try_to_rename_the_kde_konsole_tab? @internal_hash[:try_to_rename_the_kde_konsole_tab] end |
#use_ascii_table ⇒ Object
#
use_ascii_table
We will display in ascii-table format here.
#
1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 |
# File 'lib/environment_information/class/class.rb', line 1070 def use_ascii_table disable_colours # Can't use colours right now. Perhaps at a later time. extend Terminal::Table::TableHelper @table = table ['Name', 'Version'] @table.style = { padding_left: 2, width: 110 # Set the width here. } @use_ascii_table = true end |
#use_colours? ⇒ Boolean
#
use_colours?
#
62 63 64 |
# File 'lib/environment_information/class/colours.rb', line 62 def use_colours? ::EnvironmentInformation.use_colours? end |
#use_one_line_to_show_the_result? ⇒ Boolean
#
use_one_line_to_show_the_result?
#
2488 2489 2490 |
# File 'lib/environment_information/class/class.rb', line 2488 def use_one_line_to_show_the_result? @internal_hash[:use_one_line_to_show_the_result] end |
#work_on_the_programs_directory_only(use_this_as_programs_directory = '/home/Programs/') ⇒ Object
#
work_on_the_programs_directory_only
This works on the /home/Programs/ directory directly.
Invocation example:
envi --work-on-programs-directory-only
#
935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 |
# File 'lib/environment_information/class/class.rb', line 935 def work_on_the_programs_directory_only( use_this_as_programs_directory = '/home/Programs/' ) # ======================================================================= # # 1) First, we have to determine which programs are available. # ======================================================================= # e "#{rev}Determining which programs are available at the prefix "\ "#{steelblue(use_this_as_programs_directory)}:" array_these_programs_are_available = [] tracked_programs?.each {|entry| target = "#{use_this_as_programs_directory}#{entry.capitalize}" if File.directory?(target) # =================================================================== # # In this case we know that this target exists. # =================================================================== # array_these_programs_are_available << entry end } # ======================================================================= # # 2) Checking these programs next. # ======================================================================= # clear_main_dataset add(array_these_programs_are_available) ::EnvironmentInformation.set_prefix_to_use(use_this_as_programs_directory) end |
#write_what_into(what, into) ⇒ Object
#
write_what_into
#
921 922 923 |
# File 'lib/environment_information/class/class.rb', line 921 def write_what_into(what, into) ::EnvironmentInformation.write_what_into(what, into) end |
#xorg_components? ⇒ Boolean Also known as: return_all_xorg_components
#
xorg_components?
#
1113 1114 1115 |
# File 'lib/environment_information/class/class.rb', line 1113 def xorg_components? ::EnvironmentInformation.xorg_components? end |