Class: EnvironmentInformation::Query
- Defined in:
- lib/environment_information/query/run.rb,
lib/environment_information/query/help.rb,
lib/environment_information/query/menu.rb,
lib/environment_information/query/misc.rb,
lib/environment_information/query/query.rb,
lib/environment_information/query/reset.rb,
lib/environment_information/query/constants.rb
Overview
EnvironmentInformation::Query
Constant Summary collapse
- 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/query/'\ 'query.rb'
- N_LEFT_PAD =
#
N_LEFT_PAD
#
35
- FILE_COLOURS =
#
FILE_COLOURS
#
"#{::EnvironmentInformation.project_base_dir?}"\ "yaml/colours.yml"
- NAMESPACE =
#
NAMESPACE
#
inspect
- QUERY_TO_USE_FOR_ALL_COMPONENTS =
#
QUERY_TO_USE_FOR_ALL_COMPONENTS
#
::EnvironmentInformation.query_to_use_for_all_components?
Constants inherited from Base
Class Method Summary collapse
-
.[](i = ARGV, &block) ⇒ Object
# === EnvironmentInformation::Query[] ========================================================================== #.
-
.colourize_and_pad_the_left_side(i) ⇒ Object
# === EnvironmentInformation.colourize_and_pad_the_left_side ========================================================================== #.
Instance Method Summary collapse
- #___report_the_findings_from_this ⇒ Object
-
#add(i = nil, primary_hash = primary_hash? ) ⇒ Object
(also: #show_these_entries, #set_additional, #update_version_for, #append, #append_this_to_main_string)
# === add (add tag).
-
#add_everything ⇒ Object
(also: #do_show_full_information, #show_full_information, #do_show_everything)
# === do_show_everything (everything tag, full tag).
-
#add_ruby_and_rubygems ⇒ Object
# === add_ruby_and_rubygems ========================================================================== #.
-
#add_the_commandline_arguments(i = commandline_arguments? ) ⇒ Object
# === add_the_commandline_arguments ========================================================================== #.
-
#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 ========================================================================== #.
-
#array_these_programs_not_up_to_date? ⇒ Boolean
# === array_these_programs_not_up_to_date? ========================================================================== #.
-
#array_unavailable_programs? ⇒ Boolean
# === array_unavailable_programs? ========================================================================== #.
-
#assign_components_for_the_short_format ⇒ Object
# === assign_components_for_the_short_format.
-
#can_we_query_the_mate_desktop? ⇒ Boolean
# === can_we_query_the_mate_desktop? ========================================================================== #.
-
#cflags_in_use? ⇒ Boolean
(also: #cflags?)
# === cflags_in_use? ========================================================================== #.
-
#check_for_nil_values(i, this_program = nil) ⇒ Object
# === check_for_nil_values ========================================================================== #.
-
#check_this_hash_for_unavailable_programs(hash) ⇒ Object
# === check_this_hash_for_unavailable_programs ========================================================================== #.
-
#clear_hash_and_missing_components ⇒ Object
# === clear_hash_and_missing_components ========================================================================== #.
-
#clear_missing_components ⇒ Object
# === clear_missing_components ========================================================================== #.
-
#clear_old_dataset ⇒ Object
(also: #clear_the_old_dataset)
# === clear_old_dataset ========================================================================== #.
-
#clear_the_main_dataset ⇒ Object
(also: #clear_main_dataset, #empty_main_dataset, #empty_main_array)
# === clear_the_main_dataset ========================================================================== #.
-
#clear_the_main_hash ⇒ Object
# === clear_the_main_hash ========================================================================== #.
-
#clear_toplevel_hash ⇒ Object
# === clear_toplevel_hash ========================================================================== #.
-
#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_which_programs_are_not_up_to_date(temp_dir = temp_dir?, , array_programs_that_are_not_up_to_date = array_these_programs_not_up_to_date? ) ⇒ Object
# === consider_storing_which_programs_are_not_up_to_date ========================================================================== #.
-
#dataset_as_string(main_hash = the_primary_hash? ) ⇒ Object
(also: #string?, #string, #main_string?, #stringified)
# === dataset_as_string.
-
#dataset_containing_all_tracked_programs? ⇒ Boolean
# === dataset_containing_all_tracked_programs? ========================================================================== #.
-
#disable_colours ⇒ Object
(also: #no_colours)
# === disable_colours.
-
#display_everything_in_short_format? ⇒ Boolean
# === display_everything_in_short_format? ========================================================================== #.
-
#display_left_side_then_the_right_side(the_left_side = nil, the_right_side = nil) ⇒ Object
# === display_left_side_then_the_right_side.
-
#display_result? ⇒ Boolean
# === display_result? ========================================================================== #.
-
#display_the_results_at_once? ⇒ Boolean
(also: #insta_show?)
# === display_the_results_at_once? ========================================================================== #.
-
#display_these_components(array = array_work_on_these_components? ) ⇒ Object
(also: #do_work_through_all_the_specified_components, #report, #report_result, #build_up_the_main_string, #register_the_available_components_and_show_them_at_once, #display_the_components, #display_the_dataset, #display_the_main_components, #report_the_findings_from_this)
# === display_these_components (report tag).
-
#display_this_component(name_of_the_component, hash = the_primary_hash?, , use_padding = true) ⇒ Object
(also: #do_report_this_component)
# === display_this_component.
-
#do_compare_the_program_version(be_verbose = false) ⇒ 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_exit_the_program? ⇒ Boolean
# === 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_store_anything_into_a_local_file ⇒ Object
# === do_not_store_anything_into_a_local_file ========================================================================== #.
-
#do_really_create_a_html_file ⇒ Object
# === do_really_create_a_html_file ========================================================================== #.
-
#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_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(i = work_on_which_components? ) ⇒ Object
# === do_sort_alphabetically (sort tag).
-
#do_store_the_results_into_local_files ⇒ Object
# === do_store_the_results_into_local_files ========================================================================== #.
-
#dont_show_ruby_stuff ⇒ Object
(also: #show_no_ruby, #do_not_show_the_ruby_components, #do_not_display_the_ruby_components)
# === dont_show_ruby_stuff.
-
#e(i = '') ⇒ Object
# === e (e tag).
-
#enable_colours ⇒ Object
# === enable_colours ========================================================================== #.
-
#enable_sort_alphabetically ⇒ Object
# === enable_sort_alphabetically ========================================================================== #.
-
#generate_a_html_file? ⇒ Boolean
# === generate_a_html_file? ========================================================================== #.
-
#gui? ⇒ Boolean
# === gui? ========================================================================== #.
-
#initialize(commandline_arguments = nil, run_already = true, &block) ⇒ Query
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? ========================================================================== #.
-
#left_side(i, use_colours = use_colours? ) ⇒ Object
# === left_side ========================================================================== #.
-
#main_hash? ⇒ Boolean
# === main_hash? ========================================================================== #.
-
#may_we_try_to_use_rbt? ⇒ Boolean
# === may_we_try_to_use_rbt? ========================================================================== #.
-
#menu(i = commandline_arguments? ) ⇒ Object
# === menu (menu tag).
-
#notify_the_user_that_there_are_no_components_that_can_be_displayed ⇒ Object
# === notify_the_user_that_there_are_no_components_that_can_be_displayed ========================================================================== #.
-
#open_this_file_in_editor ⇒ Object
# === open_this_file_in_editor ========================================================================== #.
-
#opnn ⇒ Object
(also: #opn)
# === opnn ========================================================================== #.
-
#program_not_found(i, use_colours = use_colours? ) ⇒ Object
# === program_not_found ========================================================================== #.
-
#query_this_version(i, query_hash = return_hash_query_to_use_for_all_components) ⇒ Object
# === query_this_version ========================================================================== #.
-
#RAM? ⇒ Boolean
(also: #ram?)
# === RAM? ========================================================================== #.
-
#register_unavailable_program(i, array = array_unavailable_programs? ) ⇒ Object
(also: #register_not_found)
# === register_unavailable_program.
-
#remove_these_components(i) ⇒ Object
# === remove_these_components.
-
#report_the_installed_KDE_software_suite ⇒ Object
# === report_the_installed_KDE_software_suite (KDE tag) ========================================================================== #.
-
#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_available_components ⇒ Object
(also: #return_every_registered_component)
# === return_all_available_components ========================================================================== #.
-
#return_all_ruby_components ⇒ Object
# === return_all_ruby_components.
-
#return_cpuinfo ⇒ Object
(also: #cpu_model?)
# === return_cpuinfo.
-
#return_default_programs_on_linux ⇒ Object
(also: #return_default_programs_on_a_linux_computer, #return_default_programs)
# === return_default_programs_on_linux.
-
#return_hash_query_to_use_for_all_components ⇒ Object
# === return_hash_query_to_use_for_all_components ========================================================================== #.
-
#return_operating_system ⇒ Object
(also: #operating_system?, #return_version_of_operating_system)
# === return_operating_system ========================================================================== #.
-
#return_operating_system_bit_type ⇒ Object
(also: #bit_type?)
# === return_operating_system_bit_type.
-
#return_remote_gtk2_version ⇒ Object
# === return_remote_gtk2_version.
-
#return_rubygems_installation_directory ⇒ Object
(also: #rubygems_installation_directory?)
# === return_rubygems_installation_directory ========================================================================== #.
-
#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? ========================================================================== #.
-
#return_xvid_version ⇒ Object
# === return_xvid_version ========================================================================== #.
-
#right_side(i) ⇒ Object
(also: #colourize_this_in_the_right_side_colour)
# === right_side ========================================================================== #.
-
#run ⇒ Object
(also: #feedback_everything, #do_feedback_everything, #output, #feedback)
# === run (run tag) ========================================================================== #.
-
#run_already? ⇒ Boolean
# === run_already? ========================================================================== #.
-
#runmode? ⇒ Boolean
# === runmode? ========================================================================== #.
-
#screen_resolution? ⇒ Boolean
# === screen_resolution? ========================================================================== #.
-
#set_array_work_on_these_components(i) ⇒ Object
(also: #set_main_array, #set_display_these_components, #set_use_this_as_main_input, #set_report_these_programs, #show_only_the_components_from_this_dataset)
# === set_array_work_on_these_components ========================================================================== #.
-
#set_runmode_gui ⇒ Object
# === set_runmode_gui ========================================================================== #.
-
#set_runmode_html ⇒ Object
# === set_runmode_html ========================================================================== #.
-
#set_use_colours(i = true) ⇒ Object
# === set_use_colours ========================================================================== #.
-
#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_n_registered_entries ⇒ Object
# === show_n_registered_entries.
-
#show_ruby_version_and_gem_version? ⇒ Boolean
# === show_ruby_version_and_gem_version? ========================================================================== #.
-
#show_the_registered_components(i = tracked_programs? ) ⇒ Object
# === show_the_registered_components ========================================================================== #.
-
#sort_alphabetically? ⇒ Boolean
# === sort_alphabetically? ========================================================================== #.
-
#start_gtk_component ⇒ Object
# === start_gtk_component.
-
#start_the_sinatra_interface ⇒ Object
# === start_the_sinatra_interface ========================================================================== #.
-
#store_this_hash_into_a_local_file(hash = the_primary_hash?, , this_file = ::EnvironmentInformation.return_path_to_all_programs_file) ⇒ Object
(also: #consider_storing_the_components_that_were_displayed, #consider_storing_which_components_were_displayed)
# === store_this_hash_into_a_local_file ========================================================================== #.
-
#sync_the_primary_hash_onto_the_toplevel_hash(i = the_primary_hash? ) ⇒ Object
# === sync_the_primary_hash_onto_the_toplevel_hash ========================================================================== #.
-
#the_primary_hash? ⇒ Boolean
(also: #primary_hash?)
# === the_primary_hash? ========================================================================== #.
-
#try_to_rename_the_kde_konsole_tab? ⇒ Boolean
# === try_to_rename_the_kde_konsole_tab? ========================================================================== #.
-
#use_ascii_table ⇒ Object
# === use_ascii_table.
-
#use_one_line_to_show_the_result? ⇒ Boolean
# === use_one_line_to_show_the_result? ========================================================================== #.
-
#version?(key = the_primary_hash?.keys.first) ⇒ Boolean
# === version? ========================================================================== #.
-
#work_on_the_programs_directory_only(use_this_as_programs_directory = '/home/Programs/') ⇒ Object
# === work_on_the_programs_directory_only.
-
#work_on_these_components? ⇒ Boolean
(also: #result, #components?, #main_dataset?, #main_entry?, #dataset?, #result?, #array_obtain_these_programs?, #array_with_entries?, #main_array?, #programs?, #show_these_components?, #array_display_these_components, #array_work_on_these_components?, #display_these_components?, #display_which_components?, #display, #work_on_which_components?)
# === work_on_these_components? ========================================================================== #.
-
#xorg_components? ⇒ Boolean
(also: #return_all_xorg_components)
# === xorg_components? ========================================================================== #.
Methods inherited from Base
#be_silent, #be_silent?, #be_verbose?, #blue, #cd, #col1, #commandline_arguments?, #crimson, #cyan, #darkgreen, #darkolivegreen, #dimgray, #esystem, #first_argument?, #gold, #is_on_roebe?, #is_rbt_available?, #lightblue, #lightgreen, #lightseagreen, #limegreen, #load_dataset_from_this_file, #log_dir?, #mediumaquamarine, #mediumpurple, #olive, #olivedrab, #opne, #orange, #register_sigint, #return_very_silent_system_output_from, #rev, #royalblue, #sanitize_this_version_string, #seagreen, #set_be_silent, #set_be_verbose, #set_commandline_arguments, #sfancy, #sfile, #simp, #slateblue, #steelblue, #teal, #tomato, #tracked_programs?, #true_rev, #use_colours?, #write_what_into
Constructor Details
#initialize(commandline_arguments = nil, run_already = true, &block) ⇒ Query
#
initialize
#
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 181 182 183 184 185 186 187 188 189 190 191 |
# File 'lib/environment_information/query/query.rb', line 88 def initialize( commandline_arguments = nil, run_already = true, &block ) register_sigint reset # ======================================================================== # # And set :run_already, so that menu() can overrule it lateron. This # should come before we call set_commandline_arguments(). # ======================================================================== # @internal_hash[:run_already] = run_already set_commandline_arguments( commandline_arguments ) # ======================================================================== # # Next, we handle special run-mode variants. # ======================================================================== # case run_already? when :do_not_run_yet @internal_hash[:run_already] = false # ======================================================================== # # === do_show_everything # ======================================================================== # when :do_show_everything do_show_everything @internal_hash[:run_already] = true end # ======================================================================== # # === Handle blocks next # # Next blocks will be handled. This must come after the reset() method. # ======================================================================== # if block_given? yielded = yield if yielded.is_a? Symbol case yielded # case tag # ==================================================================== # # === :be_quiet # ==================================================================== # when :be_quiet set_be_verbose(:be_quiet) # ==================================================================== # # === :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, :dont_run_yet @internal_hash[:run_already] = false end # ====================================================================== # # === Handle Hashes given in the block next. # ====================================================================== # elsif 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 run if run_already? end |
Class Method Details
.[](i = ARGV, &block) ⇒ Object
#
EnvironmentInformation::Query[]
#
196 197 198 199 200 |
# File 'lib/environment_information/query/query.rb', line 196 def self.[]( i = ARGV, &block ) new(i, &block) end |
.colourize_and_pad_the_left_side(i) ⇒ Object
#
EnvironmentInformation.colourize_and_pad_the_left_side
#
1997 1998 1999 2000 2001 2002 2003 2004 |
# File 'lib/environment_information/query/misc.rb', line 1997 def self.colourize_and_pad_the_left_side(i) left_side = i.to_s.ljust(32) # Pad to the left-hand side. if use_colours? " #{Colours.send(::EnvironmentInformation.colour_for_the_left_side, left_side)}" else " #{left_side}" end end |
Instance Method Details
#___report_the_findings_from_this ⇒ Object
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 |
# File 'lib/environment_information/query/misc.rb', line 263 def ___report_the_findings_from_this hash.each_pair {|name, version| do_report_this_component(name, hash, use_padding) case the_left_side.to_s when /^RAM:/ # ================================================================== # # Append 'MB RAM' in orange colour next, with some padding. # This is just a small visual "enhancement" that I quite like. # ================================================================== # the_right_side = the_right_side.dup if the_right_side.frozen? # the_right_side = (the_right_side.to_f / 1028.0).round(0).to_s # If we want GB. the_right_side << orange(' MB RAM') end display_left_side_then_the_right_side(the_left_side, the_right_side) } end |
#add(i = nil, primary_hash = primary_hash? ) ⇒ Object Also known as: show_these_entries, set_additional, update_version_for, append, append_this_to_main_string
#
add (add tag)
This method can be used to add individual entries to the main Hash called @internal_hash.
The format for add() works on both Symbols as well as Arrays as input. This will be shown 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.
On 11.04.2024 the behaviour of this method changed. It will now always register the correct version in the primary hash.
#
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 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 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 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
# File 'lib/environment_information/query/misc.rb', line 322 def add( i = nil, primary_hash = primary_hash? ) if i case i # ====================================================================== # # === :everything # # This entry point will add every available component. # ====================================================================== # when :everything add(return_all_available_components) # ====================================================================== # # === :pkgconfig_entries # ====================================================================== # when :pkgconfig_entries add(::EnvironmentInformation.return_pkgconfig_based_programs) # ====================================================================== # # === :all_xorg_components # ====================================================================== # when :all_xorg_components add(return_all_xorg_components) # ====================================================================== # # === envi --science # ====================================================================== # when :science_cluster add(science_cluster?) # ====================================================================== # # === envi --lfs_core_programs # ====================================================================== # when :lfs, :lfs_core_programs add(::EnvironmentInformation.lfs_core_programs?) # ====================================================================== # # === :linux_kernel # ====================================================================== # when :linux_kernel add(:linux) else result = nil # ====================================================================== # # === Handle Arrays as input first # ====================================================================== # if i.is_a? Array i.flatten.compact.each {|this_component| add(this_component, primary_hash) } # ====================================================================== # # === Handle Strings containing ',' next # ====================================================================== # elsif i.is_a?(String) and i.include?(',') # ==================================================================== # # Strings containing ',' will be split accordingly. # ==================================================================== # entry = i.split(',') add(entry) else # ==================================================================== # # === Handle Strings containing '-' next # ==================================================================== # if i.is_a?(String) and i.include?('-') i = i.dup if i.frozen? i.delete!('-') end i = i.to_sym unless i.is_a?(Symbol) # i will always be a Symbol past this point. unless primary_hash.has_key?(i) case i # ================================================================== # # === :rubygems_installation_directory # ================================================================== # when :rubygems_installation_directory, /^rubygems( |_)?installation( |_)?directory\??$/i result = return_rubygems_installation_directory # ================================================================== # # === :operating_system_bit_type # ================================================================== # when :operating_system_bit_type, /^operating(_|-| )?system(_|-| )?bit(_|-| )?type$/i result = # ================================================================== # # === :operating_system # ================================================================== # when :operating_system, /^Operating(_|-| )?system$/i, /^operating(_|-)?system(_|-)?in(_|-)?use$/i result = # ================================================================== # # === :ram # ================================================================== # when :ram, /^RAM$/i result = ram? # ================================================================== # # === :cflags # ================================================================== # when :cflags, /^cflags$/i, /^cflags(_|-| )?in(_|-| )?use$/i result = cflags_in_use? # ================================================================== # # === :cpuinfo # ================================================================== # when :cpuinfo, /^cpuinfo$/i, /^CPU(_|-| )?Model/ result = return_cpuinfo # ================================================================== # # === :screen_resolution # ================================================================== # when :screen_resolution, /^screen( |_)?resolution$/i result = screen_resolution? else i = ::EnvironmentInformation.return_alias_to(i) cmd = QUERY_TO_USE_FOR_ALL_COMPONENTS[i.to_s] case cmd.to_s # case tag # ================================================================ # # === special_entry_for_doubleconversion # ================================================================ # when /special_entry_for_doubleconversion/ result = ::EnvironmentInformation.return_version_of_doubleconversion # ================================================================ # # === custom_boost # ================================================================ # when 'custom_boost' result = ::EnvironmentInformation.return_version_of_boost # ================================================================ # # === custom_mpc # ================================================================ # when 'custom_mpc' result = ::EnvironmentInformation.return_version_of_mpc # ================================================================ # # === short_version # ================================================================ # when 'short_version' result = silent_query("#{i} -v") # ================================================================ # # === custom_xvid # ================================================================ # when /custom_xvid/ result = return_xvid_version # ================================================================ # # === custom_busybox # ================================================================ # when 'custom_busybox' result = ::EnvironmentInformation.return_version_of_busybox # ================================================================ # # === custom_xrandr # ================================================================ # when /custom_xrandr/ result = ::EnvironmentInformation.return_version_of_xrandr # ================================================================ # # === pkgconfig # ================================================================ # when /pkgconfig$/ # ============================================================== # # In this case we do a default pkgconfig run, using the name # of the entry at hand. # ============================================================== # intermediate_result = ::EnvironmentInformation.query_pkgconfig_version_for(i) result = intermediate_result.strip # ============================================================== # # And we can "exit" here, aka call the next element. # ============================================================== # # ================================================================ # # === version # # This is, for instance, "ruby --version". # ================================================================ # when /^version$/i intermediate_result = silent_query("#{i} --version") result = sanitize_this_version_string(intermediate_result) else result = sanitize_this_version_string(silent_query(cmd)) end # ================================================================ # # Do some post-processing next: # ================================================================ # if result.include?("\n") splitted = result.split("\n") if splitted.first == "\n" result = splitted[1 .. -1].join("\n") end end if result.include? 'no version information available (required by ' # ============================================================== # # In this case we have some external problem which will be # ignored by environment_information. # ============================================================== # splitted = result.split("\n") splitted.reject! {|entry| entry.include? 'no version information available (required by ' } result = splitted.join("\n") end result = ::EnvironmentInformation.sanitize_this_program_version(result) if result.include? 'ruby ' new_match = result.scan(/ruby (\d{1,2}\.\d{1,2}\.\d{1,2})/).flatten.first result = new_match if new_match end if result.include? 'RELION version: ' result = result.split(/RELION version: /).flatten.last end if result.include? 'Make' result.sub!(/Make/,'') end if result.include? "#{entry}-" # The entry includes itself and a '-'. result.sub!(/#{entry.to_s}-/,'') elsif result.include? entry.to_s # The entry includes itself. result.sub!(/#{entry.to_s}/,'') end if result.count("\n") > 0 result = result.split("\n").first end if result.include? ', version' # This is specifically for Bash.' # GNU bash, version 5.2.21(1)-release (x86_64-pc-linux-gnu) new_value = result.scan( /, version (\d{1,2}\.\d{1,2}\.\d{1,2})/ # See: https://rubular.com/r/t3Ma5fpSPyGjqR ).flatten.first result = new_value if new_value end if result.include?('(') and result.include?(')') result = result.split(')').last end if result.include?('(') # Such as for 'XTerm(390' result = result.split('(').last end if result.include? 'paper ' result.sub!(/paper /,'') end if result.include? 'version ' result.sub!(/version/,'') end if result.include? ' - ' # For lighttpd. result = result.split(/ - /).first end if result.include? '--' result.delete!('-') end if result.include? '/' # e. g. "nginx/1.24.0" result = result.split('/').last end result[0,1] = '' if result.start_with?('/') result.rstrip! result = check_for_nil_values(result, i) end if result # if result.include?(' ') # result = result.split(' ').last # end i = i.to_sym # ============================================================== # # Always register it directly here: # ============================================================== # @internal_hash[:the_primary_hash][i] = result if display_the_results_at_once? display_this_component(i) end end end end end end end |
#add_everything ⇒ Object Also known as: do_show_full_information, show_full_information, do_show_everything
#
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
#
26 27 28 |
# File 'lib/environment_information/query/misc.rb', line 26 def add_everything add(:everything) # Simply add everything. end |
#add_ruby_and_rubygems ⇒ Object
#
add_ruby_and_rubygems
#
1803 1804 1805 1806 1807 |
# File 'lib/environment_information/query/misc.rb', line 1803 def add_ruby_and_rubygems add(:ruby) add(:rubygems) add(:rubygems_installation_directory) end |
#add_the_commandline_arguments(i = commandline_arguments? ) ⇒ Object
#
add_the_commandline_arguments
#
1743 1744 1745 1746 1747 1748 1749 |
# File 'lib/environment_information/query/misc.rb', line 1743 def add_the_commandline_arguments( i = commandline_arguments? ) i.compact.each {|entry| add(entry) unless entry.start_with?('--') } 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
#
1731 1732 1733 1734 1735 1736 1737 1738 |
# File 'lib/environment_information/query/misc.rb', line 1731 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
#
1042 1043 1044 1045 |
# File 'lib/environment_information/query/misc.rb', line 1042 def add_this_to_the_toplevel_hash(a, b) a = a.to_sym unless a.is_a? Symbol ::EnvironmentInformation.hash?[a] = b end |
#array_these_programs_not_up_to_date? ⇒ Boolean
#
array_these_programs_not_up_to_date?
#
1094 1095 1096 |
# File 'lib/environment_information/query/misc.rb', line 1094 def array_these_programs_not_up_to_date? @internal_hash[:array_these_programs_not_up_to_date] end |
#array_unavailable_programs? ⇒ Boolean
#
array_unavailable_programs?
#
1704 1705 1706 |
# File 'lib/environment_information/query/misc.rb', line 1704 def array_unavailable_programs? @internal_hash[:array_unavailable_programs] 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.
#
1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 |
# File 'lib/environment_information/query/misc.rb', line 1972 def assign_components_for_the_short_format clear_old_dataset dont_show_ruby_stuff add(i( cpuinfo cflags RAM screen_resolution )) end |
#can_we_query_the_mate_desktop? ⇒ Boolean
#
can_we_query_the_mate_desktop?
#
1229 1230 1231 1232 1233 |
# File 'lib/environment_information/query/misc.rb', line 1229 def can_we_query_the_mate_desktop? is_rbt_available? and RBT.const_defined?(:Action) and RBT::Action.const_defined?(:ReportMateDesktopVersion) end |
#cflags_in_use? ⇒ Boolean Also known as: cflags?
#
cflags_in_use?
#
902 903 904 |
# File 'lib/environment_information/query/misc.rb', line 902 def cflags_in_use? ::EnvironmentInformation.cflags? end |
#check_for_nil_values(i, this_program = nil) ⇒ Object
#
check_for_nil_values
#
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/environment_information/query/misc.rb', line 35 def check_for_nil_values( i, this_program = nil ) case i # ======================================================================== # # Register some errors next: # ======================================================================== # when nil,'', /: command not found/, /^options$/, /was not found in the pkg-?config search path./, /was not found in the pkg-?conf/, /error while loading shared libraries/ i = NOT_FOUND ::EnvironmentInformation.register_this_component_is_missing(this_program) end return i end |
#check_this_hash_for_unavailable_programs(hash) ⇒ Object
#
check_this_hash_for_unavailable_programs
#
593 594 595 596 597 598 599 600 601 602 603 604 |
# File 'lib/environment_information/query/misc.rb', line 593 def check_this_hash_for_unavailable_programs( hash ) # ======================================================================== # # Register that this program is not available. # ======================================================================== # register_unavailable_program( hash.select {|key, value| value.include?(NOT_FOUND) }.keys ) end |
#clear_hash_and_missing_components ⇒ Object
#
clear_hash_and_missing_components
#
650 651 652 653 |
# File 'lib/environment_information/query/misc.rb', line 650 def clear_hash_and_missing_components clear_toplevel_hash clear_missing_components end |
#clear_missing_components ⇒ Object
#
clear_missing_components
#
1077 1078 1079 |
# File 'lib/environment_information/query/misc.rb', line 1077 def clear_missing_components ::EnvironmentInformation.clear_missing_components end |
#clear_old_dataset ⇒ Object Also known as: clear_the_old_dataset
#
clear_old_dataset
#
1916 1917 1918 |
# File 'lib/environment_information/query/misc.rb', line 1916 def clear_old_dataset work_on_these_components?.clear end |
#clear_the_main_dataset ⇒ Object Also known as: clear_main_dataset, empty_main_dataset, empty_main_array
#
clear_the_main_dataset
#
871 872 873 874 |
# File 'lib/environment_information/query/misc.rb', line 871 def clear_the_main_dataset clear_the_old_dataset do_not_display_the_ruby_components end |
#clear_the_main_hash ⇒ Object
#
clear_the_main_hash
#
1035 1036 1037 |
# File 'lib/environment_information/query/misc.rb', line 1035 def clear_the_main_hash @internal_hash[:the_primary_hash].clear end |
#clear_toplevel_hash ⇒ Object
#
clear_toplevel_hash
#
1338 1339 1340 |
# File 'lib/environment_information/query/misc.rb', line 1338 def clear_toplevel_hash ::EnvironmentInformation.clear_hash end |
#commandline? ⇒ Boolean
#
commandline?
Whether we run in the “commandline mode” or whether we run in the GUI or WWW/HTML mode.
#
1399 1400 1401 |
# File 'lib/environment_information/query/misc.rb', line 1399 def commandline? runmode? == :commandline end |
#compare_program_versions? ⇒ Boolean Also known as: compare_program_version?
#
compare_program_versions?
#
1833 1834 1835 |
# File 'lib/environment_information/query/misc.rb', line 1833 def compare_program_versions? @internal_hash[:compare_program_versions] end |
#compare_via_gem_version(i) ⇒ Object
#
compare_via_gem_version
#
1156 1157 1158 1159 1160 1161 1162 1163 1164 |
# File 'lib/environment_information/query/misc.rb', line 1156 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.
#
1673 1674 1675 1676 1677 1678 1679 |
# File 'lib/environment_information/query/misc.rb', line 1673 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_which_programs_are_not_up_to_date(temp_dir = temp_dir?, , array_programs_that_are_not_up_to_date = array_these_programs_not_up_to_date? ) ⇒ Object
#
consider_storing_which_programs_are_not_up_to_date
#
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
# File 'lib/environment_information/query/misc.rb', line 681 def consider_storing_which_programs_are_not_up_to_date( temp_dir = temp_dir?, array_programs_that_are_not_up_to_date = array_these_programs_not_up_to_date? ) if shall_we_really_store_which_programs_are_not_up_to_date? # This also checks for a roebe-system. into = FILE_THESE_PROGRAMS_CAN_BE_UPGRADED what = YAML.dump(array_programs_that_are_not_up_to_date) if File.directory?(temp_dir) into = "#{temp_dir}#{File.basename(into)}" else into = "#{temp_dir}#{File.basename(into)}" end opne "#{rev}We will also store which programs are not up to date." opne "These will be stored into the file "\ "at `#{sfile(into)}#{rev}`." ::EnvironmentInformation.write_what_into(what, into) end end |
#dataset_as_string(main_hash = the_primary_hash? ) ⇒ 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”.
#
1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 |
# File 'lib/environment_information/query/misc.rb', line 1112 def dataset_as_string( main_hash = the_primary_hash? ) _ = ''.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 main_hash.has_key?(entry.to_sym) _ << " #{entry}: #{main_hash[entry.to_sym]}#{N}" elsif ::EnvironmentInformation.respond_to? use_this_method program_version = ::EnvironmentInformation.send( use_this_method ) entry = " #{entry}:" _ << "#{entry} #{program_version}#{N}" else # Try a self-query here case entry.to_sym when 'pkgconfig' entry = ::EnvironmentInformation.query_pkgconfig_version_for(entry) end result = query_this_version(entry.to_sym) if result and !result.empty? entry = " #{entry}:" _ << "#{entry} #{result}#{N}" end end } return _ # And return the generated String. end |
#dataset_containing_all_tracked_programs? ⇒ Boolean
#
dataset_containing_all_tracked_programs?
#
1625 1626 1627 |
# File 'lib/environment_information/query/misc.rb', line 1625 def dataset_containing_all_tracked_programs? @internal_hash[:dataset_containing_all_tracked_programs] 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.
#
1019 1020 1021 1022 |
# File 'lib/environment_information/query/misc.rb', line 1019 def disable_colours super() ::EnvironmentInformation.use_colours = false end |
#display_everything_in_short_format? ⇒ Boolean
#
display_everything_in_short_format?
#
1940 1941 1942 |
# File 'lib/environment_information/query/misc.rb', line 1940 def display_everything_in_short_format? @internal_hash[:display_everything_in_short_format] end |
#display_left_side_then_the_right_side(the_left_side = nil, the_right_side = nil) ⇒ Object
#
display_left_side_then_the_right_side
This method will simply display what is passed into it. It is NOT allowed to do ANY modifications to the given input.
#
221 222 223 224 225 226 |
# File 'lib/environment_information/query/misc.rb', line 221 def display_left_side_then_the_right_side( the_left_side = nil, the_right_side = nil ) e "#{left_side(the_left_side)}#{the_right_side}" end |
#display_result? ⇒ Boolean
#
display_result?
#
1902 1903 1904 |
# File 'lib/environment_information/query/misc.rb', line 1902 def display_result? @internal_hash[:display_result] end |
#display_the_results_at_once? ⇒ Boolean Also known as: insta_show?
#
display_the_results_at_once?
#
1222 1223 1224 |
# File 'lib/environment_information/query/misc.rb', line 1222 def display_the_results_at_once? @internal_hash[:display_the_results_at_once] end |
#display_these_components(array = array_work_on_these_components? ) ⇒ Object Also known as: do_work_through_all_the_specified_components, report, report_result, build_up_the_main_string, register_the_available_components_and_show_them_at_once, display_the_components, display_the_dataset, display_the_main_components, report_the_findings_from_this
#
display_these_components (report tag)
This method operates on an Array at all times.
#
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 |
# File 'lib/environment_information/query/misc.rb', line 233 def display_these_components( array = array_work_on_these_components? ) unless do_exit_the_program? # ====================================================================== # # === Report step # # We may only display the components if display_result? is true. # ====================================================================== # return unless display_result? array = [array].flatten.compact if array.empty? notify_the_user_that_there_are_no_components_that_can_be_displayed # And this ends here. else array.each {|name_of_the_program| display_this_component(name_of_the_program) } end end end |
#display_this_component(name_of_the_component, hash = the_primary_hash?, , use_padding = true) ⇒ Object Also known as: do_report_this_component
#
display_this_component
This method may NOT work on Arrays.
This method is allowed to make modifications to the given input.
#
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 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 181 182 183 184 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 |
# File 'lib/environment_information/query/misc.rb', line 62 def display_this_component( name_of_the_component, hash = the_primary_hash?, use_padding = true ) version = hash[name_of_the_component.to_sym].strip original_version = version.to_s.dup.strip # ======================================================================== # # This used to be called "report_left_right". The right side # constitutes the program-version, shortened towards just "version". # ======================================================================== # case name_of_the_component # ======================================================================== # # === cpuinfo # ======================================================================== # when :cpuinfo, /^cpuinfo$/i name_of_the_component = 'CPU Model' # ======================================================================== # # === :operating_system # ======================================================================== # when :operating_system, /^operating(_|-)?system$/i, /^operating(_|-)?system(_|-)?in(_|-)?use$/i name_of_the_component = 'Operating system' # ======================================================================== # # === operating_system_bit_type # ======================================================================== # when :operating_system_bit_type, /^operating(_|-)?system(_|-)?bit(_|-)?type$/i name_of_the_component = 'Operating system bit type' # ======================================================================== # # === :ram # ======================================================================== # when :ram, /^ram$/i name_of_the_component = 'RAM' # ======================================================================== # # === :cflags # ======================================================================== # when :cflags, /^cflags$/i name_of_the_component = 'CFLAGS in use' # ======================================================================== # # === screen_resolution # # This is a bit "special" in the sense that this class will colourize # the middle 'x', if found, and if colours are used. # ======================================================================== # when :screen_resolution, /^screen( |_)?resolution$/i name_of_the_component = 'Screen Resolution:' if use_padding name_of_the_component = name_of_the_component.ljust(N_LEFT_PAD) end if version.include?('x') and use_colours? splitted = version.split('x') version = colourize_this_in_the_right_side_colour(splitted.first)+ royalblue('x')+ colourize_this_in_the_right_side_colour(splitted.last) end end if name_of_the_component.is_a?(String) and name_of_the_component.include?(':') the_left_side = "#{name_of_the_component}" else the_left_side = "#{name_of_the_component}:" end if use_padding the_left_side = the_left_side.ljust(N_LEFT_PAD) end if version.include?(NOT_FOUND) version = lightseagreen(version, use_colours?) else version = right_side(version) end the_right_side = version.dup.strip # ======================================================================== # # === @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?) _ = this_component.to_s.delete('-').downcase.strip.to_sym # ====================================================================== # # Query whether RBT keeps track of that program: # ====================================================================== # if RBT.does_include?(_) # ==================================================================== # # Next we will obtain the remote URL: # ==================================================================== # remote_URL = RBT.remote_url_for?(_, :return_as_string) if is_a_registered_component? _ the_right_side = the_right_side.ljust(58, ' ') the_right_side << " #{olive('→')} #{lightgreen(remote_URL)}" # Colourize the URL in olive. end end end # ======================================================================== # # 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?(name_of_the_component.to_s.strip.delete(':')) # ====================================================================== # # Example: # # RBT.swift_return_version_of_this_program(:gettext) # # ====================================================================== # registered_local_version = RBT.swift_return_version_of_this_program( name_of_the_component.to_s.strip.delete(':').to_sym ).to_s # ====================================================================== # # We ignore gtk2 when it comes to the version-check. # ====================================================================== # return if name_of_the_component.to_sym == :gtk2 # ====================================================================== # # Next use Gem::Version to compare them, but not if the version # is nil. # ====================================================================== # unless version.nil? or (version.to_s.include?(NOT_FOUND)) # ==================================================================== # # The .delete('v') is specifically for libuv or node. # ==================================================================== # registered_local_version = registered_local_version.to_s.dup. delete('v'). tr('_','.') a = compare_via_gem_version(registered_local_version) b = compare_via_gem_version(original_version) 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)+ ' (original_version was: '+original_version.to_s+')' e result end if registered_local_version =~ /\d+/ end end display_left_side_then_the_right_side( the_left_side, the_right_side ) end |
#do_compare_the_program_version(be_verbose = false) ⇒ 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.
#
1318 1319 1320 1321 1322 1323 1324 1325 |
# File 'lib/environment_information/query/misc.rb', line 1318 def do_compare_the_program_version( be_verbose = false ) if be_verbose e "#{rev}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”.
#
1662 1663 1664 |
# File 'lib/environment_information/query/misc.rb', line 1662 def do_display_in_a_short_format @internal_hash[:display_everything_in_short_format] = true end |
#do_exit_the_program ⇒ Object
#
do_exit_the_program
#
1761 1762 1763 |
# File 'lib/environment_information/query/misc.rb', line 1761 def do_exit_the_program @internal_hash[:do_exit_the_program] = true end |
#do_exit_the_program? ⇒ Boolean
#
do_exit_the_program?
#
1632 1633 1634 |
# File 'lib/environment_information/query/misc.rb', line 1632 def do_exit_the_program? @internal_hash[:do_exit_the_program] 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
#
788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 |
# File 'lib/environment_information/query/misc.rb', line 788 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 = "#{temp_directory?}environment_information.html" # ======================================================================== # # Obtain the main dataset next. # ======================================================================== # what = dataset_as_string case styling_instructions # ======================================================================== # # === :bold # ======================================================================== # 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 opne "#{rev}Generated a HTML file at" opne "`#{sfile(this_html_file)}#{rev}`." end end |
#do_not_display_the_result ⇒ Object
#
do_not_display_the_result
#
1895 1896 1897 |
# File 'lib/environment_information/query/misc.rb', line 1895 def do_not_display_the_result @internal_hash[:display_result] = false end |
#do_not_run_already ⇒ Object Also known as: do_not_run
#
do_not_run_already
#
703 704 705 |
# File 'lib/environment_information/query/misc.rb', line 703 def do_not_run_already @internal_hash[:run_already] = false end |
#do_not_save_anything ⇒ Object Also known as: do_not_store_anything
#
do_not_save_anything
#
1005 1006 1007 1008 1009 1010 1011 |
# File 'lib/environment_information/query/misc.rb', line 1005 def do_not_save_anything do_not_store_anything_into_a_local_file # ======================================================================== # # We will also avoid saving the results into a local yaml file. # ======================================================================== # do_not_store_anything_into_a_local_file end |
#do_not_store_anything_into_a_local_file ⇒ Object
#
do_not_store_anything_into_a_local_file
#
1847 1848 1849 |
# File 'lib/environment_information/query/misc.rb', line 1847 def do_not_store_anything_into_a_local_file @internal_hash[:shall_we_store_the_main_hash_into_a_local_file] = false end |
#do_really_create_a_html_file ⇒ Object
#
do_really_create_a_html_file
#
847 848 849 |
# File 'lib/environment_information/query/misc.rb', line 847 def do_really_create_a_html_file @internal_hash[:generate_a_html_file] = true 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.
#
1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 |
# File 'lib/environment_information/query/misc.rb', line 1867 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
This method will enable the reporting of the remote URLs, if available.
#
1452 1453 1454 |
# File 'lib/environment_information/query/misc.rb', line 1452 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.
#
1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 |
# File 'lib/environment_information/query/misc.rb', line 1207 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_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
#
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/environment_information/query/help.rb', line 23 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?
#
886 887 888 889 |
# File 'lib/environment_information/query/misc.rb', line 886 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.
#
1931 1932 1933 1934 1935 |
# File 'lib/environment_information/query/misc.rb', line 1931 def do_show_only_the_xorg_components clear_old_dataset do_not_show_the_ruby_components add(:all_xorg_components) end |
#do_sort_alphabetically(i = work_on_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.
#
737 738 739 740 741 742 |
# File 'lib/environment_information/query/misc.rb', line 737 def do_sort_alphabetically( i = work_on_which_components? ) _ = i.sort_by {|name, version| name.to_s } set_main_array(_) end |
#do_store_the_results_into_local_files ⇒ Object
#
do_store_the_results_into_local_files
#
1840 1841 1842 |
# File 'lib/environment_information/query/misc.rb', line 1840 def do_store_the_results_into_local_files @internal_hash[:store_the_results_into_local_files] = true end |
#dont_show_ruby_stuff ⇒ Object Also known as: show_no_ruby, do_not_show_the_ruby_components, do_not_display_the_ruby_components
#
dont_show_ruby_stuff
Disable showing ruby + gem information.
#
1468 1469 1470 |
# File 'lib/environment_information/query/misc.rb', line 1468 def dont_show_ruby_stuff # Dont show ruby stuff. @internal_hash[: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.
#
1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 |
# File 'lib/environment_information/query/misc.rb', line 1785 def e( i = '' ) if be_verbose? 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
#
1027 1028 1029 1030 |
# File 'lib/environment_information/query/misc.rb', line 1027 def enable_colours super() ::EnvironmentInformation.use_colours = true end |
#enable_sort_alphabetically ⇒ Object
#
enable_sort_alphabetically
#
1711 1712 1713 |
# File 'lib/environment_information/query/misc.rb', line 1711 def enable_sort_alphabetically @internal_hash[:sort_alphabetically] = true end |
#generate_a_html_file? ⇒ Boolean
#
generate_a_html_file?
#
773 774 775 |
# File 'lib/environment_information/query/misc.rb', line 773 def generate_a_html_file? @internal_hash[:generate_a_html_file] end |
#gui? ⇒ Boolean
#
gui?
#
1389 1390 1391 |
# File 'lib/environment_information/query/misc.rb', line 1389 def gui? runmode? == :gui end |
#is_a_registered_component?(i) ⇒ Boolean Also known as: is_an_allowed_entry?
#
is_a_registered_component?
#
909 910 911 |
# File 'lib/environment_information/query/misc.rb', line 909 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?
#
1826 1827 1828 |
# File 'lib/environment_information/query/misc.rb', line 1826 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?
#
958 959 960 |
# File 'lib/environment_information/query/misc.rb', line 958 def is_this_program_included?(i) ::EnvironmentInformation.is_this_program_included?(i) end |
#left_side(i, use_colours = use_colours? ) ⇒ Object
#
left_side
#
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 |
# File 'lib/environment_information/query/misc.rb', line 1576 def left_side( i, use_colours = use_colours? ) if use_colours return send(::EnvironmentInformation.colour_for_the_left_side, i) else return i end end |
#main_hash? ⇒ Boolean
#
main_hash?
#
766 767 768 |
# File 'lib/environment_information/query/misc.rb', line 766 def main_hash? ::EnvironmentInformation.hash? end |
#may_we_try_to_use_rbt? ⇒ Boolean
#
may_we_try_to_use_rbt?
#
1500 1501 1502 |
# File 'lib/environment_information/query/misc.rb', line 1500 def may_we_try_to_use_rbt? @internal_hash[:may_we_try_to_use_rbt] end |
#menu(i = commandline_arguments? ) ⇒ Object
#
menu (menu tag)
This method constitutes the “menu” interface for class EnvironmentInformation::Query.
It primarily deals with the commandline-given arguments stored in ARGV, but can also be used as a generic entry point to this class.
#
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 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 181 182 183 184 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 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 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 |
# File 'lib/environment_information/query/menu.rb', line 22 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 do_compare_the_program_version # First toggle this. clear_old_dataset add_everything # add_default_linux_programs # add_ruby_and_rubygems # do_show_almost_everything_excluding_the_default_linux_programs # ====================================================================== # # === 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. # ====================================================================== # # === envi --show-the-results-at-once # ====================================================================== # when /^-?-?show(-|_)the(-|_)?results(-|_)?at(-|_)?once$/i, /^-?-?insta(-|_)show$/i # === envi --insta-show @internal_hash[:display_the_results_at_once] = true # ====================================================================== # # === envi --do-not-show-the-results-at-once # # This is the slow variant, which is no longer the default as of # April 2024. # ====================================================================== # when /^-?-?do(-|_)not(-|_)show(-|_)the(-|_)?results(-|_)?at(-|_)?once$/i, /^-?-?display(-|_)after(-|_)gathering(-|_)?step$/i, /^-?-?display(-|_)after(-|_)the(-|_)gathering(-|_)?step$/i @internal_hash[:display_the_results_at_once] = false # ====================================================================== # # === 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 --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 --disable= # # Invocation example: # # envi --disable=htop,awk,zlib # # ====================================================================== # when /^-?-?disable=(.+)$/i # === envi --disable=htop,awk remove_these_components($1.to_s.dup) # ====================================================================== # # === 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 --generate-html-file # # This entry point can be used to generate a local .html file. # ====================================================================== # when /^-?-?generate(-|_)?html(-|_)?file$/i, /^-?-?html$/i # envi --HTML do_really_create_a_html_file set_runmode_html # Set it here again, just in case. do_show_everything # ====================================================================== # # === envi --be_silent # ====================================================================== # when /^-?-?be(_|-)?silent$/i # === envi --be-silent do_not_display_the_result 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) # ====================================================================== # # === :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 --n_entries? # ====================================================================== # when /^-?-?n(_|-)?entries\??$/i, /^-?-?n(_|-)?programs\??$/i # envi --nprograms? show_n_registered_entries # === envi --n_entries @internal_hash[:do_exit_the_program] = true # ====================================================================== # # === 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 noruby # ====================================================================== # when /^-?-?noruby$/i, 'show_no_ruby', 'classic', 'naked', '3', 'minimal' show_no_ruby # ====================================================================== # # === 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 # ====================================================================== # # === :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 --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 do_store_the_results_into_local_files # ====================================================================== # # === 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 do_store_the_results_into_local_files # ====================================================================== # # === envi --registered-components? # ====================================================================== # when /^-?-?registered(_|-)?components\??$/i, /^-?-?available\??$/i do_not_run_already show_the_registered_components @internal_hash[: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 --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 openssl # ====================================================================== # when /^-?-?openssl$/, /^-?-?ssl$/ add(:openssl) # ====================================================================== # # === envi --science # ====================================================================== # when /^-?-?science$/ clear_old_dataset add(:science_cluster) # ====================================================================== # # === 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 ::EnvironmentInformation.replay_from_the_stored_file # ====================================================================== # # === 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 --use-colours? # ====================================================================== # when /^-?-?use(-|_)?colou?rs\??$/i e 'Will colours be used? '+ ::EnvironmentInformation.verbose_truth( ::EnvironmentInformation.use_colours?.to_s ) do_not_run @internal_hash[:do_exit_the_program] = true # ====================================================================== # # === envi --short # ====================================================================== # when /^-?-?short$/i, /^-?-?display(-|_)?short(-|_)?format$/i, /^-?-?do(-|_)?display(-|_)?in(-|_)?a(-|_)?short(-|_)?format$/i do_display_in_a_short_format # ====================================================================== # # === 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 --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 --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 --assign_components_for_the_short_format # ====================================================================== # when /^-?-?assign(_|-)?components(_|-)?for(_|-)?the(_|-)?short(_|-)?format$/i assign_components_for_the_short_format # ====================================================================== # # === envi --help # ====================================================================== # when /^-?-?help$/i show_help exit 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. # ==================================================================== # clear_the_main_hash # 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. # ==================================================================== # # Or: # e 'Unhandled command input (in file environment_information/class/menu.rb): ' # e # e " #{sfancy(i)}" # e end end end end |
#notify_the_user_that_there_are_no_components_that_can_be_displayed ⇒ Object
#
notify_the_user_that_there_are_no_components_that_can_be_displayed
#
1754 1755 1756 |
# File 'lib/environment_information/query/misc.rb', line 1754 def notify_the_user_that_there_are_no_components_that_can_be_displayed opne 'There are no components that can be displayed.' end |
#open_this_file_in_editor ⇒ Object
#
open_this_file_in_editor
#
894 895 896 897 |
# File 'lib/environment_information/query/misc.rb', line 894 def open_this_file_in_editor _ = "geany #{THIS_FILE}" e _; system _; exit end |
#opnn ⇒ Object Also known as: opn
#
opnn
#
1718 1719 1720 1721 1722 1723 1724 1725 1726 |
# File 'lib/environment_information/query/misc.rb', line 1718 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 |
#program_not_found(i, use_colours = use_colours? ) ⇒ Object
#
program_not_found
#
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 |
# File 'lib/environment_information/query/misc.rb', line 1521 def program_not_found( i, use_colours = use_colours? ) if use_colours return send(::EnvironmentInformation.colour_for_program_not_found, i) else return i end end |
#query_this_version(i, query_hash = return_hash_query_to_use_for_all_components) ⇒ Object
#
query_this_version
#
747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 |
# File 'lib/environment_information/query/misc.rb', line 747 def query_this_version( i, query_hash = return_hash_query_to_use_for_all_components ) use_this_query = query_hash[i] # ======================================================================== # # Next, feed it to the main query-code: # ======================================================================== # result = silent_query(use_this_query) if result result.strip else nil end end |
#RAM? ⇒ Boolean Also known as: ram?
#
RAM?
#
1535 1536 1537 |
# File 'lib/environment_information/query/misc.rb', line 1535 def RAM? return ::EnvironmentInformation.ram? end |
#register_unavailable_program(i, array = array_unavailable_programs? ) ⇒ Object Also known as: register_not_found
#
register_unavailable_program
Programs that were not be found can be registered through this method.
#
1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 |
# File 'lib/environment_information/query/misc.rb', line 1641 def register_unavailable_program( i, array = array_unavailable_programs? ) if i.is_a? Array i.flatten.each {|entry| register_unavailable_program(entry, array) } else i = i.to_sym # Let's store only Symbols. array << i unless array.include?(i) end end |
#remove_these_components(i) ⇒ Object
#
remove_these_components
This method can be used to remove registered components again.
#
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 |
# File 'lib/environment_information/query/misc.rb', line 611 def remove_these_components( i ) # ======================================================================== # # === Handle Strings containing ',' first # ======================================================================== # if i.is_a?(String) and i.include?(',') splitted = i.split(',') remove_these_components(splitted) # ======================================================================== # # === Handle Arrays next # ======================================================================== # elsif i.is_a? Array i.flatten.each {|entry| remove_these_components(entry) } else i = i.to_sym primary_hash = primary_hash? if primary_hash.has_key? i primary_hash.delete(i) end end end |
#report_the_installed_KDE_software_suite ⇒ Object
#
report_the_installed_KDE_software_suite (KDE tag)
#
1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 |
# File 'lib/environment_information/query/misc.rb', line 1238 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 "#{rev}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" version = swift_query(cmd_to_use) if version.include?(NOT_FOUND) or version.include?('not found') version = NOT_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! unless version.frozen? if version.include?('The program is not installed') or version.include?(NOT_FOUND) 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?
#
1459 1460 1461 |
# File 'lib/environment_information/query/misc.rb', line 1459 def report_the_remote_urls? @internal_hash[:report_the_remote_urls] end |
#report_version ⇒ Object
#
report_version
#
1775 1776 1777 1778 |
# File 'lib/environment_information/query/misc.rb', line 1775 def report_version ::EnvironmentInformation.report_version @internal_hash[:do_exit_the_program] = true end |
#reset ⇒ Object
#
reset (reset tag)
#
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/environment_information/query/reset.rb', line 16 def reset super() set_be_verbose # ======================================================================== # # === :the_primary_hash # # This Hash will keep track as to which programs will be displayed. # # The version must be registered into this primary Hash. # # This hash's keys will contain the components that will be reported, # such as 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. # # By default it is empty, naturally. # ======================================================================== # @internal_hash[:the_primary_hash] = {} # ======================================================================== # # === :display_the_results_at_once # ======================================================================== # @internal_hash[:display_the_results_at_once] = 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. # ======================================================================== # @internal_hash[:display_everything_in_short_format] = 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 # ======================================================================== # # === :namespace # ======================================================================== # @internal_hash[:namespace] = NAMESPACE # ======================================================================== # # === :runmode # # The :runmode variable can be :commandline or :gui or :www. # ======================================================================== # @internal_hash[:runmode] = :commandline # ======================================================================== # # === :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 # ======================================================================== # # === :do_exit_the_program # # The following variable can determine when we exit from this class. # By default we will not exist early. # ======================================================================== # @internal_hash[:do_exit_the_program] = false # ======================================================================== # # === :array_unavailable_programs # # Programs which could not be found can be registered into the following # Array. # ======================================================================== # @internal_hash[:array_unavailable_programs] = [] # ======================================================================== # # === :use_one_line_to_show_the_result # ======================================================================== # @internal_hash[:use_one_line_to_show_the_result] = 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, hence # why this remains part of reset(). I tried this again in April 2024, # but it is too spammy, so I will most likely no longer use it anyway. # ======================================================================== # @internal_hash[:try_to_rename_the_kde_konsole_tab] = false # ======================================================================== # # === :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, hence the value of false. # ======================================================================== # @internal_hash[:compare_program_versions] = 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 # ======================================================================== # # === @internal_hash[:run_already] # # This variable will be true by default. # ======================================================================== # @internal_hash[:run_already] = true # ======================================================================== # # === :sort_alphabetically # # Whether to sort the main Hash alphabetically or not. # ======================================================================== # @internal_hash[:sort_alphabetically] = false # ======================================================================== # # === :dataset_containing_all_tracked_programs # # This will always contain all tracked programs, taken from a # .yml file. # ======================================================================== # @internal_hash[:dataset_containing_all_tracked_programs] = ::EnvironmentInformation::ARRAY_TRACKED_PROGRAMS # ======================================================================== # # === :table # # This variable keeps track over as to whether this class will make # use of an ASCII table or whether it will not. # ======================================================================== # @internal_hash[:table] = nil # ======================================================================== # # === :use_ascii_table # # Whether to use an ASCII table or whether we will not. # ======================================================================== # @internal_hash[:use_ascii_table] = false # ======================================================================== # # === :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 # ======================================================================== # # === :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. # ======================================================================== # @internal_hash[:show_everything] = false # ======================================================================== # # === :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. # ======================================================================== # @internal_hash[:show_ruby_version_and_gem_version] = true # ======================================================================== # # === :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. # ======================================================================== # @internal_hash[:display_result] = true # ======================================================================== # # === :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? @internal_hash[: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"
#
993 994 995 996 997 998 999 1000 |
# File 'lib/environment_information/query/misc.rb', line 993 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_available_components ⇒ Object Also known as: return_every_registered_component
#
return_all_available_components
#
1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 |
# File 'lib/environment_information/query/misc.rb', line 1050 def return_all_available_components _ = dataset_containing_all_tracked_programs? # ======================================================================== # # === 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. # ====================================================================== # array = RBT.return_mate_desktop_version_array array.each {|a,b| # array << [a, b] _ << a the_primary_hash?[a.to_sym] = b } end result = _.flatten return result end |
#return_all_ruby_components ⇒ Object
#
return_all_ruby_components
Combine three calls into one here - all related to ruby.
#
1693 1694 1695 1696 1697 1698 1699 |
# File 'lib/environment_information/query/misc.rb', line 1693 def return_all_ruby_components i( ruby rubygems rubygems_installation_directory ) end |
#return_cpuinfo ⇒ Object Also known as: cpu_model?
#
return_cpuinfo
This is also known as the “cpu model”.
#
1569 1570 1571 |
# File 'lib/environment_information/query/misc.rb', line 1569 def return_cpuinfo return ::EnvironmentInformation.cpuinfo? 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.
#
1887 1888 1889 |
# File 'lib/environment_information/query/misc.rb', line 1887 def return_default_programs_on_linux ARRAY_DEFAULT_PROGRAMS_ON_LINUX end |
#return_hash_query_to_use_for_all_components ⇒ Object
#
return_hash_query_to_use_for_all_components
#
979 980 981 982 983 |
# File 'lib/environment_information/query/misc.rb', line 979 def return_hash_query_to_use_for_all_components _ = QUERY_TO_USE_FOR_ALL_COMPONENTS _.transform_keys! {|entry| entry.to_sym } return _ end |
#return_operating_system ⇒ Object Also known as: operating_system?, return_version_of_operating_system
#
return_operating_system
#
1559 1560 1561 |
# File 'lib/environment_information/query/misc.rb', line 1559 def return ::EnvironmentInformation. end |
#return_operating_system_bit_type ⇒ Object Also known as: bit_type?
#
return_operating_system_bit_type
We could also use “lscpu” and check for the substring ‘CPU op-mode’.
#
285 286 287 |
# File 'lib/environment_information/query/misc.rb', line 285 def return ::EnvironmentInformation. 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.
#
1552 1553 1554 |
# File 'lib/environment_information/query/misc.rb', line 1552 def return_remote_gtk2_version ::EnvironmentInformation.return_remote_gtk2_version end |
#return_rubygems_installation_directory ⇒ Object Also known as: rubygems_installation_directory?
#
return_rubygems_installation_directory
#
1477 1478 1479 |
# File 'lib/environment_information/query/misc.rb', line 1477 def return_rubygems_installation_directory return ::EnvironmentInformation.rubygems_installation_directory end |
#return_version_of_awk? ⇒ Boolean Also known as: return_version_of_awk
#
return_version_of_awk?
#
916 917 918 |
# File 'lib/environment_information/query/misc.rb', line 916 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?
#
923 924 925 |
# File 'lib/environment_information/query/misc.rb', line 923 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?
#
1611 1612 1613 |
# File 'lib/environment_information/query/misc.rb', line 1611 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?
#
1176 1177 1178 |
# File 'lib/environment_information/query/misc.rb', line 1176 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?
#
1169 1170 1171 |
# File 'lib/environment_information/query/misc.rb', line 1169 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?
#
930 931 932 |
# File 'lib/environment_information/query/misc.rb', line 930 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?
#
937 938 939 |
# File 'lib/environment_information/query/misc.rb', line 937 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?
#
1618 1619 1620 |
# File 'lib/environment_information/query/misc.rb', line 1618 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?
#
944 945 946 |
# File 'lib/environment_information/query/misc.rb', line 944 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?
#
965 966 967 |
# File 'lib/environment_information/query/misc.rb', line 965 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?
#
1604 1605 1606 |
# File 'lib/environment_information/query/misc.rb', line 1604 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?
#
1597 1598 1599 |
# File 'lib/environment_information/query/misc.rb', line 1597 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?
#
1590 1591 1592 |
# File 'lib/environment_information/query/misc.rb', line 1590 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?
#
951 952 953 |
# File 'lib/environment_information/query/misc.rb', line 951 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?
#
1493 1494 1495 |
# File 'lib/environment_information/query/misc.rb', line 1493 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?
This method will return the rubygems-version at hand.
#
1486 1487 1488 |
# File 'lib/environment_information/query/misc.rb', line 1486 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?
#
1183 1184 1185 |
# File 'lib/environment_information/query/misc.rb', line 1183 def return_version_of_xvid? ::EnvironmentInformation.send(__method__) end |
#return_xvid_version ⇒ Object
#
return_xvid_version
#
1542 1543 1544 |
# File 'lib/environment_information/query/misc.rb', line 1542 def return_xvid_version ::EnvironmentInformation.return_version_of_xvid end |
#right_side(i) ⇒ Object Also known as: colourize_this_in_the_right_side_colour
#
right_side
#
639 640 641 642 643 644 645 |
# File 'lib/environment_information/query/misc.rb', line 639 def right_side(i) if use_colours? return send(::EnvironmentInformation.colour_for_the_right_side, i) else return i end end |
#run ⇒ Object Also known as: feedback_everything, do_feedback_everything, output, feedback
#
run (run tag)
#
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/environment_information/query/run.rb', line 16 def run # ======================================================================== # # Reset the toplevel-array keeping track of all missing components. # ======================================================================== # ::EnvironmentInformation.clear_array_missing_components # ======================================================================== # # Try to rename the KDE konsole first. This will happen on # roebe-systems only. # ======================================================================== # do_rename_kde_konsole # ======================================================================== # # Find the appropriate version next: # ======================================================================== # # add(return_all_available_components) # ======================================================================== # # Invoke menu() to query the commandline arguments. # ======================================================================== # if display_everything_in_short_format? assign_components_for_the_short_format # Handle the short format here. end if sort_alphabetically? # ← Must come before the report-step. do_sort_alphabetically end if insta_show? # ====================================================================== # # In this case we already showed every component. # ====================================================================== # else check_this_hash_for_unavailable_programs(the_primary_hash?) display_these_components 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 generate_a_html_file? sync_the_primary_hash_onto_the_toplevel_hash if commandline? and shall_we_store_the_main_hash_into_a_local_file? store_this_hash_into_a_local_file(the_primary_hash?) # ====================================================================== # # Only store local files if the variable # @store_the_results_into_local_files is true. # ====================================================================== # consider_storing_which_programs_are_not_up_to_date end end |
#run_already? ⇒ Boolean
#
run_already?
#
710 711 712 |
# File 'lib/environment_information/query/misc.rb', line 710 def run_already? @internal_hash[:run_already] end |
#runmode? ⇒ Boolean
#
runmode?
#
1406 1407 1408 |
# File 'lib/environment_information/query/misc.rb', line 1406 def runmode? @internal_hash[:runmode] end |
#screen_resolution? ⇒ Boolean
#
screen_resolution?
#
972 973 974 |
# File 'lib/environment_information/query/misc.rb', line 972 def screen_resolution? ::EnvironmentInformation.screen_resolution? end |
#set_array_work_on_these_components(i) ⇒ Object Also known as: set_main_array, set_display_these_components, set_use_this_as_main_input, set_report_these_programs, show_only_the_components_from_this_dataset
#
set_array_work_on_these_components
#
717 718 719 720 721 722 723 724 725 |
# File 'lib/environment_information/query/misc.rb', line 717 def set_array_work_on_these_components( i ) hash = primary_hash? i = [i].flatten i.each {|this_entry| hash[this_entry.to_sym] = nil } end |
#set_runmode_gui ⇒ Object
#
set_runmode_gui
#
1375 1376 1377 |
# File 'lib/environment_information/query/misc.rb', line 1375 def set_runmode_gui @internal_hash[:runmode] = :gui end |
#set_runmode_html ⇒ Object
#
set_runmode_html
#
1382 1383 1384 |
# File 'lib/environment_information/query/misc.rb', line 1382 def set_runmode_html @internal_hash[:runmode] = :html end |
#set_use_colours(i = true) ⇒ Object
#
set_use_colours
#
1854 1855 1856 1857 1858 1859 |
# File 'lib/environment_information/query/misc.rb', line 1854 def set_use_colours( i = true ) super() ::EnvironmentInformation.set_use_colours(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.
#
1087 1088 1089 |
# File 'lib/environment_information/query/misc.rb', line 1087 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?
#
1812 1813 1814 |
# File 'lib/environment_information/query/misc.rb', line 1812 def show_everything? @internal_hash[:show_everything] end |
#show_n_registered_entries ⇒ Object
#
show_n_registered_entries
Invoke this via:
envi --n_entries
#
1512 1513 1514 1515 1516 |
# File 'lib/environment_information/query/misc.rb', line 1512 def show_n_registered_entries e "#{true_rev}The EnvironmentInformation project contains "\ "#{sfancy(tracked_programs?.size)} "\ "#{true_rev}registered entries." end |
#show_ruby_version_and_gem_version? ⇒ Boolean
#
show_ruby_version_and_gem_version?
#
1684 1685 1686 |
# File 'lib/environment_information/query/misc.rb', line 1684 def show_ruby_version_and_gem_version? @internal_hash[:show_ruby_version_and_gem_version] end |
#show_the_registered_components(i = tracked_programs? ) ⇒ Object
#
show_the_registered_components
#
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 |
# File 'lib/environment_information/query/misc.rb', line 658 def show_the_registered_components( i = tracked_programs? ) e e "#{rev}The following components are currently 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 |
#sort_alphabetically? ⇒ Boolean
#
sort_alphabetically?
#
1963 1964 1965 |
# File 'lib/environment_information/query/misc.rb', line 1963 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
#
1195 1196 1197 1198 1199 |
# File 'lib/environment_information/query/misc.rb', line 1195 def start_gtk_component require 'environment_information/gui/gtk3/environment_information.rb' ::EnvironmentInformation.run_gtk @internal_hash[:do_exit_the_program] = true end |
#start_the_sinatra_interface ⇒ Object
#
start_the_sinatra_interface
#
1330 1331 1332 1333 |
# File 'lib/environment_information/query/misc.rb', line 1330 def start_the_sinatra_interface require 'environment_information/www/sinatra_interface.rb' ::EnvironmentInformation.start_sinatra_interface end |
#store_this_hash_into_a_local_file(hash = the_primary_hash?, , this_file = ::EnvironmentInformation.return_path_to_all_programs_file) ⇒ Object Also known as: consider_storing_the_components_that_were_displayed, consider_storing_which_components_were_displayed
#
store_this_hash_into_a_local_file
#
854 855 856 857 858 859 860 861 862 863 864 865 |
# File 'lib/environment_information/query/misc.rb', line 854 def store_this_hash_into_a_local_file( hash = the_primary_hash?, this_file = ::EnvironmentInformation.return_path_to_all_programs_file ) unless hash.empty? e e "#{rev}Storing these results into the local file at" e "`#{sfile(this_file)}#{rev}`." e ::EnvironmentInformation.store_this_hash_into_a_local_file(hash, this_file) end end |
#sync_the_primary_hash_onto_the_toplevel_hash(i = the_primary_hash? ) ⇒ Object
#
sync_the_primary_hash_onto_the_toplevel_hash
#
1302 1303 1304 1305 1306 1307 1308 1309 |
# File 'lib/environment_information/query/misc.rb', line 1302 def sync_the_primary_hash_onto_the_toplevel_hash( i = the_primary_hash? ) ::EnvironmentInformation.clear_hash i.each_pair {|key, value| ::EnvironmentInformation.add_to_hash(key, value.to_s.strip) } end |
#the_primary_hash? ⇒ Boolean Also known as: primary_hash?
#
the_primary_hash?
#
1345 1346 1347 |
# File 'lib/environment_information/query/misc.rb', line 1345 def the_primary_hash? @internal_hash[:the_primary_hash] end |
#try_to_rename_the_kde_konsole_tab? ⇒ Boolean
#
try_to_rename_the_kde_konsole_tab?
#
1819 1820 1821 |
# File 'lib/environment_information/query/misc.rb', line 1819 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.
#
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 |
# File 'lib/environment_information/query/misc.rb', line 1949 def use_ascii_table disable_colours # Can't use colours right now. Perhaps at a later time. extend Terminal::Table::TableHelper @internal_hash[:table] = table ['Name', 'Version'] @internal_hash[:table].style = { padding_left: 2, width: 110 # Set the width here. } @internal_hash[:use_ascii_table] = true end |
#use_one_line_to_show_the_result? ⇒ Boolean
#
use_one_line_to_show_the_result?
#
1768 1769 1770 |
# File 'lib/environment_information/query/misc.rb', line 1768 def use_one_line_to_show_the_result? @internal_hash[:use_one_line_to_show_the_result] end |
#version?(key = the_primary_hash?.keys.first) ⇒ Boolean
#
version?
#
1988 1989 1990 1991 1992 |
# File 'lib/environment_information/query/misc.rb', line 1988 def version?( key = the_primary_hash?.keys.first ) the_primary_hash?[key] 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
#
1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 |
# File 'lib/environment_information/query/misc.rb', line 1420 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 |
#work_on_these_components? ⇒ Boolean Also known as: result, components?, main_dataset?, main_entry?, dataset?, result?, array_obtain_these_programs?, array_with_entries?, main_array?, programs?, show_these_components?, array_display_these_components, array_work_on_these_components?, display_these_components?, display_which_components?, display, work_on_which_components?
#
work_on_these_components?
#
1352 1353 1354 |
# File 'lib/environment_information/query/misc.rb', line 1352 def work_on_these_components? primary_hash?.keys end |
#xorg_components? ⇒ Boolean Also known as: return_all_xorg_components
#
xorg_components?
#
1909 1910 1911 |
# File 'lib/environment_information/query/misc.rb', line 1909 def xorg_components? ::EnvironmentInformation.xorg_components? end |