environment_information 1.4.99

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 (80) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +1287 -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 +166 -0
  9. data/lib/environment_information/class/class.rb +2829 -0
  10. data/lib/environment_information/colours/colours.rb +224 -0
  11. data/lib/environment_information/colours/sfancy.rb +19 -0
  12. data/lib/environment_information/colours/simp.rb +19 -0
  13. data/lib/environment_information/constants/array_tracked_components.rb +210 -0
  14. data/lib/environment_information/constants/constants.rb +17 -0
  15. data/lib/environment_information/constants/encoding.rb +21 -0
  16. data/lib/environment_information/constants/error_line.rb +17 -0
  17. data/lib/environment_information/constants/file_constants.rb +102 -0
  18. data/lib/environment_information/constants/misc.rb +86 -0
  19. data/lib/environment_information/constants/namespace.rb +14 -0
  20. data/lib/environment_information/constants/newline.rb +16 -0
  21. data/lib/environment_information/constants/regex.rb +30 -0
  22. data/lib/environment_information/constants/temp_directory.rb +52 -0
  23. data/lib/environment_information/gui/gtk2/environment_information.rb +35 -0
  24. data/lib/environment_information/gui/gtk3/environment_information.rb +34 -0
  25. data/lib/environment_information/gui/libui/environment_information.rb +74 -0
  26. data/lib/environment_information/gui/shared_code/environment_information_module.rb +409 -0
  27. data/lib/environment_information/misc_components/README.md +3 -0
  28. data/lib/environment_information/misc_components/cflags.rb +36 -0
  29. data/lib/environment_information/misc_components/cpuinfo.rb +64 -0
  30. data/lib/environment_information/misc_components/operating_system.rb +54 -0
  31. data/lib/environment_information/misc_components/operating_system_bit_type.rb +42 -0
  32. data/lib/environment_information/misc_components/ram.rb +30 -0
  33. data/lib/environment_information/misc_components/rubygems_installation_directory.rb +54 -0
  34. data/lib/environment_information/misc_components/screen_resolution.rb +50 -0
  35. data/lib/environment_information/project/project.rb +27 -0
  36. data/lib/environment_information/queries/README.md +2 -0
  37. data/lib/environment_information/queries/complex_version.rb +273 -0
  38. data/lib/environment_information/queries/pkg_config.rb +125 -0
  39. data/lib/environment_information/queries/simple_version.rb +217 -0
  40. data/lib/environment_information/requires/require_asciitable.rb +15 -0
  41. data/lib/environment_information/requires/require_the_constants.rb +7 -0
  42. data/lib/environment_information/requires/require_the_environment_information_project.rb +23 -0
  43. data/lib/environment_information/requires/require_the_individual_misc_components.rb +30 -0
  44. data/lib/environment_information/requires/require_the_toplevel_methods.rb +22 -0
  45. data/lib/environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb +152 -0
  46. data/lib/environment_information/toplevel_methods/cd.rb +16 -0
  47. data/lib/environment_information/toplevel_methods/e.rb +43 -0
  48. data/lib/environment_information/toplevel_methods/hash.rb +60 -0
  49. data/lib/environment_information/toplevel_methods/internet_is_available.rb +30 -0
  50. data/lib/environment_information/toplevel_methods/is_on_roebe.rb +16 -0
  51. data/lib/environment_information/toplevel_methods/menu.rb +90 -0
  52. data/lib/environment_information/toplevel_methods/misc.rb +322 -0
  53. data/lib/environment_information/toplevel_methods/n_subcommands.rb +31 -0
  54. data/lib/environment_information/toplevel_methods/prefix_to_use.rb +39 -0
  55. data/lib/environment_information/toplevel_methods/register_this_component_is_missing.rb +61 -0
  56. data/lib/environment_information/toplevel_methods/remote_url_of_this_program.rb +45 -0
  57. data/lib/environment_information/toplevel_methods/replay_from_the_stored_file.rb +84 -0
  58. data/lib/environment_information/toplevel_methods/return_alias_to.rb +30 -0
  59. data/lib/environment_information/toplevel_methods/return_pkgconfig_based_programs.rb +28 -0
  60. data/lib/environment_information/toplevel_methods/return_remote_gtk2_version.rb +54 -0
  61. data/lib/environment_information/toplevel_methods/return_simple_version_based_programs.rb +28 -0
  62. data/lib/environment_information/toplevel_methods/return_version_of_this_program.rb +182 -0
  63. data/lib/environment_information/toplevel_methods/show_all_available_components.rb +192 -0
  64. data/lib/environment_information/toplevel_methods/write_what_into.rb +24 -0
  65. data/lib/environment_information/version/version.rb +25 -0
  66. data/lib/environment_information/www/sinatra_interface.rb +213 -0
  67. data/lib/environment_information/www/webobject_interface.cgi +29 -0
  68. data/lib/environment_information/yaml/array_default_programs_on_linux.yml +15 -0
  69. data/lib/environment_information/yaml/array_lfs_core_programs.yml +37 -0
  70. data/lib/environment_information/yaml/array_science_cluster.yml +12 -0
  71. data/lib/environment_information/yaml/array_tracked_non_programs.yml +13 -0
  72. data/lib/environment_information/yaml/array_tracked_programs.yml +215 -0
  73. data/lib/environment_information/yaml/array_tracked_xorg_components.yml +37 -0
  74. data/lib/environment_information/yaml/colours.yml +3 -0
  75. data/lib/environment_information/yaml/query_to_use_for_the_individual_components.yml +264 -0
  76. data/lib/environment_information.rb +5 -0
  77. data/test/testing_environment_information.rb +26 -0
  78. data/test/testing_missing_components.rb +9 -0
  79. data/test/testing_prefix_for_the_environment_information_project.rb +20 -0
  80. metadata +177 -0
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/return_alias_to.rb'
6
+ # EnvironmentInformation.return_alias_to
7
+ # =========================================================================== #
8
+ module EnvironmentInformation
9
+
10
+ # ========================================================================= #
11
+ # === EnvironmentInformation.return_alias_to
12
+ #
13
+ # This method will return some abbreviations to programs.
14
+ # ========================================================================= #
15
+ def self.return_alias_to(i)
16
+ if i.is_a? Array
17
+ i = i.first
18
+ end
19
+ case i.to_sym
20
+ when :find
21
+ i = :findutils
22
+ when :diff
23
+ i = :diffutils
24
+ when :yacc
25
+ i = :bison
26
+ end
27
+ return i # Always return something.
28
+ end
29
+
30
+ end
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/return_pkgconfig_based_programs.rb'
6
+ # =========================================================================== #
7
+ module EnvironmentInformation
8
+
9
+ require 'environment_information/constants/file_constants.rb'
10
+
11
+ # ========================================================================= #
12
+ # === EnvironmentInformation.return_pkgconfig_based_programs
13
+ # ========================================================================= #
14
+ def self.return_pkgconfig_based_programs
15
+ dataset = YAML.load_file(file_query_to_use_for_the_individual_components)
16
+ dataset.select {|key, value|
17
+ # ===================================================================== #
18
+ # The next query will select both :pkgconfig and :"pkg-config".
19
+ # ===================================================================== #
20
+ value.to_s.start_with? 'pkg'
21
+ }.keys
22
+ end
23
+
24
+ end
25
+
26
+ if __FILE__ == $PROGRAM_NAME
27
+ pp EnvironmentInformation.return_pkgconfig_based_programs
28
+ end
@@ -0,0 +1,54 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/return_remote_gtk2_version.rb'
6
+ # EnvironmentInformation.return_remote_gtk2_version
7
+ # =========================================================================== #
8
+ module EnvironmentInformation
9
+
10
+ require 'environment_information/toplevel_methods/internet_is_available.rb'
11
+
12
+ # ========================================================================= #
13
+ # === EnvironmentInformation.return_remote_gtk2_version
14
+ #
15
+ # This method can be used to obtain the latest gtk2-version, from a
16
+ # remote URL.
17
+ #
18
+ # The reason why this was necessary is because the RBT project may not
19
+ # always keep the latest gtk2 version, since gtk3 (and so forth) is more
20
+ # recent. Since we may still have to find out which gtk2 version is the
21
+ # most recent, we need a method to do so - which is precisely what this
22
+ # method here is doing.
23
+ # ========================================================================= #
24
+ def self.return_remote_gtk2_version
25
+ # ======================================================================= #
26
+ # We will use a hardcoded URL pointing towards gtk2:
27
+ # ======================================================================= #
28
+ remote_url = 'https://ftp.gnome.org/pub/GNOME/sources/gtk+/2.24/?C=M;O=D'
29
+ require 'open-uri'
30
+ newest_version = ''
31
+ # ======================================================================= #
32
+ # We will next try to obtain the remote dataset, but this would
33
+ # fail if we have no www-connection, so we must rescue this step.
34
+ # ======================================================================= #
35
+ if internet_is_available?
36
+ begin
37
+ dataset = URI.open(remote_url).read
38
+ use_this_regex =
39
+ /<a href="gtk\+\-(\d.\d\d.\d\d).tar.xz"><img src=/
40
+ scanned = dataset.scan(use_this_regex).flatten
41
+ newest_version = scanned.first
42
+ rescue SocketError => error
43
+ puts "It seems as if we have no working internet "\
44
+ "connection (#{sfancy(error.class)})"
45
+ end
46
+ end
47
+ return newest_version.strip # ← And return it here.
48
+ end
49
+
50
+ end
51
+
52
+ if __FILE__ == $PROGRAM_NAME
53
+ puts EnvironmentInformation.return_remote_gtk2_version
54
+ end
@@ -0,0 +1,28 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/return_simple_version_based_programs.rb'
6
+ # =========================================================================== #
7
+ module EnvironmentInformation
8
+
9
+ require 'environment_information/constants/file_constants.rb'
10
+
11
+ # ========================================================================= #
12
+ # === EnvironmentInformation.return_simple_version_based_programs
13
+ # ========================================================================= #
14
+ def self.return_simple_version_based_programs
15
+ dataset = YAML.load_file(file_query_to_use_for_the_individual_components)
16
+ dataset.select {|key, value|
17
+ # ===================================================================== #
18
+ # The next query will select only for :version entries.
19
+ # ===================================================================== #
20
+ value == :version
21
+ }.keys
22
+ end
23
+
24
+ end
25
+
26
+ if __FILE__ == $PROGRAM_NAME
27
+ pp EnvironmentInformation.return_simple_version_based_programs
28
+ end
@@ -0,0 +1,182 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/return_version_of_this_program.rb'
6
+ # EnvironmentInformation.return_version_of_this_program
7
+ # =========================================================================== #
8
+ module EnvironmentInformation
9
+
10
+ require 'yaml'
11
+ require 'environment_information/colours/colours.rb'
12
+ require 'environment_information/constants/array_tracked_components.rb'
13
+ require 'environment_information/constants/error_line.rb'
14
+ require 'environment_information/constants/misc.rb'
15
+ require 'environment_information/constants/newline.rb'
16
+ require 'environment_information/toplevel_methods/e.rb'
17
+ require 'environment_information/toplevel_methods/prefix_to_use.rb'
18
+ require 'environment_information/toplevel_methods/return_alias_to.rb'
19
+ require 'environment_information/requires/require_the_individual_misc_components.rb'
20
+ require 'environment_information/queries/pkg_config.rb'
21
+ require 'environment_information/queries/simple_version.rb'
22
+ require 'environment_information/queries/complex_version.rb'
23
+
24
+ begin
25
+ require 'rbt/utility_scripts/report_mate_desktop_version.rb'
26
+ rescue LoadError; end
27
+
28
+ # ========================================================================= #
29
+ # === @debug
30
+ #
31
+ # This variable can be used to control whether we debug the project
32
+ # or not. It should be false by default (and upon re-destribution of
33
+ # the project to other users).
34
+ # ========================================================================= #
35
+ @debug = false
36
+
37
+ # ========================================================================= #
38
+ # === @query_to_use_for_the_individual_components
39
+ #
40
+ # Initialize our dataset here.
41
+ # ========================================================================= #
42
+ @query_to_use_for_the_individual_components = YAML.load_file(
43
+ FILE_QUERY_TO_USE_FOR_THE_INDIVIDUAL_COMPONENTS
44
+ )
45
+
46
+ # ========================================================================= #
47
+ # === EnvironmentInformation.return_version_of_this_program
48
+ #
49
+ # This is the general method that will return the version of a particular
50
+ # program at hand.
51
+ #
52
+ # The method must be able to deal with using pkg-config, but also
53
+ # querying some program's version via --version, via the commandline,
54
+ # Furthermore, some programs may require an ad-hoc fix.
55
+ # ========================================================================= #
56
+ def self.return_version_of_this_program(
57
+ this_program,
58
+ prefix_to_use = @prefix_to_use
59
+ )
60
+ prefix_to_use = prefix_to_use.dup if prefix_to_use
61
+ version = nil # ← This is the default.
62
+ if this_program.is_a? Array
63
+ this_program = this_program.flatten.first
64
+ end
65
+ # ======================================================================= #
66
+ # Next define a few aliases.
67
+ # ======================================================================= #
68
+ this_program = ::EnvironmentInformation.return_alias_to(this_program)
69
+ if ARRAY_TRACKED_NON_PROGRAMS.include? this_program
70
+ return ::EnvironmentInformation.send(this_program)
71
+ elsif @query_to_use_for_the_individual_components.has_key? this_program.to_sym
72
+ use_this_command = @query_to_use_for_the_individual_components[this_program.to_sym]
73
+ case use_this_command
74
+ # ===================================================================== #
75
+ # === :mate_desktop
76
+ #
77
+ # This entry is special.
78
+ # ===================================================================== #
79
+ when :mate_desktop
80
+ return RBT.return_mate_desktop_version_array
81
+ # ===================================================================== #
82
+ # === :pkgconfig
83
+ #
84
+ # An invocation example for this would be:
85
+ #
86
+ # x = EnvironmentInformation.return_version_of_this_program(:check) # => "0.15.2"
87
+ #
88
+ # ===================================================================== #
89
+ when :pkgconfig
90
+ version = ::EnvironmentInformation::Queries::PkgConfig.new(this_program).version?
91
+ # ===================================================================== #
92
+ # === :custom_gtk2
93
+ # ===================================================================== #
94
+ when :custom_gtk2
95
+ version = ::EnvironmentInformation::Queries::PkgConfig.new('gtk+-2.0').version?
96
+ # ===================================================================== #
97
+ # === :custom_mpc
98
+ #
99
+ # We rely on the header called mpc.h.
100
+ # ===================================================================== #
101
+ when :custom_mpc
102
+ version = ::EnvironmentInformation.return_version_of_mpc
103
+ # ===================================================================== #
104
+ # === :custom_boost
105
+ # ===================================================================== #
106
+ when :custom_boost
107
+ version = ::EnvironmentInformation.return_version_of_boost
108
+ if version.nil?
109
+ register_this_component_is_missing(:boost)
110
+ end
111
+ # ===================================================================== #
112
+ # === :version (version tag)
113
+ #
114
+ # This entry point is typically for "program_name --version"
115
+ # entries. Some of them require custom modifications.
116
+ # ===================================================================== #
117
+ when :version
118
+ # =================================================================== #
119
+ # Next enable support for AppDir layout, where programs will
120
+ # ultimately reside in the same directory.
121
+ # =================================================================== #
122
+ unless prefix_to_use.empty?
123
+ prefix_to_use << "#{this_program.to_s.capitalize}/Current/bin/"
124
+ end
125
+ cmd = "#{prefix_to_use}#{this_program} --version #{ERROR_LINE}"
126
+ if @debug
127
+ e Colours.crimson('DEBUG for the prefix-value in use: ')+
128
+ Colours.steelblue(cmd)
129
+ end
130
+ version = ::EnvironmentInformation::Queries::SimpleVersion.new(this_program) {{
131
+ prefix_to_use: prefix_to_use
132
+ }}.version?
133
+ # ===================================================================== #
134
+ # Next we will handle special programs, such as "swig -v" and similar.
135
+ # This is done by class ComplexVersion since as of 29.08.2020.
136
+ # ===================================================================== #
137
+ else # else tag
138
+ if use_this_command.start_with?('pkg-config')
139
+ version = ::EnvironmentInformation::Queries::PkgConfig.new(this_program).version?
140
+ else
141
+ cmd = "#{@prefix_to_use}#{use_this_command} #{ERROR_LINE}"
142
+ version = ::EnvironmentInformation::Queries::ComplexVersion.new(this_program) {{
143
+ prefix_to_use: prefix_to_use
144
+ }}.version?
145
+ end
146
+ end
147
+ else
148
+ e 'Not registered any key for the program: '+this_program.to_s
149
+ e 'This is currently not allowed - please add this missing information.'
150
+ exit
151
+ end
152
+ result = version
153
+ if result
154
+ unless result.include? COMMAND_NOT_FOUND
155
+ result = result.dup if result.frozen?
156
+ result.strip!
157
+ end
158
+ end
159
+ if result and (result == 'found' or result == 'foud')
160
+ register_this_component_is_missing(this_program)
161
+ elsif result and result.include?(COMMAND_NOT_FOUND)
162
+ register_this_component_is_missing(this_program)
163
+ # ======================================================================= #
164
+ # Check whether pkg-config is available or not.
165
+ # ======================================================================= #
166
+ elsif result and (
167
+ result.include?(PKGCONFIG_COMMAND_NOT_FOUND) or
168
+ result.include?(NO_SUCH_FILE_OR_DIRECTORY)
169
+ )
170
+ register_this_component_is_missing(this_program)
171
+ elsif result.nil?
172
+ register_this_component_is_missing(this_program)
173
+ end
174
+ return result
175
+ end; self.instance_eval { alias version_for? return_version_of_this_program } # === EnvironmentInformation,version_for?
176
+
177
+ end
178
+
179
+ if __FILE__ == $PROGRAM_NAME
180
+ puts EnvironmentInformation.return_version_of_this_program(ARGV)
181
+ end # envireturnversionofthisprogram ruby
182
+ # envireturnversionofthisprogram ethtools
@@ -0,0 +1,192 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/show_all_available_components.rb'
6
+ # EnvironmentInformation.show_all_available_components
7
+ # =========================================================================== #
8
+ module EnvironmentInformation
9
+
10
+ # ========================================================================= #
11
+ # The next require also pulls in the misc/ components.
12
+ # ========================================================================= #
13
+ require 'environment_information/toplevel_methods/return_version_of_this_program.rb'
14
+ require 'environment_information/constants/array_tracked_components.rb'
15
+ require 'environment_information/constants/regex.rb'
16
+ require 'environment_information/toplevel_methods/hash.rb'
17
+ require 'environment_information/toplevel_methods/autogenerate_all_relevant_methods.rb'
18
+ require 'environment_information/toplevel_methods/misc.rb'
19
+ require 'environment_information/toplevel_methods/replay_from_the_stored_file.rb'
20
+
21
+ begin
22
+ require 'rbt/requires/swift_version.rb'
23
+ rescue LoadError; end
24
+
25
+ # ========================================================================= #
26
+ # Add colours-support next:
27
+ # ========================================================================= #
28
+ require 'environment_information/colours/colours.rb'
29
+ require 'environment_information/queries/pkg_config.rb'
30
+ require 'environment_information/toplevel_methods/e.rb'
31
+ require 'environment_information/toplevel_methods/is_on_roebe.rb'
32
+ require 'environment_information/toplevel_methods/register_this_component_is_missing.rb'
33
+
34
+ # ========================================================================= #
35
+ # === EnvironmentInformation.show_all_available_components
36
+ #
37
+ # This method will quickly and easily show all available (registered)
38
+ # components. If you need more fine-tuning when you wish to display
39
+ # the main dataset at hand, then you should use other methods that
40
+ # are also a bit more complex. This method here is really just a
41
+ # fast version-display overview.
42
+ #
43
+ # The second argument to this method contains the programs that we
44
+ # wish to display through this method.
45
+ # ========================================================================= #
46
+ def self.show_all_available_components(
47
+ n_ljust = 18,
48
+ show_these_components = ARRAY_DEFAULT_PROGRAMS_ON_LINUX+
49
+ ARRAY_TRACKED_PROGRAMS,
50
+ use_colours = use_colours?
51
+ )
52
+ clear_main_hash
53
+ if show_these_components.is_a? Array
54
+ show_these_components.flatten!
55
+ end
56
+ # ======================================================================= #
57
+ # The next variable determines whether we will also compare the
58
+ # program versions.
59
+ # ======================================================================= #
60
+ compare_program_versions = false
61
+ default_nljust_value = 30 # ← Detemine default padding.
62
+ if n_ljust.is_a?(Array) and n_ljust.empty?
63
+ n_ljust = default_nljust_value # Use the default value in this case.
64
+ end
65
+ # ======================================================================= #
66
+ # First we will treat n_ljust as a commandline-flag if it is a String
67
+ # and additionally begins with "--".
68
+ # ======================================================================= #
69
+ if n_ljust.is_a?(Array) and n_ljust.first.start_with?('--')
70
+ _ = n_ljust.first
71
+ case _
72
+ # ===================================================================== #
73
+ # === --help
74
+ #
75
+ # Invocation example:
76
+ #
77
+ # showcomponents --help
78
+ #
79
+ # ===================================================================== #
80
+ when /^-?-?help$/i
81
+ e 'The following options are available for bin/fast_envi (fenvi):'
82
+ e
83
+ e ' --xorg # show only the xorg-components'
84
+ e ' --compare-to-program-versions # also compare the program versions'
85
+ e
86
+ exit
87
+ # ===================================================================== #
88
+ # === --compare-to-program-versions
89
+ #
90
+ # To invoke this, try:
91
+ #
92
+ # show_components --compare
93
+ # envi --compare-version
94
+ #
95
+ # ===================================================================== #
96
+ when *ARRAY_COMPARE_PROGRAM_VERSIONS
97
+ compare_program_versions = true
98
+ n_ljust = default_nljust_value
99
+ # ===================================================================== #
100
+ # === --xorg
101
+ # ===================================================================== #
102
+ when /^-?-?xorg$/i
103
+ show_these_components = ::EnvironmentInformation.xorg_components?
104
+ n_ljust = default_nljust_value
105
+ end
106
+ end
107
+ e
108
+ uniq = show_these_components.uniq
109
+ uniq.sort.each {|this_program|
110
+ use_this_name_for_send = "return_version_of_#{this_program}"
111
+ # ===================================================================== #
112
+ # Next, add the name of the program at hand, onto the left hand side:
113
+ # ===================================================================== #
114
+ result = this_program.to_s.ljust(n_ljust)
115
+ if use_colours
116
+ result = ::EnvironmentInformation.colourize_and_pad_the_left_side(result)
117
+ end
118
+ # ===================================================================== #
119
+ # Some components may not be installed on the user's computer system,
120
+ # which we have to keep in mind in the following code. This is
121
+ # why we will first apply the .send(), before checking whether
122
+ # the program at hand is actually missing or not.
123
+ # ===================================================================== #
124
+ result_of_send = send(use_this_name_for_send)
125
+ if result_of_send
126
+ result_of_send = result_of_send.dup if result_of_send.frozen?
127
+ result_of_send.strip!
128
+ end
129
+ @hash_available_programs[this_program.to_sym] = result_of_send.to_s
130
+ right_component = ''.dup
131
+ if @array_this_component_is_missing.include?(this_program.to_sym)
132
+ right_component << "not installed (or otherwise not found)".ljust(12)
133
+ else
134
+ right_component << result_of_send.ljust(12) if result_of_send
135
+ end
136
+ if use_colours
137
+ # =================================================================== #
138
+ # We will distinguish between components that have been found and
139
+ # components that have not been found.
140
+ # =================================================================== #
141
+ if right_component.include?('not installed')
142
+ right_component = ::Colours.send(:mediumslateblue, right_component)
143
+ else
144
+ right_component = ::Colours.send(colour_for_the_right_side, right_component)
145
+ end
146
+ end
147
+ result = result.dup if result.frozen?
148
+ result << right_component
149
+ if compare_program_versions
150
+ if is_this_program_included?(this_program)
151
+ registered_local_version = RBT.swift_return_version_of_this_program(this_program.to_sym).to_s.dup
152
+ if registered_local_version.include? 'v'
153
+ # =============================================================== #
154
+ # Modify entries such as 'v12.15.0' into '12.15.0'.
155
+ # =============================================================== #
156
+ registered_local_version.delete!('v')
157
+ end
158
+ case this_program.to_s
159
+ when 'gtk2'
160
+ registered_local_version = query_pkgconfig_version_for(:gtk2)
161
+ else
162
+ if result_of_send.nil?
163
+ # ^^^ This is missing, then, so it will be ignored.
164
+ elsif registered_local_version <= result_of_send
165
+ # This is ok.
166
+ else
167
+ result <<
168
+ royalblue(
169
+ "\n "\
170
+ "^^^ This could be updated; the version in "\
171
+ "RBT is: #{mediumpurple(registered_local_version)}"
172
+ )
173
+ end
174
+ end
175
+ end
176
+ end
177
+ # ===================================================================== #
178
+ # Finally display our findings to the end user.
179
+ # ===================================================================== #
180
+ e result
181
+ }
182
+ e
183
+ if is_on_roebe? # And store it on my home system too.
184
+ ::EnvironmentInformation.store_relevant_files
185
+ end
186
+ end
187
+
188
+ end
189
+
190
+ if __FILE__ == $PROGRAM_NAME
191
+ EnvironmentInformation.show_all_available_components(ARGV)
192
+ end # showcomponents --compare
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/toplevel_methods/write_what_into.rb'
6
+ # EnvironmentInformation.write_what_into
7
+ # =========================================================================== #
8
+ module EnvironmentInformation
9
+
10
+ require 'environment_information/toplevel_methods/e.rb'
11
+
12
+ # ========================================================================= #
13
+ # === EnvironmentInformation.write_what_into
14
+ # ========================================================================= #
15
+ def self.write_what_into(what, into)
16
+ what = what.join("\n") if what.is_a? Array
17
+ File.open(into, 'w+') {|entry| entry.write(what) }
18
+ end
19
+
20
+ end
21
+
22
+ if __FILE__ == $PROGRAM_NAME
23
+ EnvironmentInformation.write_what_into(ARGV, 'test_this.md')
24
+ end
@@ -0,0 +1,25 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/version/version.rb'
6
+ # =========================================================================== #
7
+ module EnvironmentInformation
8
+
9
+ # ========================================================================= #
10
+ # === VERSION
11
+ # ========================================================================= #
12
+ VERSION = '1.4.99'
13
+
14
+ # ========================================================================= #
15
+ # === LAST_UPDATE
16
+ # ========================================================================= #
17
+ LAST_UPDATE = '16.05.2023'
18
+
19
+ # ========================================================================= #
20
+ # === URL_TO_THE_DOCUMENTATION
21
+ # ========================================================================= #
22
+ URL_TO_THE_DOCUMENTATION =
23
+ "https://www.rubydoc.info/gems/#{self.to_s.split(/(?=[A-Z])/).join('_').downcase}/#{VERSION}"
24
+
25
+ end