environment_information 1.4.29

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 (89) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1061 -0
  3. data/bin/envi +7 -0
  4. data/bin/fast_envi +7 -0
  5. data/doc/README.gen +893 -0
  6. data/doc/TODO_FOR_THE_ENVIRONMENT_INFORMATION_PROJECT.md +54 -0
  7. data/environment_information.gemspec +130 -0
  8. data/lib/environment_information/base/base.rb +113 -0
  9. data/lib/environment_information/class/add.rb +186 -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 +86 -0
  14. data/lib/environment_information/class/html.rb +78 -0
  15. data/lib/environment_information/class/initialize.rb +178 -0
  16. data/lib/environment_information/class/menu.rb +436 -0
  17. data/lib/environment_information/class/misc.rb +821 -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 +213 -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 +310 -0
  24. data/lib/environment_information/colours/colours.rb +150 -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 +207 -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/gtk/bindings.rb +300 -0
  38. data/lib/environment_information/misc_components/README.md +3 -0
  39. data/lib/environment_information/misc_components/cflags.rb +36 -0
  40. data/lib/environment_information/misc_components/cpuinfo.rb +64 -0
  41. data/lib/environment_information/misc_components/operating_system.rb +54 -0
  42. data/lib/environment_information/misc_components/operating_system_bit_type.rb +42 -0
  43. data/lib/environment_information/misc_components/ram.rb +30 -0
  44. data/lib/environment_information/misc_components/rubygems_installation_directory.rb +54 -0
  45. data/lib/environment_information/misc_components/screen_resolution.rb +50 -0
  46. data/lib/environment_information/project/project.rb +27 -0
  47. data/lib/environment_information/queries/README.md +2 -0
  48. data/lib/environment_information/queries/complex_version.rb +263 -0
  49. data/lib/environment_information/queries/pkg_config.rb +125 -0
  50. data/lib/environment_information/queries/simple_version.rb +211 -0
  51. data/lib/environment_information/requires/require_asciitable.rb +15 -0
  52. data/lib/environment_information/requires/require_the_constants.rb +7 -0
  53. data/lib/environment_information/requires/require_the_environment_information_project.rb +23 -0
  54. data/lib/environment_information/requires/require_the_individual_misc_components.rb +30 -0
  55. data/lib/environment_information/requires/require_the_toplevel_methods.rb +22 -0
  56. data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +152 -0
  57. data/lib/environment_information/toplevel_methods/cd.rb +16 -0
  58. data/lib/environment_information/toplevel_methods/e.rb +30 -0
  59. data/lib/environment_information/toplevel_methods/hash.rb +60 -0
  60. data/lib/environment_information/toplevel_methods/internet_is_available.rb +30 -0
  61. data/lib/environment_information/toplevel_methods/is_on_roebe.rb +16 -0
  62. data/lib/environment_information/toplevel_methods/menu.rb +90 -0
  63. data/lib/environment_information/toplevel_methods/misc.rb +264 -0
  64. data/lib/environment_information/toplevel_methods/n_subcommands.rb +31 -0
  65. data/lib/environment_information/toplevel_methods/prefix_to_use.rb +39 -0
  66. data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +61 -0
  67. data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +45 -0
  68. data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +84 -0
  69. data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +28 -0
  70. data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +54 -0
  71. data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +28 -0
  72. data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +186 -0
  73. data/lib/environment_information/toplevel_methods/show_all_available_components.rb +192 -0
  74. data/lib/environment_information/toplevel_methods/write_what_into.rb +24 -0
  75. data/lib/environment_information/version/version.rb +25 -0
  76. data/lib/environment_information/www/sinatra_interface.rb +213 -0
  77. data/lib/environment_information/www/webobject_interface.cgi +29 -0
  78. data/lib/environment_information/yaml/array_default_programs_on_linux.yml +14 -0
  79. data/lib/environment_information/yaml/array_lfs_core_programs.yml +35 -0
  80. data/lib/environment_information/yaml/array_science_cluster.yml +12 -0
  81. data/lib/environment_information/yaml/array_tracked_non_programs.yml +13 -0
  82. data/lib/environment_information/yaml/array_tracked_programs.yml +165 -0
  83. data/lib/environment_information/yaml/array_tracked_xorg_components.yml +34 -0
  84. data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +215 -0
  85. data/lib/environment_information.rb +5 -0
  86. data/test/testing_environment_information.rb +26 -0
  87. data/test/testing_missing_components.rb +9 -0
  88. data/test/testing_prefix_for_the_environment_information_project.rb +20 -0
  89. metadata +195 -0
