environment_information 1.4.89

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of environment_information might be problematic. Click here for more details.

Files changed (94) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1276 -0
  3. data/bin/envi +7 -0
  4. data/bin/fast_envi +7 -0
  5. data/doc/README.gen +1044 -0
  6. data/doc/todo/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +48 -0
  7. data/environment_information.gemspec +135 -0
  8. data/lib/environment_information/base/base.rb +159 -0
  9. data/lib/environment_information/class/add.rb +187 -0
  10. data/lib/environment_information/class/colours.rb +283 -0
  11. data/lib/environment_information/class/constants.rb +35 -0
  12. data/lib/environment_information/class/environment_information.rb +51 -0
  13. data/lib/environment_information/class/help.rb +90 -0
  14. data/lib/environment_information/class/html.rb +78 -0
  15. data/lib/environment_information/class/initialize.rb +177 -0
  16. data/lib/environment_information/class/menu.rb +465 -0
  17. data/lib/environment_information/class/misc.rb +897 -0
  18. data/lib/environment_information/class/opn.rb +33 -0
  19. data/lib/environment_information/class/register_sigint.rb +20 -0
  20. data/lib/environment_information/class/reset.rb +217 -0
  21. data/lib/environment_information/class/ruby.rb +79 -0
  22. data/lib/environment_information/class/run.rb +61 -0
  23. data/lib/environment_information/class/show_display_and_report.rb +355 -0
  24. data/lib/environment_information/colours/colours.rb +211 -0
  25. data/lib/environment_information/colours/sfancy.rb +19 -0
  26. data/lib/environment_information/colours/simp.rb +19 -0
  27. data/lib/environment_information/constants/array_tracked_components.rb +210 -0
  28. data/lib/environment_information/constants/constants.rb +17 -0
  29. data/lib/environment_information/constants/encoding.rb +21 -0
  30. data/lib/environment_information/constants/error_line.rb +17 -0
  31. data/lib/environment_information/constants/file_constants.rb +102 -0
  32. data/lib/environment_information/constants/misc.rb +86 -0
  33. data/lib/environment_information/constants/namespace.rb +14 -0
  34. data/lib/environment_information/constants/newline.rb +16 -0
  35. data/lib/environment_information/constants/regex.rb +30 -0
  36. data/lib/environment_information/constants/temp_directory.rb +52 -0
  37. data/lib/environment_information/gui/gtk2/environment_information.rb +35 -0
  38. data/lib/environment_information/gui/gtk3/environment_information.rb +34 -0
  39. data/lib/environment_information/gui/libui/environment_information.rb +74 -0
  40. data/lib/environment_information/gui/shared_code/environment_information_module.rb +409 -0
  41. data/lib/environment_information/misc_components/README.md +3 -0
  42. data/lib/environment_information/misc_components/cflags.rb +36 -0
  43. data/lib/environment_information/misc_components/cpuinfo.rb +64 -0
  44. data/lib/environment_information/misc_components/operating_system.rb +54 -0
  45. data/lib/environment_information/misc_components/operating_system_bit_type.rb +42 -0
  46. data/lib/environment_information/misc_components/ram.rb +30 -0
  47. data/lib/environment_information/misc_components/rubygems_installation_directory.rb +54 -0
  48. data/lib/environment_information/misc_components/screen_resolution.rb +50 -0
  49. data/lib/environment_information/project/project.rb +27 -0
  50. data/lib/environment_information/queries/README.md +2 -0
  51. data/lib/environment_information/queries/complex_version.rb +272 -0
  52. data/lib/environment_information/queries/pkg_config.rb +125 -0
  53. data/lib/environment_information/queries/simple_version.rb +217 -0
  54. data/lib/environment_information/requires/require_asciitable.rb +15 -0
  55. data/lib/environment_information/requires/require_the_constants.rb +7 -0
  56. data/lib/environment_information/requires/require_the_environment_information_project.rb +23 -0
  57. data/lib/environment_information/requires/require_the_individual_misc_components.rb +30 -0
  58. data/lib/environment_information/requires/require_the_toplevel_methods.rb +22 -0
  59. data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +152 -0
  60. data/lib/environment_information/toplevel_methods/cd.rb +16 -0
  61. data/lib/environment_information/toplevel_methods/e.rb +43 -0
  62. data/lib/environment_information/toplevel_methods/hash.rb +60 -0
  63. data/lib/environment_information/toplevel_methods/internet_is_available.rb +30 -0
  64. data/lib/environment_information/toplevel_methods/is_on_roebe.rb +16 -0
  65. data/lib/environment_information/toplevel_methods/menu.rb +90 -0
  66. data/lib/environment_information/toplevel_methods/misc.rb +309 -0
  67. data/lib/environment_information/toplevel_methods/n_subcommands.rb +31 -0
  68. data/lib/environment_information/toplevel_methods/prefix_to_use.rb +39 -0
  69. data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +61 -0
  70. data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +45 -0
  71. data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +84 -0
  72. data/lib/environment_information/toplevel_methods/return_alias_to.rb +30 -0
  73. data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +28 -0
  74. data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +54 -0
  75. data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +28 -0
  76. data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +182 -0
  77. data/lib/environment_information/toplevel_methods/show_all_available_components.rb +192 -0
  78. data/lib/environment_information/toplevel_methods/write_what_into.rb +24 -0
  79. data/lib/environment_information/version/version.rb +25 -0
  80. data/lib/environment_information/www/sinatra_interface.rb +213 -0
  81. data/lib/environment_information/www/webobject_interface.cgi +29 -0
  82. data/lib/environment_information/yaml/array_default_programs_on_linux.yml +15 -0
  83. data/lib/environment_information/yaml/array_lfs_core_programs.yml +37 -0
  84. data/lib/environment_information/yaml/array_science_cluster.yml +12 -0
  85. data/lib/environment_information/yaml/array_tracked_non_programs.yml +13 -0
  86. data/lib/environment_information/yaml/array_tracked_programs.yml +207 -0
  87. data/lib/environment_information/yaml/array_tracked_xorg_components.yml +37 -0
  88. data/lib/environment_information/yaml/colours.yml +3 -0
  89. data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +256 -0
  90. data/lib/environment_information.rb +5 -0
  91. data/test/testing_environment_information.rb +26 -0
  92. data/test/testing_missing_components.rb +9 -0
  93. data/test/testing_prefix_for_the_environment_information_project.rb +20 -0
  94. metadata +191 -0
