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
@@ -0,0 +1,178 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # === EnvironmentInformation::EnvironmentInformation
6
+ #
7
+ # The primary purpose of this class is to provide information about
8
+ # the computer environment ruby is running on. Obviously ruby must
9
+ # be available in order for this class (this program) to work.
10
+ #
11
+ # By default, class EnvironmentInformation will run in
12
+ # "commandline mode", that is, it will output information
13
+ # onto the console/terminal.
14
+ #
15
+ # The dataset is of course also available internally, though, so you
16
+ # can query this information and display it e. g. in a traditional
17
+ # GUI or WWW setting, like for a webpage.
18
+ #
19
+ # =========================================================================== #
20
+ # A complete usage example for the main class follows next:
21
+ #
22
+ # require 'environment_information'
23
+ #
24
+ # _ = EnvironmentInformation::EnvironmentInformation.new(:do_not_run_yet)
25
+ # _.disable_colours
26
+ # _.be_silent
27
+ # _.run
28
+ # _.string
29
+ #
30
+ # =========================================================================== #
31
+ # require 'environment_information/class/initialize.rb'
32
+ # =========================================================================== #
33
+ require 'environment_information/base/base.rb'
34
+
35
+ module EnvironmentInformation
36
+
37
+ class EnvironmentInformation < ::EnvironmentInformation::Base # === EnvironmentInformation::EnvironmentInformation
38
+
39
+ require 'environment_information/class/run.rb'
40
+ # ========================================================================= #
41
+ # === initialize
42
+ # ========================================================================= #
43
+ def initialize(
44
+ commandline_arguments = nil,
45
+ run_already = true
46
+ )
47
+ register_sigint
48
+ reset
49
+ # ======================================================================= #
50
+ # Next, we handle special run-mode variants.
51
+ # ======================================================================= #
52
+ case run_already
53
+ when :do_show_everything
54
+ do_show_everything
55
+ run_already = true
56
+ end
57
+ # ======================================================================= #
58
+ # And set @run_already, so that menu() can overrule it lateron.
59
+ # ======================================================================= #
60
+ @run_already = run_already
61
+ set_commandline_arguments(
62
+ commandline_arguments
63
+ )
64
+ # ======================================================================= #
65
+ # === Handle blocks
66
+ #
67
+ # Next blocks will be handled. This must come after the reset() method.
68
+ # ======================================================================= #
69
+ if block_given?
70
+ yielded = yield
71
+ case yielded # case tag
72
+ # ===================================================================== #
73
+ # === :do_not_use_rbt
74
+ # ===================================================================== #
75
+ when :do_not_use_rbt
76
+ @may_we_try_to_use_rbt = false
77
+ # ===================================================================== #
78
+ # === :disable_colours
79
+ # ===================================================================== #
80
+ when :disable_colours
81
+ disable_colours
82
+ # ===================================================================== #
83
+ # === :disable_colours_and_do_not_store_into_a_local_file
84
+ # ===================================================================== #
85
+ when :disable_colours_and_do_not_store_into_a_local_file
86
+ disable_colours
87
+ do_not_save_anything
88
+ # ===================================================================== #
89
+ # === :do_not_run_yet
90
+ # ===================================================================== #
91
+ when :do_not_run_yet
92
+ @run_already = false
93
+ else
94
+ # =================================================================== #
95
+ # Handle Hashes given in the block.
96
+ # =================================================================== #
97
+ if yielded.is_a? Hash
98
+ # ================================================================= #
99
+ # === :use_n_tokens
100
+ # ================================================================= #
101
+ if yielded.has_key? :use_n_tokens
102
+ set_use_n_tokens(yielded.delete(:use_n_tokens))
103
+ # ================================================================= #
104
+ # === :n_tokens
105
+ # ================================================================= #
106
+ elsif yielded.has_key? :n_tokens
107
+ set_use_n_tokens(yielded.delete(:n_tokens))
108
+ end
109
+ # ================================================================= #
110
+ # === :use_colours
111
+ # ================================================================= #
112
+ if yielded.has_key? :use_colours
113
+ set_use_colours(yielded.delete(:use_colours))
114
+ end
115
+ # ================================================================= #
116
+ # === :be_silent
117
+ # ================================================================= #
118
+ if yielded.has_key? :be_silent
119
+ set_be_silent(yielded.delete(:be_silent))
120
+ end
121
+ # ================================================================= #
122
+ # === :show_ruby_stuff
123
+ # ================================================================= #
124
+ if yielded.has_key? :show_ruby_stuff
125
+ if yielded.delete(:show_ruby_stuff) == false
126
+ dont_show_ruby_stuff
127
+ end
128
+ end
129
+ end
130
+ end
131
+ end
132
+ # ======================================================================= #
133
+ # First, we will add the default programs on a linux computer. The
134
+ # later invocation to menu() can change this, but we also want to
135
+ # provide "useful defaults" for users to benefit from this gem.
136
+ # ======================================================================= #
137
+ add_the_default_programs_on_a_linux_computer
138
+ # ======================================================================= #
139
+ # Add the ruby components next. This must come before menu().
140
+ # ======================================================================= #
141
+ consider_adding_the_ruby_components
142
+ # ======================================================================= #
143
+ # Invoke menu() to query and honour the commandline arguments.
144
+ # ======================================================================= #
145
+ menu
146
+ run if @run_already
147
+ end
148
+
149
+ # ========================================================================= #
150
+ # === EnvironmentInformation::EnvironmentInformation[]
151
+ # ========================================================================= #
152
+ def self.[](i = '', &block)
153
+ new(i, &block)
154
+ end
155
+
156
+ end
157
+
158
+ # =========================================================================== #
159
+ # === EnvironmentInformation.run_the_main_class
160
+ # =========================================================================== #
161
+ def self.run_the_main_class(i = ARGV, &block)
162
+ ::EnvironmentInformation::EnvironmentInformation.new(i, &block)
163
+ end; self.instance_eval { alias result run_the_main_class } # === EnvironmentInformation.result
164
+ self.instance_eval { alias show run_the_main_class } # === EnvironmentInformation.show
165
+ self.instance_eval { alias new run_the_main_class } # === EnvironmentInformation.new
166
+ self.instance_eval { alias [] run_the_main_class } # === EnvironmentInformation[]
167
+
168
+ # =========================================================================== #
169
+ # === EnvironmentInformation.environment_information?
170
+ #
171
+ # This method will return a very long string containing all
172
+ # information about the locally installed/available programs.
173
+ # =========================================================================== #
174
+ def self.environment_information?
175
+ ::EnvironmentInformation::EnvironmentInformation.new(:full_be_silent).stringified
176
+ end
177
+
178
+ end
@@ -0,0 +1,436 @@
1
+ #!/usr/bin/ruby -w
2
+ # Encoding: UTF-8
3
+ # frozen_string_literal: true
4
+ # =========================================================================== #
5
+ # require 'environment_information/class/menu.rb'
6
+ # =========================================================================== #
7
+ require 'environment_information/base/base.rb'
8
+
9
+ module EnvironmentInformation
10
+
11
+ class EnvironmentInformation < ::EnvironmentInformation::Base # === EnvironmentInformation::EnvironmentInformation
12
+
13
+ require 'environment_information/class/help.rb'
14
+ require 'environment_information/class/html.rb'
15
+ require 'environment_information/class/misc.rb'
16
+ require 'environment_information/class/ruby.rb'
17
+
18
+ # ========================================================================= #
19
+ # === menu (menu tag)
20
+ #
21
+ # This method constitutes the "menu" interface for class
22
+ # EnvironmentInformation. It usually deals with the
23
+ # commandline-given arguments stored in ARGV.
24
+ # ========================================================================= #
25
+ def menu(
26
+ i = @commandline_arguments
27
+ )
28
+ if i.is_a? Array
29
+ i.each {|entry| menu(entry) }
30
+ else
31
+ case i # case tag
32
+ # ===================================================================== #
33
+ # === envi --show-remote-url
34
+ #
35
+ # This entry point will also show the remote URL to the
36
+ # program at hand.
37
+ # ===================================================================== #
38
+ when /^-?-?show(_|-)?remote(_|-)?url$/i
39
+ do_report_the_remote_urls
40
+ # ===================================================================== #
41
+ # === envi --help
42
+ #
43
+ # This entry point will always show help-related information.
44
+ # ===================================================================== #
45
+ when /^-?-?help$/i
46
+ do_show_help
47
+ # ===================================================================== #
48
+ # === envi --really-all
49
+ #
50
+ # This entry point is for really showing everything.
51
+ # ===================================================================== #
52
+ when /^-?-?REALLY(_|-)?ALL$/i,
53
+ /^-?-?compare(_|-)?program(_|-)?version$/i,
54
+ /^-?-?compare(_|-)?to(_|-)?program(_|-)?versions$/i,
55
+ /^-?-?do(_|-)?compare(_|-)?program(_|-)?version$/i,
56
+ /^-?-?really(_|-)?everything$/i
57
+ clear_old_dataset
58
+ add_default_linux_programs
59
+ add_ruby_and_rubygems
60
+ do_show_almost_everything_excluding_the_default_linux_programs
61
+ do_compare_the_program_version
62
+ # ===================================================================== #
63
+ # === envi --no-save
64
+ #
65
+ # Skip saving into a local file through this entry point.
66
+ #
67
+ # Invocation example:
68
+ #
69
+ # envi --lfs --no-save
70
+ #
71
+ # ===================================================================== #
72
+ when /^-?-?no(_|-)?save$/i
73
+ do_not_save_anything
74
+ # ===================================================================== #
75
+ # === envi --os?
76
+ # ===================================================================== #
77
+ when /^-?-?OS\??$/i,
78
+ /^-?-?show(-|_)?only(-|_)?the(-|_)?operating(-|_)?system$/i
79
+ do_show_only_the_operating_system
80
+ show_no_ruby
81
+ # ===================================================================== #
82
+ # === envi --help
83
+ # ===================================================================== #
84
+ when /help/i
85
+ @show_help = true
86
+ # ===================================================================== #
87
+ # === envi --clear
88
+ #
89
+ # This entry point will simply clear the old dataset.
90
+ #
91
+ # This can be used to only display a few components, such as:
92
+ #
93
+ # envi --clear --python --ruby --perl
94
+ #
95
+ # ===================================================================== #
96
+ when /^-?-?clear$/i,
97
+ /^-?-?clear(_|-)?old(_|-)?dataset$/i
98
+ clear_old_dataset
99
+ # ===================================================================== #
100
+ # === envi --sinatra
101
+ # ===================================================================== #
102
+ when /^-?-?sinatra$/i,
103
+ /^-?-?www$/i
104
+ start_the_sinatra_interface
105
+ # ===================================================================== #
106
+ # === envi --n_entries
107
+ # ===================================================================== #
108
+ when /^-?-?n(_|-)?entries$/i
109
+ show_n_registered_entries # === envi --n_entries
110
+ @do_exit_the_program = true
111
+ # ===================================================================== #
112
+ # === envi --open
113
+ # ===================================================================== #
114
+ when /^-?-?open$/i,
115
+ /^-?-?edit$/i
116
+ open_this_file_in_editor
117
+ # ===================================================================== #
118
+ # === envi --lfs
119
+ # ===================================================================== #
120
+ when /^-?-?lfs$/i,
121
+ /^-?-?lfs(_|-)?core(_|-)?programs$/i
122
+ clear_old_dataset
123
+ add(:lfs_core_programs)
124
+ # ===================================================================== #
125
+ # === envi openssl
126
+ # ===================================================================== #
127
+ when /^-?-?openssl$/,
128
+ 'ssl'
129
+ add(:openssl)
130
+ # ===================================================================== #
131
+ # === envi --science
132
+ # ===================================================================== #
133
+ when /^-?-?science$/
134
+ clear_old_dataset
135
+ add(:science_cluster)
136
+ # ===================================================================== #
137
+ # === envi --nocolours
138
+ #
139
+ # This entry point can be used to disable usage of colours.
140
+ # ===================================================================== #
141
+ when /^-?-?nocolours/,'2',
142
+ /^-?-?no(-|_)?colou?rs$/i,
143
+ /^-?-?nocol$/i,
144
+ /^-?-?disable(-|_)?colou?rs$/i, # === envi --really-all --disable-colours
145
+ :disable_colours
146
+ disable_colours
147
+ # ===================================================================== #
148
+ # === envi --use-colours?
149
+ # ===================================================================== #
150
+ when /^-?-?use(-|_)?colou?rs\??$/i
151
+ e 'Will colours be used? '+
152
+ ::EnvironmentInformation.use_colours?.to_s
153
+ do_not_run
154
+ @do_exit_the_program = true
155
+ # ===================================================================== #
156
+ # === envi --version
157
+ # ===================================================================== #
158
+ when *ARRAY_VERSION
159
+ report_version
160
+ # ===================================================================== #
161
+ # === envi --gui
162
+ # ===================================================================== #
163
+ when /^-?-?gui$/i,
164
+ /^-?-?gtk$/i,
165
+ /^-?-?start(-|_)?gtk$/i
166
+ start_gtk_component
167
+ # ===================================================================== #
168
+ # === envi --replay
169
+ # ===================================================================== #
170
+ when /^-?-?replay$/i
171
+ require 'environment_information/toplevel_methods/replay_from_the_stored_file.rb'
172
+ ::EnvironmentInformation.replay_from_the_stored_file
173
+ # ===================================================================== #
174
+ # === envi --be_silent_no_colours
175
+ #
176
+ # Not sure why the following entry point exists, but I will retain it
177
+ # for the time being.
178
+ # ===================================================================== #
179
+ when /^-?-?be(_|-)?silent(_|-)?no(_|-)?colours$/
180
+ disable_colours
181
+ do_not_display_the_result
182
+ do_show_everything
183
+ # ===================================================================== #
184
+ # This entry point is mostly for internal use, e. g. to pass
185
+ # in Symbols to menu().
186
+ # ===================================================================== #
187
+ when :be_silent_no_colours_everything,
188
+ :be_silent_and_no_colours,
189
+ :be_silent_no_colours,
190
+ :full_be_silent
191
+ disable_colours
192
+ do_show_everything
193
+ do_not_display_the_result
194
+ # ===================================================================== #
195
+ # === envi --be_silent
196
+ # ===================================================================== #
197
+ when /^-?-?be(_|-)?silent$/i # === envi --be-silent
198
+ do_not_display_the_result
199
+ do_show_everything
200
+ # ===================================================================== #
201
+ # === envi --work-on-programs-directory-only
202
+ # ===================================================================== #
203
+ when /^-?-?work(-|_)?on(-|_)?programs(-|_)?directory(-|_)?only$/i,
204
+ /^-?-?work(-|_)?on(-|_)?the(-|_)?programs(-|_)?directory(-|_)?only$/i
205
+ work_on_the_programs_directory_only
206
+ # ===================================================================== #
207
+ # === envi --do-save
208
+ # ===================================================================== #
209
+ when /^save$/i,
210
+ /^-?-?do(_|-)?save$/i
211
+ @store_the_results_into_local_files = true
212
+ # ===================================================================== #
213
+ # === envi --asciitable
214
+ # ===================================================================== #
215
+ when /^-?-?asciitable$/i,
216
+ 'table','1'
217
+ use_ascii_table if ASCIITABLE_IS_AVAILABLE
218
+ # ===================================================================== #
219
+ # === envi --read-from-this-file=/Depot/j/display_these_programs.md
220
+ # === envi --file=/Depot/j/display_these_programs.md
221
+ # === envi --input-from=/Depot/j/display_these_programs.md
222
+ # ===================================================================== #
223
+ when /^-?-?read(-|_)?from(-|_)?this(-|_)?file=(.+)$/i, # <- And this has $4
224
+ /^-?-?file=(.+)$/i, # <- This has only $1
225
+ /^-?-?input(-|_)?from=(.+)$/i # <- This has $2
226
+ _ = $1.to_s.dup
227
+ _ = $2.to_s.dup if $2
228
+ _ = $4.to_s.dup if $4
229
+ clear_old_dataset
230
+ set_use_this_as_main_input(
231
+ load_dataset_from_this_file(_)
232
+ )
233
+ # ===================================================================== #
234
+ # === envi --no-yaml-file
235
+ # ===================================================================== #
236
+ when /^-?-?no(-|_)?yaml(-|_)?file$/i,
237
+ /^-?-?no(-|_)?local(-|_)?file$/i
238
+ @store_the_results_into_local_files = false
239
+ # ===================================================================== #
240
+ # === envi noruby
241
+ # ===================================================================== #
242
+ when /^-?-?noruby$/i,
243
+ 'show_no_ruby',
244
+ 'classic',
245
+ 'naked',
246
+ '3',
247
+ 'minimal'
248
+ show_no_ruby
249
+ # ===================================================================== #
250
+ # === envi --show-all
251
+ # ===================================================================== #
252
+ when /^-?-?show(-|_)?all$/i,
253
+ /^-?-?all$/i,
254
+ /^-?-?full$/i,
255
+ /^-?-?everything$/i, # === envi --everything
256
+ /^-?-?information$/i,
257
+ 'f',
258
+ '4'
259
+ do_show_everything # <- Just to be sure.
260
+ # ===================================================================== #
261
+ # === envi --short
262
+ # ===================================================================== #
263
+ when /^-?-?short$/i,
264
+ /^-?-?display(-|_)?short(-|_)?format$/i,
265
+ /^-?-?do(-|_)?display(-|_)?in(-|_)?a(-|_)?short(-|_)?format$/i
266
+ do_display_in_a_short_format
267
+ # ===================================================================== #
268
+ # === :be_silent
269
+ # ===================================================================== #
270
+ when /^-?-?be(_|-)?silent$/i,
271
+ :be_silent # We will be silent, but we will still show everything.
272
+ do_not_display_the_result
273
+ do_show_everything
274
+ # ===================================================================== #
275
+ # === envi --compare_programs
276
+ #
277
+ # This entry point allows us to compare the program versions with
278
+ # the one registered in RBT.
279
+ # ===================================================================== #
280
+ when *ARRAY_COMPARE_PROGRAM_VERSIONS
281
+ do_compare_the_program_version
282
+ # ===================================================================== #
283
+ # === envi --additional=php
284
+ #
285
+ # This entry point allows us to show additional programs.
286
+ #
287
+ # Another usage example:
288
+ #
289
+ # envi --additional=php,python,perl
290
+ #
291
+ # ===================================================================== #
292
+ when /^-?-?additional=(.+)$/i,
293
+ /^-?-?add=(.+)$/i
294
+ _ = $1.to_s.dup
295
+ add(_)
296
+ # ===================================================================== #
297
+ # === envi --sort-alphabetically
298
+ #
299
+ # This entry point can also be combined, such as in:
300
+ #
301
+ # envi --show-everything --sort-alphabetically
302
+ #
303
+ # ===================================================================== #
304
+ when /^-?-?sort(-|_)?alphabetically$/i,
305
+ /^-?-?sort$/i,
306
+ /^-?-?alphabetically$/i,
307
+ /^-?-?alphabet$/i
308
+ enable_sort_alphabetically
309
+ # ===================================================================== #
310
+ # === :do_show_everything
311
+ #
312
+ # An alternative way to make use of this entry point is via:
313
+ #
314
+ # envi --do-show-everything
315
+ # envi --show-everything
316
+ #
317
+ # ===================================================================== #
318
+ when :do_show_everything,
319
+ :show_really_everything,
320
+ /^-?-?do(_|-)?show(_|-)?everything$/i,
321
+ /^-?-?show(-|_)?everything$/i,
322
+ /^-?-?show(-|_)?full(-|_)?information$/i,
323
+ /^-?-?everything$/i,
324
+ /^-?-?rall$/i,
325
+ 'ALL'
326
+ do_show_everything
327
+ @run_already = true
328
+ # ===================================================================== #
329
+ # === envi --registered-components?
330
+ # ===================================================================== #
331
+ when /^-?-?registered(_|-)?components\??$/i,
332
+ /^-?-?available\??$/i
333
+ do_not_run_already
334
+ show_the_registered_components
335
+ @do_exit_the_program = true
336
+ # ===================================================================== #
337
+ # === envi --use-these-programs=bash,binutils,bison,yacc,bzip2,coreutils,diff,find,gawk,gcc,grep,gzip,linux,make,m4,patch,perl,python,sed,tar,makeinfo,xz
338
+ # === envi --use-these-programs=:lfs
339
+ #
340
+ # This entry point can be used to display a certain subset of
341
+ # programs, at the user's discretion.
342
+ # ===================================================================== #
343
+ when /^-?-?use(-|_)?these(-|_)?programs=(.+)$/i # === $3
344
+ # =================================================================== #
345
+ # First clear (aka reset) the main dataset.
346
+ # =================================================================== #
347
+ clear_old_dataset
348
+ match = $3.to_s.dup
349
+ add(match)
350
+ # ===================================================================== #
351
+ # === envi --generate-html-file
352
+ #
353
+ # This entry point can be used to generate a local .html file.
354
+ # ===================================================================== #
355
+ when /^-?-?generate(-|_)?html(-|_)?file$/i,
356
+ /^-?-?html$/i # envi --HTML
357
+ @internal_hash[:generate_a_html_file] = true
358
+ set_runmode_html # Set it here again, just in case.
359
+ do_show_everything
360
+ # ===================================================================== #
361
+ # === envi --show-components?
362
+ # ===================================================================== #
363
+ when /^-?-?show(-|_)?components\??$/i
364
+ e "#{true_rev}The following components will be shown on a default run:"
365
+ e
366
+ show_these_components?.each {|this_component|
367
+ if this_component.is_a? Array
368
+ this_component = this_component.first
369
+ end
370
+ e " - #{steelblue(this_component)}#{true_rev}"
371
+ }
372
+ e
373
+ exit
374
+ # ===================================================================== #
375
+ # === :do_not_run_yet
376
+ #
377
+ # Invocation example:
378
+ #
379
+ # envi --do-not-run-yet
380
+ #
381
+ # ===================================================================== #
382
+ when /^-?-?-do(-|_)?not(-|_)?run(-|_)?yet$/i, # === envi --do-not-run-yet
383
+ :do_not_run_yet,
384
+ :dont_run_yet,
385
+ :default # This is the default variant.
386
+ @run_already = false
387
+ # ===================================================================== #
388
+ # === envi --pkgconfig
389
+ #
390
+ # Show all pkgconfig entries - but only these.
391
+ # ===================================================================== #
392
+ when /^-?-?pkg(-|_)?config$/i
393
+ clear_old_dataset
394
+ add(:pkgconfig_entries)
395
+ # ===================================================================== #
396
+ # === envi --xorg-components
397
+ #
398
+ # This entry point is for when the user only wants to show the
399
+ # xorg-components on the local computer system.
400
+ # ===================================================================== #
401
+ when /^-?-?xorg(_|-)?components$/i,
402
+ /^-?-?xorg$/i,
403
+ /^-?-?show(_|-)?xorg(_|-)?components$/i
404
+ do_show_only_the_xorg_components
405
+ else # else tag
406
+ # =================================================================== #
407
+ # It is better to report that the given commandline-input as
408
+ # not found, so this will be reported. Before we can do so, we
409
+ # will first check whether the user wanted to pass some
410
+ # existing/registered component nonetheless.
411
+ #
412
+ # This clause can be checked via something like this:
413
+ #
414
+ # envi --bash
415
+ #
416
+ # =================================================================== #
417
+ if is_a_registered_component?(i.delete('-'))
418
+ add(
419
+ i.delete('-')
420
+ )
421
+ else
422
+ # ================================================================= #
423
+ # Only enter the report-section if we do NOT want to exit early.
424
+ # ================================================================= #
425
+ do_show_help if show_help?
426
+ # Or:
427
+ # e 'Unhandled command input (in file environment_information/class/menu.rb): '
428
+ # e
429
+ # e " #{sfancy(i)}"
430
+ # e
431
+ end
432
+ end
433
+ end
434
+ end
435
+
436
+ end; end