data/README.md ADDED
@@ -0,0 +1,1061 @@
1
+ [![forthebadge](http://forthebadge.com/images/badges/built-with-love.svg)](https://www.gobolinux.org/)
2
+ [![forthebadge](http://forthebadge.com/images/badges/made-with-ruby.svg)](https://www.ruby-lang.org/en/)
3
+ [![Gem Version](https://badge.fury.io/rb/environment_information.svg)](https://badge.fury.io/rb/environment_information)
4
+
5
+ ## About the environment_information gem
6
+
7
+ This project is called **EnvironmentInformation** (**environment information**).
8
+
9
+ Its primary goal is **to gather information about the environment that ruby is
10
+ presently running on** - in other words, **the host system** and its
11
+ capabilities.
12
+
13
+ This gathered information can then be shown to the user on the commandline,
14
+ or via a ruby-gtk widget, or via a sinatra-interface on the www. The main focus
15
+ for this project is on the **commandline-usage**, though. For example, the
16
+ file at **bin/fenvi**, which is part of this project, can be used to
17
+ quickly show all versions of different programs on the target computer
18
+ system.
19
+
20
+ To provide a short overview how this may look, taken on the **KDE konsole**
21
+ and **bash**, have a look at the following image:
22
+
23
+ ![alt text][screenshot1]
24
+ [screenshot1]: https://i.imgur.com/KiXIIVV.png
25
+
26
+ Invocation example:
27
+
28
+ fenvi
29
+
30
+ Generated output (only showing the first five entries):
31
+
32
+ atk 2.32.0
33
+ bash 5.0.0
34
+ binutils 2.32
35
+ bison 3.4.1
36
+ bzip2 1.0.8
37
+
38
+ Do note that by default **colours** will be used, so atk may appear
39
+ in green, and the associated version will be shown in a blue
40
+ colour (actually steelblue, by default). If you do not want to use
41
+ colours, you can disable them for the current invocation run, like
42
+ in this way:
43
+
44
+ envi --no-colours
45
+ envi --no-colors
46
+ envi --disable-colours
47
+ envi --disable-colors
48
+
49
+ Take note that you can tweak most of the behaviour of **EnvironmentInformation**
50
+ via specific **commandline flags**.
51
+
52
+ To obtain **a listing of the available options**, you can invoke the
53
+ main executable called **envi** (**bin/envi**) via:
54
+
55
+ envi --help
56
+
57
+ What is meant with the term **environment**?
58
+
59
+ **Definition**:
60
+
61
+ The term **environment**, within the context of the **environment_information gem**,
62
+ is **the (software) environment** that can be discovered by the ruby version
63
+ found within the **$PATH** variable, on the given computer system at hand.
64
+
65
+ Recall that there may be situations where there is more than one
66
+ version of ruby installed, on a given computer system, in different
67
+ locations - e. g. **/usr/bin/** versus **/usr/local/bin/**
68
+ versus **/home/** or **/opt/** setups. Thus, $PATH should be kept in mind in
69
+ the event that you have multiple ruby versions on the given computer system
70
+ at hand, as the incorrect ruby version may be discovered, in certain
71
+ situations. Furthermore keep also in mind that multiple binaries may exist
72
+ at the target system, e. g. bzip at /bin but also at /usr/bin or elsewhere.
73
+
74
+ Thus, I recommend to always ensure that **$PATH** is correctly set on the
75
+ target machine. First come, first serve, so it is a good advice to keep
76
+ PATH clean, and 'logical'.
77
+
78
+ At any rate, the **information** that will be gathered by the
79
+ **EnvironmentInformation** project may also be stored more persistently
80
+ in a **standalone .html file**, if you so desire to. This .html file
81
+ could then be used for static display of the information (but may
82
+ become quickly outdated, so keep this in mind as well).
83
+
84
+ The **Environment information** project may include any of the
85
+ following as its output:
86
+
87
+ - The **GCC Version** in use on the given computer host system.
88
+ - The (Linux) Kernel in use.
89
+ - Which Ruby Version is used.
90
+ - Which Rubygem version is used.
91
+ - The path to the rubygem directory.
92
+ - What the Host CPU Model is (on Linux at the least).
93
+ - What is the the **GTK*+, **GLIB*+ and **gdk-pixbuf** version, respectively.
94
+ - Which **dhcpcd version** is available.
95
+ - What Xorg components are available, such as libX11, libxcm, libxp,
96
+ libxau.
97
+
98
+ And so on and so forth - and a lot more.
99
+
100
+ Why are there many **different ways** to query the version of a locally
101
+ installed programs?
102
+
103
+ The main reason as to why **different ways** have to be supported is because
104
+ different software is installed in different ways, making use of
105
+ information in, well - different ways.
106
+
107
+ For example: not every software comes with a **.pc** file, so we can not
108
+ rely on .pc files uniformly for every installed program. Sometines no
109
+ commandline-binary is provided, so the **--version** flag can not be
110
+ used either; and if no .pc file exists for a given program, we may
111
+ have to query the name of the **.so files** (on a linux system),
112
+ and infer the version from that.
113
+
114
+ The main class in this project is **class EnvironmentInformation**,
115
+ which resides under **module EnvironmentInformation**.
116
+
117
+ The actual query of the version is done on the toplevel, so for example:
118
+
119
+ EnvironmentInformation.gcc?
120
+
121
+ would display the version of GCC at hand.
122
+
123
+ The code there will typically try to query .pc files via **pkg**-config,
124
+ but may sometimes try to infer the version from the .so file at hand,
125
+ and sometimes it will try to run the system binary (or an associated
126
+ binary) with a -V or -v or --version flag, and parse that output.
127
+
128
+ Typically the components that will be displayed, are handled by code
129
+ that resides in the file **display.rb**. The instance variable
130
+ **@display_these_components** keeps track of which components will
131
+ be displayed, so that information about these disparate programs
132
+ and components can be tracked.
133
+
134
+ There are in general only two entries that are of interest to
135
+ class EnvironmentInformation here:
136
+
137
+ (a) The name of the program.
138
+ (b) The associated specific program version, as String, of that program.
139
+
140
+ So, for example, we may see a key→value association like:
141
+
142
+ ruby => 2.5.1
143
+
144
+ If you need a **String** representation of the dataset then you can
145
+ use the method <b>.string?</b> or <b>.stringified</b>, which will give
146
+ you a **String** instead. The **.stringified** method exists
147
+ primarily due to **convenience** alone, for people who don't
148
+ want to do much conversion on their own and just be done with it).
149
+
150
+ There are various additional helper methods, such as a reader-method
151
+ called <b>.main_string?</b> or <b>.string</b> (they are equivalent to
152
+ one another, aka one is an alias).
153
+
154
+ This should allow you to re-use the information from this gem in
155
+ other projects, such as if you wish to get the String of all
156
+ available programs, and display this on a webpage. Or, alternatively,
157
+ just use a toplevel method call, such as:
158
+
159
+ EnvironmentInformation.glibc_version?
160
+
161
+ ## How to make use of the project
162
+
163
+ There are, essentially, three recommended ways how to use the main
164
+ class of this project:
165
+
166
+ (1)
167
+
168
+ From the commandline, just call **envi** directly and pass in
169
+ specific commands to this executable (optionally).
170
+
171
+ For instance: invoke the envi-executable with the argument "ALL"
172
+ or "--all" and the class will show all information that could
173
+ be found. This is personally my favourite way how to invoke
174
+ this class. I even combine it with "FALL" or "RALL" (**--really-all**
175
+ or **--really-everything**), which will also compare the programs
176
+ versions that are available, if the RBT project is available
177
+ (**gem install rbt**), and then inform me as to which programs
178
+ are **not** up-to-date on the local computer system at hand. This
179
+ then allows me to compile/install these programs. This idea came
180
+ to be because I liked the Linux from Scratch project a lot, and
181
+ there you may often have to upgrade programs.
182
+
183
+ Note that **--really-everything** may be hard to type. I suggest to
184
+ use an alias in that case, or just the upcased variant **FALL** or
185
+ **RALL**. See the file <b>menu.rb</b> for more aliases to that.
186
+
187
+ (2)
188
+
189
+ The other use case is the "embedded use", i.e. for use in a
190
+ <b>.cgi page</b> or perhaps for a ruby-on-rails webpage.
191
+
192
+ An example for the former follows:
193
+
194
+ _ = EnvironmentInformation.new(:do_not_run_yet) # The symbol allows us to prepare the class first.
195
+ _.set_n_tokens 58
196
+ _.disable_colours # <- Recommended, since the colours are thought for the commandline only.
197
+ _.be_silent
198
+ _.dont_show_ruby_stuff # <- If you do not need information about ruby.
199
+ _.run
200
+
201
+ But you do not have to instantiate a new object; you can
202
+ simply use another toplevel API, since as of September 2019.
203
+
204
+ (3)
205
+
206
+ For example, to query the glibc version, you could use this:
207
+
208
+ EnvironmentInformation.glibc? # => "2.29"
209
+
210
+ Which variant to prefer? This depends on your use case. If you
211
+ need more flexibility then you should use the class; if you
212
+ only need the version-string, number 3 may be best as it is
213
+ the simplest.
214
+
215
+ You can also display some additional information, such as the version
216
+ of GTK, Glib, Atk and Pango, by passing in "f" or "full" or "--full"
217
+ on the commandline, without the quotation marks.
218
+
219
+ See the help section to this this script, which can be invoked by
220
+ passing "help" or "--help" as argument to envi.
221
+
222
+ You can also pass this information through a block, if you would like to:
223
+
224
+ _ = EnvironmentInformation.new(:do_not_run_yet) {
225
+ n_tokens: 58,
226
+ use_colours: no,
227
+ be_silent: true
228
+ show_ruby_stuff: no
229
+ }
230
+ _.run
231
+
232
+ Do note that the following **API** also works, primarily due to
233
+ convenience - you can try it in **irb**, of course:
234
+
235
+ require 'environment_information'
236
+
237
+ EnvironmentInformation[]
238
+
239
+ The executable version for class EnvironmentInformation is called <b>envi</b>.
240
+ It will reside under **bin/envi** of this gem.
241
+
242
+ So you can invoke the script by typing "envi" from the commandline,
243
+ without the quotes; if you installed it as a gem into a prefix
244
+ other than /usr, it may be that the bin/ directory resides only
245
+ in that gem, though. Setting an alias may help in this case.
246
+
247
+ ## Colours used by the EnvironmentInformation project
248
+
249
+ Support for colours is available through the **colours** gem. In theory
250
+ any other colour-related gem could be used as well, but this may require
251
+ someone to write support-code for this, in regards to other gems.
252
+
253
+ Presently (August 2020) this project only uses the **colours** gem
254
+ (**gem install colours**) though.
255
+
256
+ You can specifically **disable** the use of colours for the current
257
+ invocation run, from the commandline, via either:
258
+
259
+ envi --disable-colours
260
+ envi --disable-colors
261
+ envi --nocolours
262
+ envi --nocolors
263
+ envi --no-colours
264
+
265
+ envi --really-all --disable-colours
266
+ envi --really-all --disable-colors
267
+
268
+ envi --all --disable-colours
269
+ envi --all --disable-colors
270
+
271
+ Both UK and US spelling should work fine; use whatever you prefer.
272
+
273
+ Internally, the **@use_colours** variable is used to determine
274
+ whether colours are to be used. You can query the current
275
+ setting via the following toplevel method:
276
+
277
+ EnvironmentInformation.use_colours?
278
+
279
+ You can also query whether colours are used via **envi* as
280
+ well (the **bin/envi** file):
281
+
282
+ envi --use-colours?
283
+ envi --use-colors?
284
+
285
+ ## fenvi
286
+
287
+ There is an executable at **bin/fast_envi**, as part of this gem, which
288
+ complements the executable at **bin/envi**. envi is simply an abbreviation
289
+ to "environment information"; and fenvi stands for "fast environment
290
+ information". That is exactly the primary use case for fenvi - it shall
291
+ allow for maximum speed, without "maximal usability". The latter means
292
+ that fenvi will not offer as much customization/flexibility as envi
293
+ does. In fact - the EnvironmentInformation project was rewritten in
294
+ **September 2019** precisely to make the whole project much more
295
+ performant and faster; the old code was too slow, for various reasons.
296
+ (Note: I am using an alias called fenvi that refers to fenvi; the
297
+ official name of the executable **fast_envi** though.)
298
+
299
+ Nonetheless, **fenvi** also supports some commandline flags.
300
+
301
+ For example, if you wish to only show the registered xorg components
302
+ and their corresponding versions, then you can issue the following
303
+ flag:
304
+
305
+ fenvi --xorg
306
+
307
+ This would **show all xorg components**.
308
+
309
+ fenvi --help
310
+
311
+ Would show the help options. Right now this is limited to just two
312
+ options (or perhaps a bit more than that in the long run).
313
+
314
+ Another option is:
315
+
316
+ fenvi --compare-to-program-versions
317
+
318
+ This can be used to quickly compare the program versions of the
319
+ local computer system. Note that this functionality depends on
320
+ the RBT gem:
321
+
322
+ gem install rbt
323
+
324
+ ## Determining which programs should be shown on your own
325
+
326
+ You can decide to only show the version of some programs, via the
327
+ **commandline** specifically.
328
+
329
+ For example, say that you wish to see only the versions of **ruby**,
330
+ **python** and **perl**, then you could try the following:
331
+
332
+ envi --use-these-programs=ruby,python,perl
333
+
334
+ If you wish to display the local versions of **bash**, **binutils**
335
+ and **bison**, then you can try this:
336
+
337
+ envi --use-these-programs=bash,binutils,bison
338
+
339
+ If you wish to show all components that may be important for
340
+ the LFS (linux from scratch) project then you can use this:
341
+
342
+ envi --use-these-programs=bash,binutils,bison,flex,bzip2,coreutils,diffutils,find,awk,gcc,grep,gzip,linux,make,m4,patch,perl,python,sed,tar,texinfo,xz
343
+
344
+ Since that is a bit annoying to type (it's quite long), you can also
345
+ use the **fake-symbol** :lfs for this instead:
346
+
347
+ envi --use-these-programs=:lfs
348
+
349
+ Or, even simpler than that:
350
+
351
+ envi --lfs
352
+
353
+ In fact, this functionality has been added precisely to
354
+ avoid using a shell script, such as this one:
355
+
356
+ http://www.linuxfromscratch.org/lfs/view/development/chapter02/hostreqs.html
357
+
358
+ The name **fake-symbol** is given because via the commandline
359
+ you can only pass e. g. a String, not a Symbol, as bash does
360
+ not know what a Symbol is. So if a string has a leading :
361
+ then the EnvironmentInformation project will assume that the
362
+ user wanted to convey a **special meaning**.
363
+
364
+ If you do not wish to save any local file then invoke EnvironmentInformation
365
+ in this way:
366
+
367
+ envi --lfs --no-save
368
+
369
+ If you wish to show the local version of openssl as well, try
370
+ adding this commandline flag:
371
+
372
+ envi --openssl
373
+
374
+ ## xorg components
375
+
376
+ To display the registered **xorg components**, you could use any of
377
+ the following commandline flags:
378
+
379
+ envi --xorg-components
380
+ envi --xorg
381
+
382
+ Do note that not necessarily every xorg component is registered,
383
+ but most of the xorg-components should be covered by now.
384
+
385
+ ## Reading from a local file
386
+
387
+ The **EnvironmentInformation project** can read from a **local file**
388
+ containing the programs whose version you would like to show, on the
389
+ commandline.
390
+
391
+ The commandline invocation goes like this:
392
+
393
+ envi --read-from-this-file=/Depot/j/display_these_programs.md
394
+ envi --file=/Depot/j/display_these_programs.md
395
+ envi --input-from=/Depot/j/display_these_programs.md
396
+
397
+ The reason as to why this functionality has been made available
398
+ is so that people can use their own custom input to the main
399
+ class of this gem, if they would like to.
400
+
401
+ A requirement for this to work is that there is a corresponding
402
+ component that can query the version of a program. I am open for
403
+ suggestions what to add, if anything is missing, as well as
404
+ including a more generic way to make a query. Either way this
405
+ depends on others to make suggestions.
406
+
407
+ ## Sorting the components alphabetically
408
+
409
+ You can display the components in an alphabetical manner, if you
410
+ would like to, through this:
411
+
412
+ envi --sort-alphabetically
413
+
414
+ ## Sinatra interface
415
+
416
+ Since as of **May 2019** there is now a small sinatra "interface"
417
+ available.
418
+
419
+ To start it, try:
420
+
421
+ envi --sinatra
422
+
423
+ In order for this to work, you need to have sinatra installed, such as
424
+ via this way:
425
+
426
+ gem install sinatra
427
+
428
+ or
429
+
430
+ gem install sinatra --user-install # into the home directory
431
+
432
+ It is not a mandatory dependency for this gem, so it is not registered
433
+ to be a hard dependency in the **.gemspec** file.
434
+
435
+ ## The science cluster
436
+
437
+ There are also a few science-related applications, such as for hmmer
438
+ or relion. To query their versions specifically you can issue:
439
+
440
+ envi --science
441
+
442
+ ## Show the URL of every registered program
443
+
444
+ You can, if you like to, show the remote URLs to the different
445
+ programs, if you have the **RBT project** installed (**gem install rbt**).
446
+
447
+ Then, you should be able to do the following:
448
+
449
+ envi --everything --show-remote-url
450
+
451
+ This variant will not only display the local programs found,
452
+ but will additionally also show the **remote URLs** on the
453
+ commandline, on the right hand side, to the corresponding
454
+ program at hand.
455
+
456
+ ## Only display the operating system in use
457
+
458
+ If you are only interested in seeing the operating system, try
459
+ this **commandline flag**:
460
+
461
+ envi --os?
462
+
463
+ ## Showing additional programs on an ad-hoc basis
464
+
465
+ You can also show additional individual components via the **--additional**
466
+ flag, like this:
467
+
468
+ envi --additional=php,python,perl
469
+
470
+ This would display the local versions of the installed programs
471
+ **php**, **python** and **perl**.
472
+
473
+ Note that since as of **September 2019** you can also add the
474
+ name of the component directly. For example, to show the
475
+ version of bash, you can invoke envi like this:
476
+
477
+ envi --bash
478
+
479
+ To also show php and python, you can do this:
480
+
481
+ envi --bash --php --python
482
+
483
+ Use whichever variant you prefer - the choices are up to the user.
484
+
485
+ ## Ruby-gtk bindings
486
+
487
+ A small **gtk-widget** exists, which can be started via either of:
488
+
489
+ envi --gui
490
+ envi --gtk
491
+
492
+ Note that this requires the **ruby-gtk package**, in particular
493
+ **gtk2**, and possibly also the gem called **gtk_paradise**.
494
+
495
+ Installing these could be done through the following commandline
496
+ invocations:
497
+
498
+ gem install gtk2
499
+ gem install gtk3
500
+ gem install gtk_paradise
501
+
502
+ You may need the "devel" packages (.h files) for this to work.
503
+
504
+ The **gtk** widget is really just extremely simple, and thus not too
505
+ terribly useful, since it lacks functionality; I only wanted to be
506
+ able to **embed this information** into other ruby-gtk applications.
507
+ At some point in the future, the functionality may be extended - but
508
+ for the time being, it will remain simple. **Simple is beautiful**,
509
+ too.
510
+
511
+ Presently (September 2019) the gtk-bindings in the
512
+ **environment_information** project only support **ruby-gtk2**,
513
+ but in the future I may switch to **ruby-gtk3** - or at the
514
+ least offer means for the user to decide which variant is
515
+ to be used.
516
+
517
+ ## No changelog entries any longer
518
+
519
+ In the past, changes to this project were listed specifically, together
520
+ with the date - a short changelog.
521
+
522
+ However had, most users are probably more interested in the options
523
+ and features that are supported as-is; the features that are available
524
+ right **now**. Seeing every unimportant change made in the long
525
+ forgotten past, is not that useful for most users. Additionally, for
526
+ **small projects**, a changelog is not really that worthwhile to be
527
+ had to begin with.
528
+
529
+ So, I have abandoned the concept of a changelog for this project. Do
530
+ note that if there is something noteworthy that has been changed, it
531
+ will be mentioned and documented here in this file (**README.md**)
532
+ anyway.
533
+
534
+ ## How to add new components/entries to this project
535
+
536
+ The file <b>environment_information/constants/array_tracked_components.rb</b>
537
+ keeps track over all available entries.
538
+
539
+ The method called **return_default_programs_on_a_linux_computer**,
540
+ defined in the file <b>environment_information/base/misc.rb</b>,
541
+ will add all the entries that are, assumingly, useful on a linux
542
+ computer by default.
543
+
544
+ If you want to change the entries, or add new ones, look there first.
545
+ If you wish to register a new program, you have to add it onto the
546
+ main Array (in the constants.rb file) first.
547
+
548
+ You will also have to add a method that does the actual **query**
549
+ part for the program version at hand, within the
550
+ <b>environment_information/individual_components/</b> subdirectory.
551
+
552
+ It may be simplest to just copy one of those .rb files, by giving it
553
+ the same name as the program you wish to see displayed. You will
554
+ then have to **change the content** of that method too, in that
555
+ new file, but this is quite trivial and takes at maximum five
556
+ minutes (for those who have not seen it before; it takes
557
+ significantly less time for those who already know what to change
558
+ there). Entries that come with **pkg-config .pc files** are even
559
+ simpler to add - this is much easier than manually parsing
560
+ **--version** flags.
561
+
562
+ In the future I may switch to a yaml file rather than hardcode
563
+ the entries in .rb directly, but for the time being, I will stick
564
+ to the method described above.
565
+
566
+ ## Short display variant
567
+
568
+ If you only wish to quickly view the most important information
569
+ about the local computer system, then you can use the following
570
+ variant:
571
+
572
+ envi --short
573
+
574
+ ## Caveats
575
+
576
+ Note that the **EnvironmentInformation** project has to sometimes guess
577
+ how to obtain the necessary information, in order to determine which
578
+ program is installed. For example, for programs such as **readline**
579
+ there is no trivial way to determine which version is used, to
580
+ **EnvironmentInformation** will attempt to read the .so files, and
581
+ determine the version from the .so files. This may fail, depending
582
+ on the setup of the host computer.
583
+
584
+ In general, the two best ways to determine the version of programs
585
+ are via a **--version** flag or simply by using **pkg-config** to
586
+ query the .pc file of the package. But this is not available for
587
+ all programs, so ultimately **EnvironmentInformation** may not
588
+ display completely accurate information on all given computer
589
+ systems.
590
+
591
+ ## Clearing the old dataset
592
+
593
+ Via **--clear** on the commandline you can remove all old entries.
594
+ This commandline flag thus resets **class EnvironmentInformation**
595
+ to a totally clean, fresh state. Internally the method .reset() will
596
+ be called on **class EnvironmentInformation**.
597
+
598
+ This allows you to show only one component, or a few components,
599
+ for example. The following example demonstrates this.
600
+
601
+ Say that you wish to show **only** **python** and **php**, thus
602
+ two programs only. Then you can use the following flag to achieve
603
+ this, in this order:
604
+
605
+ envi --clear --python --php
606
+
607
+ The order is important because --clear will clear at the moment
608
+ it occurs in **ARGV**, which holds the commandline-arguments
609
+ issued on the commandline by the user.
610
+
611
+ ## Which packages will be checked by default?
612
+
613
+ The following provides a list of packages that are presently,
614
+ in **October of 2019**, tracked.
615
+
616
+ In the past I did manually copy/paste the following listing, but
617
+ since as of 15th of October 2019, the list is **autogenerated** via
618
+ a macro.
619
+
620
+ This listing can be seen in the **file**:
621
+
622
+ environment_information/constants/array_tracked_components.rb
623
+
624
+ These are the following programs:
625
+
626
+ atk
627
+ automake
628
+ babl
629
+ bash
630
+ binutils
631
+ bison
632
+ boost
633
+ busybox
634
+ bzip2
635
+ cairo
636
+ ccache
637
+ check
638
+ clang
639
+ clutter
640
+ cmake
641
+ coreutils
642
+ curl
643
+ dbus
644
+ dhcpcd
645
+ diffutils
646
+ elfutils
647
+ emacs
648
+ enchant
649
+ ethtool
650
+ eudev
651
+ evince
652
+ exempi
653
+ expat
654
+ ffmpeg
655
+ file
656
+ findutils
657
+ flatpak
658
+ flex
659
+ fontconfig
660
+ freeipmi
661
+ freetype
662
+ fribidi
663
+ gawk
664
+ gc
665
+ gcc
666
+ gcr
667
+ gdkpixbuf
668
+ gegl
669
+ gettext
670
+ ghostscript
671
+ git
672
+ gmime
673
+ gjs
674
+ glib
675
+ glibc
676
+ gmp
677
+ gnupg
678
+ gnuplot
679
+ gnutls
680
+ gperf
681
+ grep
682
+ gtk2
683
+ gtk3
684
+ guile
685
+ gzip
686
+ harfbuzz
687
+ hmmer
688
+ icewm
689
+ icu4c
690
+ imagemagick
691
+ intltool
692
+ java
693
+ kde_frameworks
694
+ krb5
695
+ lftp
696
+ libarchive
697
+ libassuan
698
+ libdrm
699
+ libgdata
700
+ libgpgerror
701
+ libgsf
702
+ libgtop
703
+ libical
704
+ libjpegturbo
705
+ libpeas
706
+ libqmi
707
+ librsvg
708
+ libseccomp
709
+ libsecret
710
+ libtasn1
711
+ libtool
712
+ libunwind
713
+ libuv
714
+ libzip
715
+ linux
716
+ llvm
717
+ lynx
718
+ m4
719
+ make
720
+ mlt
721
+ mozjs
722
+ mpc
723
+ mpfr
724
+ mtools
725
+ nasm
726
+ ncurses
727
+ neon
728
+ nghttp2
729
+ nginx
730
+ ninja
731
+ node
732
+ nss
733
+ openssl
734
+ opusfile
735
+ pango
736
+ parted
737
+ patch
738
+ patchelf
739
+ pbbam
740
+ pcre
741
+ pcre2
742
+ perl
743
+ php
744
+ pkgconfig
745
+ poppler
746
+ popt
747
+ python
748
+ qt
749
+ r
750
+ readline
751
+ re2c
752
+ relion
753
+ ruby
754
+ rubygems
755
+ samtools
756
+ sed
757
+ screen
758
+ sharutils
759
+ strace
760
+ subversion
761
+ swig
762
+ sysstat
763
+ tar
764
+ texinfo
765
+ tiff
766
+ tmux
767
+ valgrind
768
+ viennarna
769
+ vim
770
+ webkit2gtk
771
+ wget
772
+ xfsprogs
773
+ xterm
774
+ xvid
775
+ xz
776
+ zlib
777
+
778
+
779
+ You can also display these programs dynamically, such as through the
780
+ following **API**:
781
+
782
+ require 'environment_information'
783
+
784
+ pp EnvironmentInformation.tracked_programs?
785
+
786
+ Note that since as of **March 2019**, environment_information will also attempt
787
+ to find out the installed version for **gmp**, **mpfr** and **mpc**. This
788
+ may fail, though, and will be silently ignored in these cases (at least
789
+ for the time being).
790
+
791
+ You can use the following method to display a list of all programs
792
+ that are registered, from the commandline:
793
+
794
+ envi --registered-components?
795
+
796
+ This will show every registered (and thus, available) component of this
797
+ project.
798
+
799
+ As of **February 2020**, this project tracks at the least 105 different
800
+ programs. More entries will be added in the future, but the primary
801
+ focus will be on a **Linux from Scratch** / **Beyond Linux from Scratch**
802
+ setup, so expect those programs that are installed first, to be added
803
+ next, too.
804
+
805
+ ## Querying the components that will be shown
806
+
807
+ You can query the components that will be shown, by issuing one of
808
+ the following commands:
809
+
810
+ envi --show-components?
811
+ envi --show-components
812
+
813
+ Note that this works exclusively, meaning that if you use this
814
+ commandline switch, then you will ONLY get a query of the
815
+ components that are available.
816
+
817
+ ## Replaying the information
818
+
819
+ Normally showing all information when issuing **envi --RALL** can take
820
+ quite some time; on my computer system 18 seconds, before the rewrite
821
+ in February 2020.
822
+
823
+ The reason as to why it takes that long is mostly because many different
824
+ files have to be queried; their --version flag has to be called or
825
+ their .pc file has to be checked, but most importantly querying data
826
+ from the **RBT project** currently takes way too long. This is not an
827
+ ideal situation, as nobody wants to wait.
828
+
829
+ Waiting 18 seconds is simply too long, though, but until that part in
830
+ RBT is improved, I have added a **--replay** functionality for **class
831
+ EnvironmentInformation** (via the commandline).
832
+
833
+ What this functionality does is to take an available (existing) .yml
834
+ file that holds the information from the last invocation run, and then
835
+ proceeds to display this information on the commandline to the user.
836
+ This will evidently be much faster, since the information has already
837
+ been stored before in a prior run.
838
+
839
+ This change required that the environment information project will
840
+ also generate a **.yml file** by default.
841
+
842
+ Note that this functionality is not yet complete; I will extend this
843
+ at a later time (written this part here as of **December 2019**).
844
+
845
+ You can disable saving into this .yml file via:
846
+
847
+ envi --no-yaml-file
848
+
849
+ To invoke the replay functionality, do:
850
+
851
+ envi --replay
852
+
853
+ ## Avoid the creation of local files
854
+
855
+ By default, the main class in this project may generate a few local
856
+ files. This may not always be wanted, or possible (e. g. in a
857
+ read-only filesystem), so an option has to exist that disables
858
+ this functionality.
859
+
860
+ That option is called **--no-save** and can be used like this:
861
+
862
+ envi --lfs --no-save
863
+
864
+ ## Using another prefix
865
+
866
+ By default, the environment_information project will assume that
867
+ the main prefix is / or /usr, respectively. In other words, it
868
+ will assume that, for example, the binary called "bison" will
869
+ reside at /usr/bin/bison. To be more correct, it will make use
870
+ of the PATH environment variable, but for most users this will
871
+ list /usr/bin/ first.
872
+
873
+ That way "bison --version" should work and be the same as
874
+ "/usr/bin/bison --version".
875
+
876
+ For pkg-config .pc files, the main target will usually then
877
+ be at /usr/lib/pkgconfig/.
878
+
879
+ Note that the above is not always a correct assumption. For
880
+ example, the **GoboLinux approach** uses the **/Programs/**
881
+ hierarchy instead (but it also keeps legacy symlinks, so in
882
+ fact GoboLinux works just like any other linux distribution too).
883
+
884
+ On my home setup, I tend to use /home/Programs/ since some
885
+ time - mostly because I tend to relocate /home/ in general
886
+ or may keep it on a separate partition.
887
+
888
+ For these latter use cases we require another way to quickly
889
+ list all versions of different programs. On 14.01.2020
890
+ support for this has been (partially) added.
891
+
892
+ Invoke this like so:
893
+
894
+ envi --work-on-programs-directory-only
895
+
896
+ Note that this would use /home/Programs/ right now, which
897
+ is hardcoded - and thus not flexible.
898
+
899
+ I am aware of this limitation, so expect more code changes
900
+ in the future to extend this functionality.
901
+
902
+ One key idea for this is to set up /home/Programs/Toolchain/
903
+ and have that one work reliably to cross-compile different
904
+ architectures, libc libraries and so forth. But for now,
905
+ this subsection is a stub.
906
+
907
+ ## Rationale as to why some programs may work and some may not
908
+
909
+ Querying the specific version installed on a given computer
910
+ system can be tricky. If a **.pc file** is available (**pkg-config**)
911
+ then querying the version is quite trivial. If a **binary** is
912
+ available then often **--version** or **-V** will work. But
913
+ sometimes there is no binary, and no .pc file either. So what
914
+ to do in such a case?
915
+
916
+ This is not simple to answer, since it may depend on the
917
+ program at hand.
918
+
919
+ It may be possible to infer the proper version from the
920
+ library at hand e. g. **/usr/lib/foobar.so.4.8.2**. Here
921
+ we could assume that the version will be 4.8.2, but this
922
+ is not necessarily guaranteed to work, either.
923
+
924
+ In the past, before the rewrite of this project in **February 2020**,
925
+ the environment_information project had used code that would
926
+ check for such conditions - for example, for **readline**,
927
+ and look for specific .so files under **/usr/lib/** or
928
+ elsewhere.
929
+
930
+ But the resulting code that had to be written for this, was not
931
+ very elegant, and takes about 10-20 lines of code for checking
932
+ this, including fall-backs, for each program that does not
933
+ conform to --version or a .pc file. I am no longer sure whether
934
+ it is worth to add that code, since it also may have to be
935
+ maintained, and is not always perfect nor does it always work,
936
+ depending on the computer system at hand. So, past this point,
937
+ **environment_information** is not doing its best to query the
938
+ version for all programs - it will try pkg-config and
939
+ --version or -V in most cases, and if that fails then
940
+ the environment_information project will assume that the
941
+ program at hand is not installed.
942
+
943
+ This may be a **false negative**, but to me it appears
944
+ to be better in the long run, in regards to maintainability
945
+ of the whole project. After all one reason for the rewrite
946
+ in 2020 was to simplify the whole project, and this objective
947
+ has been achieved - all the commands are now stored in yaml
948
+ files, and that is so much simpler to handle than the
949
+ corresponding ruby methods that were used before that.
950
+
951
+ ## Adding new entries to EnvironmentInformation
952
+
953
+ New entries can be added into the following yaml file:
954
+
955
+ **query_to_use_for_the_individual_components.yml**
956
+
957
+ The two most commonly used variants there are version,
958
+ for **bin/foo --version* invocations, and pkgconfig,
959
+ for querying pkg-config .pc files. However had, many
960
+ programs make use of different invocation variants,
961
+ don't come with a .pc file, and have no binaries.
962
+ Querying the correct version of such files is difficult
963
+ since there is no standard. This is a reason why the
964
+ code has to handle these cases.
965
+
966
+ But in principle, adding a new entry is as simple as
967
+ adding a new line into that .yml file (and registering
968
+ that component in a second .yml file).
969
+
970
+ ## The toplevel main hash
971
+
972
+ EnvironmentInformation tries to store the information that
973
+ it has collected into a **hash**, which can be accessed like
974
+ this quickly:
975
+
976
+ EnvironmentInformation.hash?
977
+
978
+ By default this hash is empty, so you have to fill it up
979
+ first, if you want to do so, via the following method:
980
+
981
+ EnvironmentInformation.initialize
982
+
983
+ hash = EnvironmentInformation.hash? # ← and here you can query it
984
+
985
+ The hash can then be used as basis for reporting at a later time,
986
+ or replaying that information via the **--replay** commandline
987
+ switch to the executable.
988
+
989
+ ## Dependencies of the EnvironmentInformation project
990
+
991
+ The sole dependency for the **environment_information gem**
992
+ is on the **colours** gem.
993
+
994
+ Up until the beginning of March 2020, the EnvironmentInformation
995
+ project also depended on the **opn gem**. However had, I
996
+ noticed that in a restricted environment installation of
997
+ gems can be difficult, so I made opn **optional**. If you have
998
+ it installed then EnvironmentInformation will still try to
999
+ make use of the **Opn namespace**; and if it is not installed
1000
+ then EnvironmentInformation will simply **skip** Opn completely.
1001
+
1002
+ ## Rationale behind the different queries
1003
+
1004
+ As was already explained, different programs require different
1005
+ ways to determine which version is installed. Some projects
1006
+ would allow more than one way, such as the --version flag,
1007
+ but also querying .pc files. Ruby, for example, supports both
1008
+ --version, and comes with a .pc file (if you compiled it from
1009
+ source, at the least).
1010
+
1011
+ So, which way to choose?
1012
+
1013
+ In my opinion, .pc files are better than --version, for
1014
+ at the least two reasons:
1015
+
1016
+ - The resulting code to handle this is much simpler. .pc
1017
+ files are quite uniform, whereas the output of --version
1018
+ is very dissimilar between different programs.
1019
+
1020
+ - Another reason is that invoking the binary, just to
1021
+ do a --version, is actually more expensive (CPU-wise)
1022
+ than it is to query a simple text file, which is
1023
+ essentially what .pc files are. So this is another reason
1024
+ in favour of .pc files.
1025
+
1026
+ For these reasons, and a few smaller ones, the EnvironmentInformation
1027
+ project will try to prefer .pc files whenever that is possible.
1028
+ We may retain code that can handle --version calls, though,
1029
+ if they need a special way to query.
1030
+
1031
+ ## Querying all registered pkg-config entries
1032
+
1033
+ To show all registered pkg-config entries (with .pc files)
1034
+ do this:
1035
+
1036
+ envi --pkgconfig
1037
+
1038
+ If you want to obtain an Array of all outdated programs
1039
+ on the target computer system, try this method:
1040
+
1041
+ EnvironmentInformation.return_array_of_outdated_programs
1042
+
1043
+ You need to have initialized the main hash once, before
1044
+ being able to make use of that method.
1045
+
1046
+
1047
+ ## Contact information
1048
+
1049
+ If your creative mind has ideas and specific suggestions to make this
1050
+ gem more useful in general, feel free to drop me an email at any
1051
+ time, via:
1052
+
1053
+ shevegen@gmail.com
1054
+
1055
+ (Do keep in mind that responding to emails may take some time, depending
1056
+ on the amount of work I may have at that moment, due to reallife. I will,
1057
+ however had, read feedback. Patches and code changes are welcome too
1058
+ of course, as long as they are in the spirit of the project at
1059
+ hand, e. g. fitting to the general theme.)
1060
+
1061
+ Thank you.