@@ -0,0 +1,897 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/class/misc.rb'
6
+ # =========================================================================== #
7
+ require 'environment_information/base/base.rb'
8
+
9
+ module EnvironmentInformation
10
+
11
+ class EnvironmentInformation < ::EnvironmentInformation::Base # === EnvironmentInformation::EnvironmentInformation
12
+
13
+ # ========================================================================= #
14
+ # === THE_PROGRAM_IS_NOT_INSTALLED_OR_COULD_NOT_BE_FOUND
15
+ # ========================================================================= #
16
+ THE_PROGRAM_IS_NOT_INSTALLED_OR_COULD_NOT_BE_FOUND =
17
+ '[The program is not installed or could not be found.]'.dup
18
+
19
+ require 'environment_information/constants/array_tracked_components.rb'
20
+ require 'environment_information/constants/misc.rb'
21
+ require 'environment_information/class/add.rb'
22
+ require 'environment_information/class/show_display_and_report.rb'
23
+ require 'environment_information/toplevel_methods/misc.rb'
24
+ require 'environment_information/toplevel_methods/write_what_into.rb'
25
+ require 'environment_information/version/version.rb'
26
+
27
+ # ========================================================================= #
28
+ # === report_the_installed_KDE_software_suite
29
+ # ========================================================================= #
30
+ def report_the_installed_KDE_software_suite
31
+ begin
32
+ require 'rbt/toplevel_methods/misc.rb'
33
+ require 'rbt/toplevel_methods/try_to_return_a_special_compile_component.rb'
34
+ require 'rbt/toplevel_methods/swift_return_version_of_this_program.rb'
35
+ array = RBT.return_kde_apps
36
+ append_this = ''.dup
37
+ if array and !array.empty?
38
+ e 'Now working through all registered KDE applications, trying to'
39
+ e 'show their version on the commandline:'
40
+ e
41
+ array.each {|this_program|
42
+ append_this.clear
43
+ # ================================================================= #
44
+ # The next line of code was added in August 2022 because ksmoothdock
45
+ # is misbehaving. At a later time we may have to review this;
46
+ # ideally we should not need any such ad-hoc exceptions ever.
47
+ # ================================================================= #
48
+ next if this_program == 'ksmoothdock'
49
+ print gold(
50
+ (' '+this_program+':').ljust(40)
51
+ )
52
+ cmd_to_use = "#{this_program} --version 2>&1"
53
+ version = `#{cmd_to_use}`
54
+ if version.include? "command not found\n"
55
+ version = THE_PROGRAM_IS_NOT_INSTALLED_OR_COULD_NOT_BE_FOUND
56
+ else
57
+ if version
58
+ # Remove the name of the program here e. g. "kcachegrind 21.12.1"
59
+ version.sub!(/#{this_program}/,'')
60
+ most_recent_version = ::RBT.swift_return_version_of_this_program(this_program.strip.downcase)
61
+ if RBT.is_this_version_higher_than_that_version?(
62
+ most_recent_version.to_s,
63
+ version.to_s,
64
+ :do_not_report_any_errors
65
+ )
66
+ append_this << orange(
67
+ "\n ^^^ This program could "\
68
+ "be updated to version "+
69
+ most_recent_version.to_s
70
+ )
71
+ end
72
+ end
73
+ end
74
+ version.strip!
75
+ if version.include? 'The program is not installed'
76
+ e lightblue(version)+append_this
77
+ else
78
+ e steelblue(version)+append_this
79
+ end
80
+ }
81
+ e
82
+ else
83
+ e 'The array appears to be empty.'
84
+ end
85
+ exit
86
+ rescue LoadError; end
87
+ end
88
+
89
+ # ========================================================================= #
90
+ # === is_a_registered_component?
91
+ # ========================================================================= #
92
+ def is_a_registered_component?(i)
93
+ ::EnvironmentInformation.is_this_component_included?(i)
94
+ end; alias is_an_allowed_entry? is_a_registered_component? # === is_an_allowed_entry?
95
+
96
+ # ========================================================================= #
97
+ # === tracked_programs?
98
+ # ========================================================================= #
99
+ def tracked_programs?
100
+ ARRAY_TRACKED_PROGRAMS
101
+ end
102
+
103
+ # ========================================================================= #
104
+ # === return_default_programs_on_linux
105
+ #
106
+ # This method should return the "main" programs on a linux computer,
107
+ # the most important entries.
108
+ # ========================================================================= #
109
+ def return_default_programs_on_linux
110
+ ARRAY_DEFAULT_PROGRAMS_ON_LINUX
111
+ end; alias return_default_programs_on_a_linux_computer return_default_programs_on_linux # === return_default_programs_on_a_linux_computer
112
+ alias return_default_programs return_default_programs_on_linux # === return_default_programs
113
+
114
+ # ========================================================================= #
115
+ # === do_show_almost_everything_excluding_the_default_linux_programs
116
+ #
117
+ # This is similar to do_show_everything() but it will not show
118
+ # the default linux programs.
119
+ # ========================================================================= #
120
+ def do_show_almost_everything_excluding_the_default_linux_programs
121
+ these_programs = return_every_registered_component
122
+ default_programs = return_default_programs
123
+ # ======================================================================= #
124
+ # Next subtract those that are part in the default_programs.
125
+ # ======================================================================= #
126
+ these_programs.reject! {|entry|
127
+ default_programs.include? entry
128
+ }
129
+ add(these_programs)
130
+ end
131
+
132
+ # ========================================================================= #
133
+ # === do_show_everything (everything tag, full tag)
134
+ #
135
+ # This method can be used when the user wishes to enable seeing
136
+ # full information about his local environment (on the computer).
137
+ #
138
+ # This will always display EVERY registered component.
139
+ #
140
+ # Commandline invocation:
141
+ #
142
+ # envi --everything
143
+ #
144
+ # ========================================================================= #
145
+ def do_show_everything
146
+ add(:everything) # Simply add everything.
147
+ end; alias do_show_full_information do_show_everything # === do_show_full_information
148
+ alias show_full_information do_show_everything # === show_full_information
149
+
150
+ # ========================================================================= #
151
+ # === consider_storing_the_components_that_were_displayed
152
+ # ========================================================================= #
153
+ def consider_storing_the_components_that_were_displayed
154
+ if store_the_results_into_local_files?
155
+ ::EnvironmentInformation.consider_storing_these_results_into_a_local_file
156
+ end
157
+ end; alias consider_storing_which_components_were_displayed consider_storing_the_components_that_were_displayed # === consider_storing_which_components_were_displayed
158
+
159
+ # ========================================================================= #
160
+ # === store_the_results_into_local_files?
161
+ # ========================================================================= #
162
+ def store_the_results_into_local_files?
163
+ @internal_hash[:store_the_results_into_local_files]
164
+ end
165
+
166
+ # ========================================================================= #
167
+ # === do_show_only_the_operating_system
168
+ #
169
+ # To invoke this method, try:
170
+ #
171
+ # envi --os?
172
+ #
173
+ # ========================================================================= #
174
+ def do_show_only_the_operating_system
175
+ clear_old_dataset
176
+ add(:operating_system)
177
+ end
178
+
179
+ # ========================================================================= #
180
+ # === can_we_query_the_mate_desktop?
181
+ # ========================================================================= #
182
+ def can_we_query_the_mate_desktop?
183
+ is_rbt_available? and RBT.const_defined?(:ReportMateDesktopVersion)
184
+ end
185
+
186
+ # ========================================================================= #
187
+ # === show_n_registered_entries
188
+ #
189
+ # Invoke this via:
190
+ #
191
+ # envi --n_entries
192
+ #
193
+ # ========================================================================= #
194
+ def show_n_registered_entries
195
+ e "#{true_rev}The EnvironmentInformation project contains "\
196
+ "#{sfancy(::EnvironmentInformation.tracked_programs?.size)} "\
197
+ "#{true_rev}registered entries."
198
+ end
199
+
200
+ # ========================================================================= #
201
+ # === assign_components_for_the_short_format
202
+ #
203
+ # We will only display 6 components when we use the short variant.
204
+ # ========================================================================= #
205
+ def assign_components_for_the_short_format
206
+ clear_old_dataset
207
+ dont_show_ruby_stuff
208
+ add(%i(
209
+ operating_system
210
+ operating_system_bit_type
211
+ cpuinfo
212
+ cflags
213
+ RAM
214
+ screen_resolution
215
+ ))
216
+ end
217
+
218
+ # ========================================================================= #
219
+ # === may_we_try_to_use_rbt?
220
+ # ========================================================================= #
221
+ def may_we_try_to_use_rbt?
222
+ @may_we_try_to_use_rbt
223
+ end
224
+
225
+ # ========================================================================= #
226
+ # === write_what_into
227
+ # ========================================================================= #
228
+ def write_what_into(what, into)
229
+ ::EnvironmentInformation.write_what_into(what, into)
230
+ end
231
+
232
+ # ========================================================================= #
233
+ # === work_on_the_programs_directory_only
234
+ #
235
+ # This works on the /home/Programs/ directory directly.
236
+ #
237
+ # Invocation example:
238
+ #
239
+ # envi --work-on-programs-directory-only
240
+ #
241
+ # ========================================================================= #
242
+ def work_on_the_programs_directory_only(
243
+ use_this_as_programs_directory = '/home/Programs/'
244
+ )
245
+ # ======================================================================= #
246
+ # 1) First, we have to determine which programs are available.
247
+ # ======================================================================= #
248
+ e "#{rev}Determining which programs are available at the prefix "\
249
+ "#{steelblue(use_this_as_programs_directory)}:"
250
+ array_these_programs_are_available = []
251
+ tracked_programs?.each {|entry|
252
+ target = "#{use_this_as_programs_directory}#{entry.capitalize}"
253
+ if File.directory?(target)
254
+ # =================================================================== #
255
+ # In this case we know that this target exists.
256
+ # =================================================================== #
257
+ array_these_programs_are_available << entry
258
+ end
259
+ }
260
+ # ======================================================================= #
261
+ # 2) Checking these programs next.
262
+ # ======================================================================= #
263
+ clear_main_dataset
264
+ add(array_these_programs_are_available)
265
+ ::EnvironmentInformation.set_prefix_to_use(use_this_as_programs_directory)
266
+ end
267
+
268
+ # ========================================================================= #
269
+ # === set_main_array
270
+ # ========================================================================= #
271
+ def set_main_array(i)
272
+ @array_report_these_programs = i
273
+ end; alias set_display_these_components set_main_array # === set_display_these_components
274
+ alias set_use_this_as_main_input set_main_array # === set_use_this_as_main_input
275
+ alias set_report_these_programs set_main_array # === set_report_these_programs
276
+ alias show_only_the_components_from_this_dataset set_main_array # === show_only_the_components_from_this_dataset
277
+
278
+ # ========================================================================= #
279
+ # === set_runmode_gui
280
+ # ========================================================================= #
281
+ def set_runmode_gui
282
+ @runmode = :gui
283
+ end
284
+
285
+ # ========================================================================= #
286
+ # === set_runmode_html
287
+ # ========================================================================= #
288
+ def set_runmode_html
289
+ @runmode = :html
290
+ end
291
+
292
+ # ========================================================================= #
293
+ # === do_exit_the_program
294
+ # ========================================================================= #
295
+ def do_exit_the_program
296
+ @do_exit_the_program = true
297
+ end
298
+
299
+ # ========================================================================= #
300
+ # === gui?
301
+ # ========================================================================= #
302
+ def gui?
303
+ @runmode == :gui
304
+ end
305
+
306
+ # ========================================================================= #
307
+ # === commandline?
308
+ #
309
+ # Whether we run in the "commandline mode" or whether we run in the
310
+ # GUI or WWW/HTML mode.
311
+ # ========================================================================= #
312
+ def commandline?
313
+ @runmode == :commandline
314
+ end
315
+
316
+ # ========================================================================= #
317
+ # === be_silent
318
+ # ========================================================================= #
319
+ def be_silent
320
+ @be_silent = true
321
+ end
322
+
323
+ # ========================================================================= #
324
+ # === set_be_silent
325
+ # ========================================================================= #
326
+ def set_be_silent(i = true)
327
+ @be_silent = i
328
+ end
329
+
330
+ # ========================================================================= #
331
+ # === be_silent?
332
+ # ========================================================================= #
333
+ def be_silent?
334
+ @be_silent
335
+ end
336
+
337
+ # ========================================================================= #
338
+ # === start_the_sinatra_interface
339
+ # ========================================================================= #
340
+ def start_the_sinatra_interface
341
+ require 'environment_information/www/sinatra_interface.rb'
342
+ ::EnvironmentInformation.start_sinatra_interface
343
+ end
344
+
345
+ # ========================================================================= #
346
+ # === do_not_display_the_result
347
+ # ========================================================================= #
348
+ def do_not_display_the_result
349
+ @display_result = false
350
+ end
351
+
352
+ # ========================================================================= #
353
+ # === do_rename_kde_konsole
354
+ #
355
+ # This will attempt to rename the KDE Konsole tab, but only if we are
356
+ # on roebe.
357
+ # ========================================================================= #
358
+ def do_rename_kde_konsole(
359
+ use_this_title = 'Environment Information'
360
+ )
361
+ begin
362
+ require 'roebe/requires/require_kde_konsole.rb'
363
+ rescue LoadError; end
364
+ if try_to_rename_the_kde_konsole_tab? and
365
+ is_on_roebe? and
366
+ Object.const_defined?(:Roebe) and
367
+ Roebe.const_defined?(:KdeKonsole)
368
+ Roebe.rename_konsole(use_this_title)
369
+ end
370
+ end
371
+
372
+ # ========================================================================= #
373
+ # === use_ascii_table
374
+ #
375
+ # We will display in ascii-table format here.
376
+ # ========================================================================= #
377
+ def use_ascii_table
378
+ disable_colours # Can't use colours right now. Perhaps at a later time.
379
+ extend Terminal::Table::TableHelper
380
+ @table = table ['Name', 'Version']
381
+ @table.style = {
382
+ padding_left: 2,
383
+ width: 110 # Set the width here.
384
+ }
385
+ @use_ascii_table = true
386
+ end
387
+
388
+ # ========================================================================= #
389
+ # === show_everything?
390
+ # ========================================================================= #
391
+ def show_everything?
392
+ @show_everything
393
+ end
394
+
395
+ # ========================================================================= #
396
+ # === try_to_rename_the_kde_konsole_tab?
397
+ # ========================================================================= #
398
+ def try_to_rename_the_kde_konsole_tab?
399
+ @internal_hash[:try_to_rename_the_kde_konsole_tab]
400
+ end
401
+
402
+ # ========================================================================= #
403
+ # === do_not_run_already
404
+ # ========================================================================= #
405
+ def do_not_run_already
406
+ @run_already = false
407
+ end; alias do_not_run do_not_run_already # === do_not_run
408
+
409
+ # ========================================================================= #
410
+ # === open_this_file_in_editor
411
+ # ========================================================================= #
412
+ def open_this_file_in_editor
413
+ _ = "bluefish #{THIS_FILE}"
414
+ e _; system _; exit
415
+ end
416
+
417
+ # ========================================================================= #
418
+ # === xorg_components?
419
+ # ========================================================================= #
420
+ def xorg_components?
421
+ ::EnvironmentInformation.xorg_components?
422
+ end; alias return_all_xorg_components xorg_components? # === return_all_xorg_components
423
+
424
+ # ========================================================================= #
425
+ # === do_show_only_the_xorg_components
426
+ #
427
+ # This method will essentially clear the old dataset before adding
428
+ # all xorg-components to the display-part of this class.
429
+ #
430
+ # The components that are appended here, are defined in the file
431
+ # constants/array_tracked_components.rb - so if you wish to add
432
+ # new xorg-related entries, you should modify the entries in that
433
+ # .rb file.
434
+ # ========================================================================= #
435
+ def do_show_only_the_xorg_components
436
+ clear_old_dataset
437
+ do_not_show_the_ruby_components
438
+ add(:all_xorg_components)
439
+ end
440
+
441
+ # ========================================================================= #
442
+ # === clear_old_dataset
443
+ # ========================================================================= #
444
+ def clear_old_dataset
445
+ @array_report_these_programs.clear
446
+ end
447
+
448
+ # ========================================================================= #
449
+ # === shall_we_really_store_which_programs_are_not_up_to_date?
450
+ #
451
+ # This method will also honour whether the user is on a roebe-like
452
+ # system or whether the user is not.
453
+ # ========================================================================= #
454
+ def shall_we_really_store_which_programs_are_not_up_to_date?
455
+ is_on_roebe? and !@array_these_programs_not_up_to_date.empty?
456
+ end
457
+
458
+ # ========================================================================= #
459
+ # === result_as_array
460
+ #
461
+ # The lines that we will have inside of this method, may look like this:
462
+ #
463
+ # " operating_system: GNU/Linux\n"
464
+ #
465
+ # ========================================================================= #
466
+ def result_as_array
467
+ _ = dataset_as_string
468
+ splitted = _.split("\n")
469
+ splitted.map! {|inner_line|
470
+ inner_line.split(': ').map {|entry| entry.strip }
471
+ }
472
+ return splitted
473
+ end; alias result result_as_array # === result
474
+
475
+ # ========================================================================= #
476
+ # === use_one_line_to_show_the_result?
477
+ # ========================================================================= #
478
+ def use_one_line_to_show_the_result?
479
+ @internal_hash[:use_one_line_to_show_the_result]
480
+ end
481
+
482
+ # ========================================================================= #
483
+ # === clear_the_main_dataset
484
+ # ========================================================================= #
485
+ def clear_the_main_dataset
486
+ clear_old_dataset
487
+ do_not_display_the_ruby_components
488
+ end; alias clear_main_dataset clear_the_main_dataset # === clear_main_dataset
489
+ alias empty_main_dataset clear_the_main_dataset # === empty_main_dataset
490
+ alias empty_main_array clear_the_main_dataset # === empty_main_array
491
+
492
+ # ========================================================================= #
493
+ # === clear_toplevel_hash
494
+ # ========================================================================= #
495
+ def clear_toplevel_hash
496
+ ::EnvironmentInformation.clear_hash
497
+ end
498
+
499
+ # ========================================================================= #
500
+ # === dataset_as_string
501
+ #
502
+ # This method must return the dataset in String format. That String
503
+ # must already be properly "formatted".
504
+ # ========================================================================= #
505
+ def dataset_as_string
506
+ _ = ''.dup # Put the information onto that String here.
507
+ main_dataset?.each {|entry|
508
+ if entry.is_a? Array
509
+ entry = entry.first # The second entry is ignored in that event.
510
+ end
511
+ # ===================================================================== #
512
+ # Before we can use .send() we have to check whether EnvironmentInformation
513
+ # actually responds to that method. If not then we will simply skip
514
+ # this snippet for now; but this may have to be changed at some
515
+ # point in the future, to more elegantly handle failure. (Sep 2019).
516
+ # ===================================================================== #
517
+ use_this_method = "return_version_of_#{entry}".to_sym
518
+ if ::EnvironmentInformation.respond_to? use_this_method
519
+ program_version = ::EnvironmentInformation.send(
520
+ use_this_method
521
+ )
522
+ entry = " #{entry}:"
523
+ _ << "#{entry} #{program_version}#{N}"
524
+ end
525
+ }
526
+ return _ # And return the generated String.
527
+ end; alias string? dataset_as_string # === string?
528
+ alias string dataset_as_string # === string
529
+ alias main_string? dataset_as_string # === main_string?
530
+ alias stringified dataset_as_string # === stringified
531
+
532
+ # ========================================================================= #
533
+ # === return_version_of_awk?
534
+ # ========================================================================= #
535
+ def return_version_of_awk?
536
+ ::EnvironmentInformation.send(__method__)
537
+ end; alias return_version_of_awk return_version_of_awk? # == return_version_of_awk
538
+
539
+ # ========================================================================= #
540
+ # === return_version_of_binutils?
541
+ # ========================================================================= #
542
+ def return_version_of_binutils?
543
+ ::EnvironmentInformation.send(__method__)
544
+ end; alias return_version_of_binutils return_version_of_binutils? # == return_version_of_binutils
545
+
546
+ # ========================================================================= #
547
+ # === return_version_of_coreutils?
548
+ # ========================================================================= #
549
+ def return_version_of_coreutils?
550
+ ::EnvironmentInformation.send(__method__)
551
+ end; alias return_version_of_coreutils return_version_of_coreutils? # == return_version_of_coreutils
552
+
553
+ # ========================================================================= #
554
+ # === return_version_of_diffutils?
555
+ # ========================================================================= #
556
+ def return_version_of_diffutils?
557
+ ::EnvironmentInformation.send(__method__)
558
+ end; alias return_version_of_diffutils return_version_of_diffutils? # == return_version_of_diffutils
559
+
560
+ # ========================================================================= #
561
+ # === return_version_of_gcc?
562
+ # ========================================================================= #
563
+ def return_version_of_gcc?
564
+ ::EnvironmentInformation.send(__method__)
565
+ end; alias return_version_of_gcc return_version_of_gcc? # == return_version_of_gcc
566
+
567
+ # ========================================================================= #
568
+ # === return_version_of_linux_kernel?
569
+ # ========================================================================= #
570
+ def return_version_of_linux_kernel?
571
+ ::EnvironmentInformation.send(__method__)
572
+ end; alias return_version_of_linux_kernel return_version_of_linux_kernel? # == return_version_of_linux_kernel
573
+
574
+ # ========================================================================= #
575
+ # === is_this_program_included?
576
+ # ========================================================================= #
577
+ def is_this_program_included?(i)
578
+ ::EnvironmentInformation.is_this_program_included?(i)
579
+ end
580
+
581
+ # ========================================================================= #
582
+ # === return_version_of_glibc?
583
+ # ========================================================================= #
584
+ def return_version_of_glibc?
585
+ ::EnvironmentInformation.send(__method__)
586
+ end; alias return_version_of_glibc return_version_of_glibc? # == return_version_of_glibc
587
+
588
+ # ========================================================================= #
589
+ # === return_version_of_intltool?
590
+ # ========================================================================= #
591
+ def return_version_of_intltool?
592
+ ::EnvironmentInformation.send(__method__)
593
+ end; alias return_version_of_intltool return_version_of_intltool? # == return_version_of_intltool
594
+
595
+ # ========================================================================= #
596
+ # === return_version_of_grep?
597
+ # ========================================================================= #
598
+ def return_version_of_grep?
599
+ ::EnvironmentInformation.send(__method__)
600
+ end; alias return_version_of_grep return_version_of_grep? # == return_version_of_grep
601
+
602
+ # ========================================================================= #
603
+ # === return_version_of_gnupg?
604
+ # ========================================================================= #
605
+ def return_version_of_gnupg?
606
+ ::EnvironmentInformation.send(__method__)
607
+ end; alias return_version_of_gnupg return_version_of_gnupg? # == return_version_of_gnupg
608
+
609
+ # ========================================================================= #
610
+ # === return_version_of_bison?
611
+ # ========================================================================= #
612
+ def return_version_of_bison?
613
+ ::EnvironmentInformation.send(__method__)
614
+ end; alias return_version_of_bison return_version_of_bison? # == return_version_of_bison
615
+
616
+ # ========================================================================= #
617
+ # === return_version_of_flex?
618
+ # ========================================================================= #
619
+ def return_version_of_flex?
620
+ ::EnvironmentInformation.send(__method__)
621
+ end; alias return_version_of_flex return_version_of_flex? # == return_version_of_flex
622
+
623
+ # ========================================================================= #
624
+ # === operating_system?
625
+ #
626
+ # To quickly test this method, try:
627
+ #
628
+ # EnvironmentInformation::EnvironmentInformation.new { :do_not_run_yet }.operating_system?
629
+ #
630
+ # ========================================================================= #
631
+ def operating_system?
632
+ ::EnvironmentInformation.send(__method__)
633
+ end; alias return_version_of_operating_system operating_system? # === return_version_of_operating_system
634
+
635
+ # ========================================================================= #
636
+ # === load_dataset_from_this_file
637
+ #
638
+ # This method can be used to read which programs will be displayed
639
+ # from a local file, rather than rely on the pre-set default.
640
+ # ========================================================================= #
641
+ def load_dataset_from_this_file(i)
642
+ if File.exist? i
643
+ File.readlines(i).map {|entry|
644
+ entry.delete('-').strip # ← Clean up the input a little bit.
645
+ }
646
+ else
647
+ opnn; e "No file exists at `#{sfile(i)}`."
648
+ end
649
+ end; alias try_to_load_dataset_from_this_file load_dataset_from_this_file # === try_to_load_dataset_from_this_file
650
+ alias try_to_read_content_from_this_file load_dataset_from_this_file # === try_to_read_content_from_this_file
651
+
652
+ # ========================================================================= #
653
+ # === consider_storing_which_programs_are_not_up_to_date
654
+ # ========================================================================= #
655
+ def consider_storing_which_programs_are_not_up_to_date
656
+ if shall_we_really_store_which_programs_are_not_up_to_date?
657
+ into = FILE_THESE_PROGRAMS_CAN_BE_UPGRADED
658
+ what = YAML.dump(@array_these_programs_not_up_to_date)
659
+ if File.directory?('/home/Temp/rbt/')
660
+ into = "/home/Temp/rbt/#{File.basename(into)}"
661
+ else
662
+ into = "#{log_dir?}#{File.basename(into)}"
663
+ end
664
+ opnn; e 'We will also store which programs are not up to date.'
665
+ opnn; e "These will be stored into the file at `#{sfile(into)}`."
666
+ ::EnvironmentInformation.write_what_into(what, into)
667
+ end
668
+ end
669
+
670
+ require 'environment_information/misc_components/operating_system_bit_type.rb'
671
+ # ========================================================================= #
672
+ # === bit_type?
673
+ # ========================================================================= #
674
+ def bit_type?
675
+ ::EnvironmentInformation.operating_system_bit_type
676
+ end
677
+
678
+ # ========================================================================= #
679
+ # === register_unavailable_program
680
+ #
681
+ # Programs that were not be found can be registered through this method.
682
+ # ========================================================================= #
683
+ def register_unavailable_program(i)
684
+ i = i.to_sym # Let's store only Symbols.
685
+ @array_unavailable_programs << i
686
+ end; alias register_not_found register_unavailable_program # === register_not_found
687
+
688
+ require 'environment_information/misc_components/cpuinfo.rb'
689
+ # ========================================================================= #
690
+ # === cpu_model?
691
+ # ========================================================================= #
692
+ def cpu_model?
693
+ ::EnvironmentInformation.cpuinfo?
694
+ end
695
+
696
+ require 'environment_information/misc_components/ram.rb'
697
+ # ========================================================================= #
698
+ # === ram?
699
+ # ========================================================================= #
700
+ def ram?
701
+ ::EnvironmentInformation.ram?
702
+ end
703
+
704
+ require 'environment_information/misc_components/screen_resolution.rb'
705
+ # ========================================================================= #
706
+ # === screen_resolution?
707
+ # ========================================================================= #
708
+ def screen_resolution?
709
+ ::EnvironmentInformation.screen_resolution?
710
+ end
711
+
712
+ require 'environment_information/misc_components/cflags.rb'
713
+ # ========================================================================= #
714
+ # === cflags_in_use?
715
+ # ========================================================================= #
716
+ def cflags_in_use?
717
+ ::EnvironmentInformation.cflags_in_use?
718
+ end
719
+
720
+ # ========================================================================= #
721
+ # === return_every_registered_component
722
+ # ========================================================================= #
723
+ def return_every_registered_component
724
+ array = ::EnvironmentInformation.tracked_programs?+
725
+ ::EnvironmentInformation.tracked_non_programs?+
726
+ ::EnvironmentInformation.science_cluster?+
727
+ ::EnvironmentInformation.xorg_components?
728
+ array = array.flatten.uniq
729
+ # ======================================================================= #
730
+ # === The mate-desktop
731
+ #
732
+ # Since as of 31.03.2019 we will also try to show the mate-desktop
733
+ # components if the RBT project is available/installed.
734
+ # ======================================================================= #
735
+ if can_we_query_the_mate_desktop?
736
+ # ===================================================================== #
737
+ # Keep in mind that this Array is nested, so the name is
738
+ # included as well as the version.
739
+ # ===================================================================== #
740
+ _ = RBT.return_mate_desktop_version_array
741
+ _.each {|a,b|
742
+ # array << [a, b]
743
+ array << a
744
+ register_onto_the_main_hash(a, b)
745
+ }
746
+ end
747
+ return array # Return our findings.
748
+ end
749
+
750
+ # ========================================================================= #
751
+ # === clear_hash_and_missing_components
752
+ # ========================================================================= #
753
+ def clear_hash_and_missing_components
754
+ clear_toplevel_hash
755
+ clear_missing_components
756
+ end
757
+
758
+ # ========================================================================= #
759
+ # === clear_missing_components
760
+ # ========================================================================= #
761
+ def clear_missing_components
762
+ ::EnvironmentInformation.clear_missing_components
763
+ end
764
+
765
+ # ========================================================================= #
766
+ # === return_remote_gtk2_version
767
+ #
768
+ # Be wary when using this method, as it may slow down the whole
769
+ # application, due to making remote web-based queries.
770
+ # ========================================================================= #
771
+ def return_remote_gtk2_version
772
+ ::EnvironmentInformation.return_remote_gtk2_version
773
+ end
774
+
775
+ # ========================================================================= #
776
+ # === do_compare_the_program_version
777
+ #
778
+ # This method can be used if the user wishes to also compare the
779
+ # program version of the installed programs. This functionality
780
+ # depends on the rbt gem, and the RBT namespace.
781
+ # ========================================================================= #
782
+ def do_compare_the_program_version(
783
+ be_verbose = true
784
+ )
785
+ if be_verbose
786
+ @array_show_this_to_the_user <<
787
+ 'The program versions will also be compared.'
788
+ end
789
+ @internal_hash[:compare_program_versions] = true
790
+ end
791
+
792
+ # ========================================================================= #
793
+ # === compare_program_versions?
794
+ # ========================================================================= #
795
+ def compare_program_versions?
796
+ @internal_hash[:compare_program_versions]
797
+ end; alias compare_program_version? compare_program_versions? # === compare_program_version?
798
+
799
+ # ========================================================================= #
800
+ # === is_rbt_available_and_may_we_try_to_use_rbt?
801
+ # ========================================================================= #
802
+ def is_rbt_available_and_may_we_try_to_use_rbt?
803
+ is_rbt_available? and may_we_try_to_use_rbt?
804
+ end
805
+
806
+ # ========================================================================= #
807
+ # === report_the_remote_urls?
808
+ # ========================================================================= #
809
+ def report_the_remote_urls?
810
+ @internal_hash[:report_the_remote_urls]
811
+ end
812
+
813
+ # ========================================================================= #
814
+ # === return_version_of_busyboxy?
815
+ # ========================================================================= #
816
+ def return_version_of_busyboxy?
817
+ ::EnvironmentInformation.send(__method__)
818
+ end; alias return_version_of_busyboxy return_version_of_busyboxy? # == return_version_of_busyboxy
819
+
820
+ # ========================================================================= #
821
+ # === return_version_of_boost?
822
+ # ========================================================================= #
823
+ def return_version_of_boost?
824
+ ::EnvironmentInformation.send(__method__)
825
+ end; alias return_version_of_boost return_version_of_boost? # == return_version_of_boost
826
+
827
+ # ========================================================================= #
828
+ # === return_version_of_xvid?
829
+ # ========================================================================= #
830
+ def return_version_of_xvid?
831
+ ::EnvironmentInformation.send(__method__)
832
+ end; alias return_version_of_xvid return_version_of_xvid? # == return_version_of_xvid
833
+
834
+ # ========================================================================= #
835
+ # === start_gtk_component
836
+ #
837
+ # To invoke this method from the commandline, do:
838
+ #
839
+ # envi --start-gtk
840
+ #
841
+ # ========================================================================= #
842
+ def start_gtk_component
843
+ require 'environment_information/gui/gtk3/environment_information.rb'
844
+ ::EnvironmentInformation.run_gtk
845
+ @do_exit_the_program = true
846
+ end
847
+
848
+ # ========================================================================= #
849
+ # === do_sort_alphabetically (sort tag)
850
+ #
851
+ # Some entries are Symbols, which is why we have to call .to_s in the
852
+ # method here.
853
+ # ========================================================================= #
854
+ def do_sort_alphabetically(
855
+ display_these_components = display_which_components?
856
+ )
857
+ _ = display_these_components.sort_by {|name, version| name.to_s }
858
+ set_main_array(_)
859
+ end
860
+
861
+ # ========================================================================= #
862
+ # === do_not_save_anything
863
+ # ========================================================================= #
864
+ def do_not_save_anything
865
+ @shall_the_results_be_saved = false
866
+ # ======================================================================= #
867
+ # We will also avoid saving the results into a local yaml file.
868
+ # ======================================================================= #
869
+ @internal_hash[:store_the_results_into_local_files] = false
870
+ end; alias do_not_store_anything do_not_save_anything # === do_not_store_anything
871
+
872
+ # ========================================================================= #
873
+ # === do_display_in_a_short_format
874
+ #
875
+ # The short-format means that we will use only a compact set of
876
+ # programs to display. For example, "make" and "bash" will not be
877
+ # displayed, neither "binutils" or "ruby".
878
+ # ========================================================================= #
879
+ def do_display_in_a_short_format
880
+ @display_everything_in_short_format = true
881
+ end
882
+
883
+ # ========================================================================= #
884
+ # === sort_alphabetically?
885
+ # ========================================================================= #
886
+ def sort_alphabetically?
887
+ @internal_hash[:sort_alphabetically]
888
+ end
889
+
890
+ # ========================================================================= #
891
+ # === enable_sort_alphabetically
892
+ # ========================================================================= #
893
+ def enable_sort_alphabetically
894
+ @internal_hash[:sort_alphabetically] = true
895
+ end
896
+
897
+ end; end